diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:34 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:21 -0500 |
commit | 2fd6b7f50797f2e993eea59e0a0b8c6399c811dc (patch) | |
tree | ce33b94b34844c09103836cf4cfa4364b742f217 /fs/ceph/inode.c | |
parent | da5029563a0a026c64821b09e8e7b4fd81d3fe1b (diff) |
fs: dcache scale subdirs
Protect d_subdirs and d_child with d_lock, except in filesystems that aren't
using dcache_lock for these anyway (eg. using i_mutex).
Note: if we change the locking rule in future so that ->d_child protection is
provided only with ->d_parent->d_lock, it may allow us to reduce some locking.
But it would be an exception to an otherwise regular locking scheme, so we'd
have to see some good results. Probably not worthwhile.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index bb68c799074d..2c6944473366 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -842,11 +842,13 @@ static void ceph_set_dentry_offset(struct dentry *dn) | |||
842 | spin_unlock(&inode->i_lock); | 842 | spin_unlock(&inode->i_lock); |
843 | 843 | ||
844 | spin_lock(&dcache_lock); | 844 | spin_lock(&dcache_lock); |
845 | spin_lock(&dn->d_lock); | 845 | spin_lock(&dir->d_lock); |
846 | spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); | ||
846 | list_move(&dn->d_u.d_child, &dir->d_subdirs); | 847 | list_move(&dn->d_u.d_child, &dir->d_subdirs); |
847 | dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, | 848 | dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, |
848 | dn->d_u.d_child.prev, dn->d_u.d_child.next); | 849 | dn->d_u.d_child.prev, dn->d_u.d_child.next); |
849 | spin_unlock(&dn->d_lock); | 850 | spin_unlock(&dn->d_lock); |
851 | spin_unlock(&dir->d_lock); | ||
850 | spin_unlock(&dcache_lock); | 852 | spin_unlock(&dcache_lock); |
851 | } | 853 | } |
852 | 854 | ||
@@ -1232,9 +1234,11 @@ retry_lookup: | |||
1232 | } else { | 1234 | } else { |
1233 | /* reorder parent's d_subdirs */ | 1235 | /* reorder parent's d_subdirs */ |
1234 | spin_lock(&dcache_lock); | 1236 | spin_lock(&dcache_lock); |
1235 | spin_lock(&dn->d_lock); | 1237 | spin_lock(&parent->d_lock); |
1238 | spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); | ||
1236 | list_move(&dn->d_u.d_child, &parent->d_subdirs); | 1239 | list_move(&dn->d_u.d_child, &parent->d_subdirs); |
1237 | spin_unlock(&dn->d_lock); | 1240 | spin_unlock(&dn->d_lock); |
1241 | spin_unlock(&parent->d_lock); | ||
1238 | spin_unlock(&dcache_lock); | 1242 | spin_unlock(&dcache_lock); |
1239 | } | 1243 | } |
1240 | 1244 | ||