|
@@ -77,8 +77,8 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
|
|
|
if (sb->s_op->nr_cached_objects)
|
|
|
fs_objects = sb->s_op->nr_cached_objects(sb, sc->nid);
|
|
|
|
|
|
- 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,20 +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);
|
|
|
+ if (fs_objects)
|
|
|
freed += sb->s_op->free_cached_objects(sb, fs_objects,
|
|
|
sc->nid);
|
|
|
- }
|
|
|
|
|
|
drop_super(sb);
|
|
|
return freed;
|
|
@@ -118,17 +118,15 @@ 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 += 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;
|