提交 ee6b1baf 编写于 作者: S Sage Weil

ceph: avoid useless dget/dput in encode_fh

Nothing we do here sleeps, so just do it under d_lock and avoid the dget/
dput entirely.
Reported-by: NAl Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: NSage Weil <sage@newdream.net>
上级 b8cd952b
...@@ -56,9 +56,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, ...@@ -56,9 +56,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
return -EINVAL; return -EINVAL;
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
parent = dget(dentry->d_parent); parent = dentry->d_parent;
spin_unlock(&dentry->d_lock);
if (*max_len >= connected_handle_length) { if (*max_len >= connected_handle_length) {
dout("encode_fh %p connectable\n", dentry); dout("encode_fh %p connectable\n", dentry);
cfh->ino = ceph_ino(dentry->d_inode); cfh->ino = ceph_ino(dentry->d_inode);
...@@ -81,7 +79,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, ...@@ -81,7 +79,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
*max_len = handle_length; *max_len = handle_length;
type = 255; type = 255;
} }
dput(parent); spin_unlock(&dentry->d_lock);
return type; return type;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册