summaryrefslogtreecommitdiff
path: root/fs/f2fs/shrinker.c
diff options
context:
space:
mode:
authorZhiguo Niu <zhiguo.niu@unisoc.com>2025-02-10 09:24:09 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2025-02-10 17:03:19 +0000
commitbd409934c0619a6c3507891844aeb0c0dca69e18 (patch)
tree0308b0cd7b49ea838ad2c18fe2f06b6830c5060d /fs/f2fs/shrinker.c
parenteb85c2410d6f581e957cd03a644ff6ddbe592af9 (diff)
f2fs: fix to return SHRINK_EMPTY if no objects to free
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>
Diffstat (limited to 'fs/f2fs/shrinker.c')
-rw-r--r--fs/f2fs/shrinker.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index 83d6fb97dcae..fc1bbef418ce 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -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,