aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 509b49410943..77d466b13fef 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -913,11 +913,12 @@ static void shrink_dentry_list(struct list_head *list)
913 * This function may fail to free any resources if all the dentries are in 913 * This function may fail to free any resources if all the dentries are in
914 * use. 914 * use.
915 */ 915 */
916void prune_dcache_sb(struct super_block *sb, int count) 916long prune_dcache_sb(struct super_block *sb, unsigned long nr_to_scan)
917{ 917{
918 struct dentry *dentry; 918 struct dentry *dentry;
919 LIST_HEAD(referenced); 919 LIST_HEAD(referenced);
920 LIST_HEAD(tmp); 920 LIST_HEAD(tmp);
921 long freed = 0;
921 922
922relock: 923relock:
923 spin_lock(&sb->s_dentry_lru_lock); 924 spin_lock(&sb->s_dentry_lru_lock);
@@ -942,7 +943,8 @@ relock:
942 this_cpu_dec(nr_dentry_unused); 943 this_cpu_dec(nr_dentry_unused);
943 sb->s_nr_dentry_unused--; 944 sb->s_nr_dentry_unused--;
944 spin_unlock(&dentry->d_lock); 945 spin_unlock(&dentry->d_lock);
945 if (!--count) 946 freed++;
947 if (!--nr_to_scan)
946 break; 948 break;
947 } 949 }
948 cond_resched_lock(&sb->s_dentry_lru_lock); 950 cond_resched_lock(&sb->s_dentry_lru_lock);
@@ -952,6 +954,7 @@ relock:
952 spin_unlock(&sb->s_dentry_lru_lock); 954 spin_unlock(&sb->s_dentry_lru_lock);
953 955
954 shrink_dentry_list(&tmp); 956 shrink_dentry_list(&tmp);
957 return freed;
955} 958}
956 959
957/* 960/*