diff options
author | Sage Weil <sage@newdream.net> | 2012-01-03 11:20:40 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2012-01-10 11:57:00 -0500 |
commit | ee6b1baf67591b6d7ce1a6a07544343433d5ec9e (patch) | |
tree | 8aac5a6a2172d84d4188fe97bf3fe84aa558dc75 /fs/ceph | |
parent | b8cd952b51034ad9f20ca147507ee68dc641c98c (diff) |
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: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/export.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 9fbcdecaaccd..fbb2a643ef10 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -56,9 +56,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, | |||
56 | return -EINVAL; | 56 | return -EINVAL; |
57 | 57 | ||
58 | spin_lock(&dentry->d_lock); | 58 | spin_lock(&dentry->d_lock); |
59 | parent = dget(dentry->d_parent); | 59 | parent = dentry->d_parent; |
60 | spin_unlock(&dentry->d_lock); | ||
61 | |||
62 | if (*max_len >= connected_handle_length) { | 60 | if (*max_len >= connected_handle_length) { |
63 | dout("encode_fh %p connectable\n", dentry); | 61 | dout("encode_fh %p connectable\n", dentry); |
64 | cfh->ino = ceph_ino(dentry->d_inode); | 62 | 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 | *max_len = handle_length; | 79 | *max_len = handle_length; |
82 | type = 255; | 80 | type = 255; |
83 | } | 81 | } |
84 | dput(parent); | 82 | spin_unlock(&dentry->d_lock); |
85 | return type; | 83 | return type; |
86 | } | 84 | } |
87 | 85 | ||