]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/super.c
fs: consolidate {nr,free}_cached_objects args in shrink_control
[karo-tx-linux.git] / fs / super.c
index eae088f6aaaeb6e8a3380adad19fb66feebe9905..a2b735a42e74d7eb5aaa88b854714590ff636629 100644 (file)
@@ -75,10 +75,10 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
                return SHRINK_STOP;
 
        if (sb->s_op->nr_cached_objects)
-               fs_objects = sb->s_op->nr_cached_objects(sb, sc->nid);
+               fs_objects = sb->s_op->nr_cached_objects(sb, sc);
 
-       inodes = list_lru_count_node(&sb->s_inode_lru, sc->nid);
-       dentries = list_lru_count_node(&sb->s_dentry_lru, sc->nid);
+       inodes = list_lru_shrink_count(&sb->s_inode_lru, sc);
+       dentries = list_lru_shrink_count(&sb->s_dentry_lru, sc);
        total_objects = dentries + inodes + fs_objects + 1;
        if (!total_objects)
                total_objects = 1;
@@ -86,19 +86,20 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
        /* proportion the scan between the caches */
        dentries = mult_frac(sc->nr_to_scan, dentries, total_objects);
        inodes = mult_frac(sc->nr_to_scan, inodes, total_objects);
+       fs_objects = mult_frac(sc->nr_to_scan, fs_objects, total_objects);
 
        /*
         * prune the dcache first as the icache is pinned by it, then
         * prune the icache, followed by the filesystem specific caches
         */
-       freed = prune_dcache_sb(sb, dentries, sc->nid);
-       freed += prune_icache_sb(sb, inodes, sc->nid);
+       sc->nr_to_scan = dentries;
+       freed = prune_dcache_sb(sb, sc);
+       sc->nr_to_scan = inodes;
+       freed += prune_icache_sb(sb, sc);
 
        if (fs_objects) {
-               fs_objects = mult_frac(sc->nr_to_scan, fs_objects,
-                                                               total_objects);
-               freed += sb->s_op->free_cached_objects(sb, fs_objects,
-                                                      sc->nid);
+               sc->nr_to_scan = fs_objects;
+               freed += sb->s_op->free_cached_objects(sb, sc);
        }
 
        drop_super(sb);
@@ -118,17 +119,14 @@ static unsigned long super_cache_count(struct shrinker *shrink,
         * scalability bottleneck. The counts could get updated
         * between super_cache_count and super_cache_scan anyway.
         * Call to super_cache_count with shrinker_rwsem held
-        * ensures the safety of call to list_lru_count_node() and
+        * ensures the safety of call to list_lru_shrink_count() and
         * s_op->nr_cached_objects().
         */
        if (sb->s_op && sb->s_op->nr_cached_objects)
-               total_objects = sb->s_op->nr_cached_objects(sb,
-                                                sc->nid);
+               total_objects = sb->s_op->nr_cached_objects(sb, sc);
 
-       total_objects += list_lru_count_node(&sb->s_dentry_lru,
-                                                sc->nid);
-       total_objects += list_lru_count_node(&sb->s_inode_lru,
-                                                sc->nid);
+       total_objects += list_lru_shrink_count(&sb->s_dentry_lru, sc);
+       total_objects += list_lru_shrink_count(&sb->s_inode_lru, sc);
 
        total_objects = vfs_pressure_ratio(total_objects);
        return total_objects;