diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:25:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:25:24 -0500 |
commit | a1703154200c390ab03c10224c586e815d3e31e8 (patch) | |
tree | df90865eed3cfdf7af8664b5453a90e09d17480a /fs/ceph/dir.c | |
parent | 67b5ad9a63caa2ce56ddd2b22b802dae00d72c13 (diff) | |
parent | 766fc43973b16f9becb6b7402b3e052dbb84adee (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
rbd: fix cleanup when trying to mount inexistent image
net/ceph: make ceph_msgr_wq non-reentrant
ceph: fsc->*_wq's aren't used in memory reclaim path
ceph: Always free allocated memory in osdmap_decode()
ceph: Makefile: Remove unnessary code
ceph: associate requests with opening sessions
ceph: drop redundant r_mds field
ceph: implement DIRLAYOUTHASH feature to get dir layout from MDS
ceph: add dir_layout to inode
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r-- | fs/ceph/dir.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index fa7ca04ee816..0bc68de8edd7 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1224,6 +1224,26 @@ void ceph_dentry_lru_del(struct dentry *dn) | |||
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | /* | ||
1228 | * Return name hash for a given dentry. This is dependent on | ||
1229 | * the parent directory's hash function. | ||
1230 | */ | ||
1231 | unsigned ceph_dentry_hash(struct dentry *dn) | ||
1232 | { | ||
1233 | struct inode *dir = dn->d_parent->d_inode; | ||
1234 | struct ceph_inode_info *dci = ceph_inode(dir); | ||
1235 | |||
1236 | switch (dci->i_dir_layout.dl_dir_hash) { | ||
1237 | case 0: /* for backward compat */ | ||
1238 | case CEPH_STR_HASH_LINUX: | ||
1239 | return dn->d_name.hash; | ||
1240 | |||
1241 | default: | ||
1242 | return ceph_str_hash(dci->i_dir_layout.dl_dir_hash, | ||
1243 | dn->d_name.name, dn->d_name.len); | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1227 | const struct file_operations ceph_dir_fops = { | 1247 | const struct file_operations ceph_dir_fops = { |
1228 | .read = ceph_read_dir, | 1248 | .read = ceph_read_dir, |
1229 | .readdir = ceph_readdir, | 1249 | .readdir = ceph_readdir, |