Re: [f2fs-dev] [PATCH v3 09/12] f2fs: cache: use compress cache
From: Daeho Jeong
Date: Fri Aug 28 2026 - 14:23:00 EST
On Fri, Aug 28, 2026 at 5:25 AM Chao Yu <chao@xxxxxxxxxx> wrote:
>
> On 8/28/26 20:00, Chao Yu wrote:
> > On 8/27/26 04:04, Daeho Jeong wrote:
> >> On Tue, Aug 25, 2026 at 6:03 AM Chao Yu via Linux-f2fs-devel
> >>> + f2fs_lock_cache(entry);
> >>>
> >>> - if (ino != folio_get_f2fs_data(folio)) {
> >>> - folio_unlock(folio);
> >>> - continue;
> >>> - }
> >>> -
> >>> - generic_error_remove_folio(mapping, folio);
> >>> - folio_unlock(folio);
> >>> + if (!f2fs_is_compress_cache(entry)) {
> >>
> >> How is this possible?
> >> or if (!entry->cache)?
> >
> > I suffer a panic from f2fs_bug_on(sbi, !f2fs_is_compress_cache(entry)) here,
> > it may suffer race condition w/ shrinker.
>
> I changed like this, because:
> 1. we will never update entry->ino after initialization, so it's safe to
> check w/o lock.
> 2. f2fs_truncate_cache() has checked entry->cache by itself, so it doesn't
> need to check w/ f2fs_is_compress_cache() outside __f2fs_truncate_cache().
>
> for (i = 0; i < nr; i++) {
> struct f2fs_cached_block *entry = entries[i];
>
> index = entry->index + 1;
>
> if (entry->ino != ino)
> continue;
>
> f2fs_truncate_cache(entry, false);
> }
>
> Let me know if you have any concern about this.
Hi Chao,
This looks much cleaner and straightforward.
I have no further concerns on this part.
Thanks,
>
> Thanks,
>