ceph: add request to i_unsafe_dirops when getting unsafe reply
Previously we add request to i_unsafe_dirops when registering request. So ceph_fsync() also waits for imcomplete requests. This is unnecessary, ceph_fsync() only needs to wait unsafe requests. Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
cbf99a11fb
commit
4c06ace81a
|
@ -633,13 +633,8 @@ static void __register_request(struct ceph_mds_client *mdsc,
|
|||
mdsc->oldest_tid = req->r_tid;
|
||||
|
||||
if (dir) {
|
||||
struct ceph_inode_info *ci = ceph_inode(dir);
|
||||
|
||||
ihold(dir);
|
||||
spin_lock(&ci->i_unsafe_lock);
|
||||
req->r_unsafe_dir = dir;
|
||||
list_add_tail(&req->r_unsafe_dir_item, &ci->i_unsafe_dirops);
|
||||
spin_unlock(&ci->i_unsafe_lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,13 +660,14 @@ static void __unregister_request(struct ceph_mds_client *mdsc,
|
|||
rb_erase(&req->r_node, &mdsc->request_tree);
|
||||
RB_CLEAR_NODE(&req->r_node);
|
||||
|
||||
if (req->r_unsafe_dir) {
|
||||
if (req->r_unsafe_dir && req->r_got_unsafe) {
|
||||
struct ceph_inode_info *ci = ceph_inode(req->r_unsafe_dir);
|
||||
|
||||
spin_lock(&ci->i_unsafe_lock);
|
||||
list_del_init(&req->r_unsafe_dir_item);
|
||||
spin_unlock(&ci->i_unsafe_lock);
|
||||
}
|
||||
|
||||
if (req->r_unsafe_dir) {
|
||||
iput(req->r_unsafe_dir);
|
||||
req->r_unsafe_dir = NULL;
|
||||
}
|
||||
|
@ -2484,6 +2480,14 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
|
|||
} else {
|
||||
req->r_got_unsafe = true;
|
||||
list_add_tail(&req->r_unsafe_item, &req->r_session->s_unsafe);
|
||||
if (req->r_unsafe_dir) {
|
||||
struct ceph_inode_info *ci =
|
||||
ceph_inode(req->r_unsafe_dir);
|
||||
spin_lock(&ci->i_unsafe_lock);
|
||||
list_add_tail(&req->r_unsafe_dir_item,
|
||||
&ci->i_unsafe_dirops);
|
||||
spin_unlock(&ci->i_unsafe_lock);
|
||||
}
|
||||
}
|
||||
|
||||
dout("handle_reply tid %lld result %d\n", tid, result);
|
||||
|
|
Loading…
Reference in New Issue