]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/dcache.c
shrinker: convert superblock shrinkers to new API
[karo-tx-linux.git] / fs / dcache.c
index bdd34e1311dcdbe8a4f860739291f510b0822333..66f8a83fc899ef4ae850fdf6aa4f31a325001b9f 100644 (file)
@@ -868,11 +868,12 @@ static void shrink_dentry_list(struct list_head *list)
  * This function may fail to free any resources if all the dentries are in
  * use.
  */
-void prune_dcache_sb(struct super_block *sb, int count)
+long prune_dcache_sb(struct super_block *sb, unsigned long nr_to_scan)
 {
        struct dentry *dentry;
        LIST_HEAD(referenced);
        LIST_HEAD(tmp);
+       long freed = 0;
 
 relock:
        spin_lock(&sb->s_dentry_lru_lock);
@@ -897,7 +898,8 @@ relock:
                        this_cpu_dec(nr_dentry_unused);
                        sb->s_nr_dentry_unused--;
                        spin_unlock(&dentry->d_lock);
-                       if (!--count)
+                       freed++;
+                       if (!--nr_to_scan)
                                break;
                }
                cond_resched_lock(&sb->s_dentry_lru_lock);
@@ -907,6 +909,7 @@ relock:
        spin_unlock(&sb->s_dentry_lru_lock);
 
        shrink_dentry_list(&tmp);
+       return freed;
 }
 
 /*
@@ -1294,9 +1297,8 @@ rename_retry:
 void shrink_dcache_parent(struct dentry * parent)
 {
        LIST_HEAD(dispose);
-       int found;
 
-       while ((found = select_parent(parent, &dispose)) != 0) {
+       while (select_parent(parent, &dispose)) {
                shrink_dentry_list(&dispose);
                cond_resched();
        }