Skip to content

Commit

Permalink
f2fs: fix to return SHRINK_EMPTY if no objects to free
Browse files Browse the repository at this point in the history
Quoted from include/linux/shrinker.h
"count_objects should return the number of freeable items in the cache. If
 there are no objects to free, it should return SHRINK_EMPTY, while 0 is
 returned in cases of the number of freeable items cannot be determined
 or shrinker should skip this cache for this time (e.g., their number
 is below shrinkable limit)."

Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Zhiguo Niu authored and Jaegeuk Kim committed Feb 10, 2025
1 parent eb85c24 commit bd40993
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/f2fs/shrinker.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ unsigned long f2fs_shrink_count(struct shrinker *shrink,
mutex_unlock(&sbi->umount_mutex);
}
spin_unlock(&f2fs_list_lock);
return count;
return count ?: SHRINK_EMPTY;
}

unsigned long f2fs_shrink_scan(struct shrinker *shrink,
Expand Down

0 comments on commit bd40993

Please sign in to comment.