diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:32 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:21 -0500 |
commit | b7ab39f631f505edc2bbdb86620d5493f995c9da (patch) | |
tree | 62be97ebc7fc69ceb601f23312d335ebb8038ee7 /fs/ceph | |
parent | 2304450783dfde7b0b94ae234edd0dbffa865073 (diff) |
fs: dcache scale dentry refcount
Make d_count non-atomic and protect it with d_lock. This allows us to ensure a
0 refcount dentry remains 0 without dcache_lock. It is also fairly natural when
we start protecting many other dentry members with d_lock.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/dir.c | 4 | ||||
-rw-r--r-- | fs/ceph/inode.c | 4 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index d902948a90d8..3ecf915a4550 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -150,7 +150,9 @@ more: | |||
150 | di = ceph_dentry(dentry); | 150 | di = ceph_dentry(dentry); |
151 | } | 151 | } |
152 | 152 | ||
153 | atomic_inc(&dentry->d_count); | 153 | spin_lock(&dentry->d_lock); |
154 | dentry->d_count++; | ||
155 | spin_unlock(&dentry->d_lock); | ||
154 | spin_unlock(&dcache_lock); | 156 | spin_unlock(&dcache_lock); |
155 | 157 | ||
156 | dout(" %llu (%llu) dentry %p %.*s %p\n", di->offset, filp->f_pos, | 158 | dout(" %llu (%llu) dentry %p %.*s %p\n", di->offset, filp->f_pos, |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index bf1286588f26..bb68c799074d 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -879,8 +879,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
879 | } else if (realdn) { | 879 | } else if (realdn) { |
880 | dout("dn %p (%d) spliced with %p (%d) " | 880 | dout("dn %p (%d) spliced with %p (%d) " |
881 | "inode %p ino %llx.%llx\n", | 881 | "inode %p ino %llx.%llx\n", |
882 | dn, atomic_read(&dn->d_count), | 882 | dn, dn->d_count, |
883 | realdn, atomic_read(&realdn->d_count), | 883 | realdn, realdn->d_count, |
884 | realdn->d_inode, ceph_vinop(realdn->d_inode)); | 884 | realdn->d_inode, ceph_vinop(realdn->d_inode)); |
885 | dput(dn); | 885 | dput(dn); |
886 | dn = realdn; | 886 | dn = realdn; |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 38800eaa81d0..a50fca1e03be 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1486,7 +1486,7 @@ retry: | |||
1486 | *base = ceph_ino(temp->d_inode); | 1486 | *base = ceph_ino(temp->d_inode); |
1487 | *plen = len; | 1487 | *plen = len; |
1488 | dout("build_path on %p %d built %llx '%.*s'\n", | 1488 | dout("build_path on %p %d built %llx '%.*s'\n", |
1489 | dentry, atomic_read(&dentry->d_count), *base, len, path); | 1489 | dentry, dentry->d_count, *base, len, path); |
1490 | return path; | 1490 | return path; |
1491 | } | 1491 | } |
1492 | 1492 | ||