aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@kernel.dk>2011-01-07 01:49:46 -0500
committerNick Piggin <npiggin@kernel.dk>2011-01-07 01:50:25 -0500
commitbe182bff72fae6a3eb25624b39170c40b72f0909 (patch)
treeb77ee014d7850c6e57dae7231a38c0c26cd96b38 /fs/dcache.c
parent89e6054836a7b1e7500cd70a14b5579e752c9250 (diff)
fs: reduce dcache_inode_lock width in lru scanning
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 195706374697..fe8f28a2878e 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -621,7 +621,7 @@ static void shrink_dentry_list(struct list_head *list)
621 dentry = list_entry(list->prev, struct dentry, d_lru); 621 dentry = list_entry(list->prev, struct dentry, d_lru);
622 622
623 if (!spin_trylock(&dentry->d_lock)) { 623 if (!spin_trylock(&dentry->d_lock)) {
624relock: 624relock1:
625 spin_unlock(&dcache_lru_lock); 625 spin_unlock(&dcache_lru_lock);
626 cpu_relax(); 626 cpu_relax();
627 spin_lock(&dcache_lru_lock); 627 spin_lock(&dcache_lru_lock);
@@ -638,20 +638,24 @@ relock:
638 spin_unlock(&dentry->d_lock); 638 spin_unlock(&dentry->d_lock);
639 continue; 639 continue;
640 } 640 }
641 if (!spin_trylock(&dcache_inode_lock)) {
642relock2:
643 spin_unlock(&dentry->d_lock);
644 goto relock1;
645 }
641 if (IS_ROOT(dentry)) 646 if (IS_ROOT(dentry))
642 parent = NULL; 647 parent = NULL;
643 else 648 else
644 parent = dentry->d_parent; 649 parent = dentry->d_parent;
645 if (parent && !spin_trylock(&parent->d_lock)) { 650 if (parent && !spin_trylock(&parent->d_lock)) {
646 spin_unlock(&dentry->d_lock); 651 spin_unlock(&dcache_inode_lock);
647 goto relock; 652 goto relock2;
648 } 653 }
649 __dentry_lru_del(dentry); 654 __dentry_lru_del(dentry);
650 spin_unlock(&dcache_lru_lock); 655 spin_unlock(&dcache_lru_lock);
651 656
652 prune_one_dentry(dentry, parent); 657 prune_one_dentry(dentry, parent);
653 /* dcache_inode_lock and dentry->d_lock dropped */ 658 /* dcache_inode_lock and dentry->d_lock dropped */
654 spin_lock(&dcache_inode_lock);
655 spin_lock(&dcache_lru_lock); 659 spin_lock(&dcache_lru_lock);
656 } 660 }
657} 661}
@@ -672,7 +676,6 @@ static void __shrink_dcache_sb(struct super_block *sb, int *count, int flags)
672 LIST_HEAD(tmp); 676 LIST_HEAD(tmp);
673 int cnt = *count; 677 int cnt = *count;
674 678
675 spin_lock(&dcache_inode_lock);
676relock: 679relock:
677 spin_lock(&dcache_lru_lock); 680 spin_lock(&dcache_lru_lock);
678 while (!list_empty(&sb->s_dentry_lru)) { 681 while (!list_empty(&sb->s_dentry_lru)) {
@@ -711,7 +714,6 @@ relock:
711 if (!list_empty(&referenced)) 714 if (!list_empty(&referenced))
712 list_splice(&referenced, &sb->s_dentry_lru); 715 list_splice(&referenced, &sb->s_dentry_lru);
713 spin_unlock(&dcache_lru_lock); 716 spin_unlock(&dcache_lru_lock);
714 spin_unlock(&dcache_inode_lock);
715} 717}
716 718
717/** 719/**
@@ -800,14 +802,12 @@ void shrink_dcache_sb(struct super_block *sb)
800{ 802{
801 LIST_HEAD(tmp); 803 LIST_HEAD(tmp);
802 804
803 spin_lock(&dcache_inode_lock);
804 spin_lock(&dcache_lru_lock); 805 spin_lock(&dcache_lru_lock);
805 while (!list_empty(&sb->s_dentry_lru)) { 806 while (!list_empty(&sb->s_dentry_lru)) {
806 list_splice_init(&sb->s_dentry_lru, &tmp); 807 list_splice_init(&sb->s_dentry_lru, &tmp);
807 shrink_dentry_list(&tmp); 808 shrink_dentry_list(&tmp);
808 } 809 }
809 spin_unlock(&dcache_lru_lock); 810 spin_unlock(&dcache_lru_lock);
810 spin_unlock(&dcache_inode_lock);
811} 811}
812EXPORT_SYMBOL(shrink_dcache_sb); 812EXPORT_SYMBOL(shrink_dcache_sb);
813 813