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/autofs4 | |
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/autofs4')
-rw-r--r-- | fs/autofs4/expire.c | 8 | ||||
-rw-r--r-- | fs/autofs4/root.c | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index a796c9417fb1..413b5642e6cf 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -198,7 +198,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt, | |||
198 | else | 198 | else |
199 | ino_count++; | 199 | ino_count++; |
200 | 200 | ||
201 | if (atomic_read(&p->d_count) > ino_count) { | 201 | if (p->d_count > ino_count) { |
202 | top_ino->last_used = jiffies; | 202 | top_ino->last_used = jiffies; |
203 | dput(p); | 203 | dput(p); |
204 | return 1; | 204 | return 1; |
@@ -347,7 +347,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
347 | 347 | ||
348 | /* Path walk currently on this dentry? */ | 348 | /* Path walk currently on this dentry? */ |
349 | ino_count = atomic_read(&ino->count) + 2; | 349 | ino_count = atomic_read(&ino->count) + 2; |
350 | if (atomic_read(&dentry->d_count) > ino_count) | 350 | if (dentry->d_count > ino_count) |
351 | goto next; | 351 | goto next; |
352 | 352 | ||
353 | /* Can we umount this guy */ | 353 | /* Can we umount this guy */ |
@@ -369,7 +369,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
369 | if (!exp_leaves) { | 369 | if (!exp_leaves) { |
370 | /* Path walk currently on this dentry? */ | 370 | /* Path walk currently on this dentry? */ |
371 | ino_count = atomic_read(&ino->count) + 1; | 371 | ino_count = atomic_read(&ino->count) + 1; |
372 | if (atomic_read(&dentry->d_count) > ino_count) | 372 | if (dentry->d_count > ino_count) |
373 | goto next; | 373 | goto next; |
374 | 374 | ||
375 | if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) { | 375 | if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) { |
@@ -383,7 +383,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
383 | } else { | 383 | } else { |
384 | /* Path walk currently on this dentry? */ | 384 | /* Path walk currently on this dentry? */ |
385 | ino_count = atomic_read(&ino->count) + 1; | 385 | ino_count = atomic_read(&ino->count) + 1; |
386 | if (atomic_read(&dentry->d_count) > ino_count) | 386 | if (dentry->d_count > ino_count) |
387 | goto next; | 387 | goto next; |
388 | 388 | ||
389 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); | 389 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index d34896cfb19f..7922509b5b2b 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -436,7 +436,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry) | |||
436 | spin_lock(&active->d_lock); | 436 | spin_lock(&active->d_lock); |
437 | 437 | ||
438 | /* Already gone? */ | 438 | /* Already gone? */ |
439 | if (atomic_read(&active->d_count) == 0) | 439 | if (active->d_count == 0) |
440 | goto next; | 440 | goto next; |
441 | 441 | ||
442 | qstr = &active->d_name; | 442 | qstr = &active->d_name; |
@@ -452,7 +452,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry) | |||
452 | goto next; | 452 | goto next; |
453 | 453 | ||
454 | if (d_unhashed(active)) { | 454 | if (d_unhashed(active)) { |
455 | dget(active); | 455 | dget_dlock(active); |
456 | spin_unlock(&active->d_lock); | 456 | spin_unlock(&active->d_lock); |
457 | spin_unlock(&sbi->lookup_lock); | 457 | spin_unlock(&sbi->lookup_lock); |
458 | spin_unlock(&dcache_lock); | 458 | spin_unlock(&dcache_lock); |
@@ -507,7 +507,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry) | |||
507 | goto next; | 507 | goto next; |
508 | 508 | ||
509 | if (d_unhashed(expiring)) { | 509 | if (d_unhashed(expiring)) { |
510 | dget(expiring); | 510 | dget_dlock(expiring); |
511 | spin_unlock(&expiring->d_lock); | 511 | spin_unlock(&expiring->d_lock); |
512 | spin_unlock(&sbi->lookup_lock); | 512 | spin_unlock(&sbi->lookup_lock); |
513 | spin_unlock(&dcache_lock); | 513 | spin_unlock(&dcache_lock); |