aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-07-26 14:30:55 -0400
committerSage Weil <sage@newdream.net>2011-07-26 14:30:55 -0400
commite5f86dc377e7ff2b4195831153a85a3e76fefff2 (patch)
treef15c11fc2c9b08e64555bbb601e582dc8f7325bd /fs/ceph/dir.c
parentbf1c6aca96c9d2f117dc7e590c2bc2304e7febe1 (diff)
ceph: avoid d_parent in ceph_dentry_hash; fix ceph_encode_fh() hashing bug
Have caller pass in a safely-obtained reference to the parent directory for calculating a dentry's hash valud. While we're here, simpify the flow through ceph_encode_fh() so that there is a single exit point and cleanup. Also fix a bug with the dentry hash calculation: calculate the hash for the dentry we were given, not its parent. Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 31d27f8f8261..33a19df72288 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1244,9 +1244,8 @@ void ceph_dentry_lru_del(struct dentry *dn)
1244 * Return name hash for a given dentry. This is dependent on 1244 * Return name hash for a given dentry. This is dependent on
1245 * the parent directory's hash function. 1245 * the parent directory's hash function.
1246 */ 1246 */
1247unsigned ceph_dentry_hash(struct dentry *dn) 1247unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn)
1248{ 1248{
1249 struct inode *dir = dn->d_parent->d_inode;
1250 struct ceph_inode_info *dci = ceph_inode(dir); 1249 struct ceph_inode_info *dci = ceph_inode(dir);
1251 1250
1252 switch (dci->i_dir_layout.dl_dir_hash) { 1251 switch (dci->i_dir_layout.dl_dir_hash) {