Re: [PATCH v2 03/12] f2fs: cache: introduce shrinker

From: Chao Yu

Date: Tue Aug 25 2026 - 02:37:26 EST


On 8/25/26 13:42, Wenjie Qi wrote:
Hi Chao,

spin_lock(&cache->list_lock);
list_for_each_entry_safe(entry, next, &cache->lru_list, list) {
if (isolated >= nr_to_scan)
break;

if (f2fs_cache_test_dirty(entry) ||
f2fs_cache_test_writeback(entry) ||
f2fs_cache_test_locked(entry))
continue;

if (f2fs_cache_refcount(entry) != 1)
continue;

list_move_tail(&entry->list, &dispose_list);
isolated++;
}

`isolated` advances only for an eligible entry. Entries skipped by the state
and refcount checks do not consume the `nr_to_scan` budget.

Is `nr_to_scan` intended to bound the number of entries examined here, or only
the number of reclaimable entries isolated?

Yes, better to consume nr_to_scan no matter what state of entry is.

Thanks,