Re: [f2fs-dev] [PATCH 01/14] f2fs: extend folio state for large folio write path

From: Nanzhe Zhao

Date: Mon Sep 07 2026 - 23:45:05 EST


On Thu, 27 Aug 2026 13:51:06 -0700, Daeho Jeong wrote:
> ...
>> + ffs = kzalloc(struct_size(ffs, state, BITS_TO_LONGS(2 * nr_subpages)),
>> + GFP_NOIO | __GFP_NOFAIL);

I think I can use f2fs_kmalloc() with __GFP_ZERO here, so that I can
exercise the failure path with FAULT_KMALLOC injection during debugging?

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2616,5 +2616,7 @@
- ffs = kzalloc(struct_size(ffs, state, BITS_TO_LONGS(2 * nr_subpages)),
- GFP_NOIO | __GFP_NOFAIL);
+ ffs = f2fs_kmalloc(F2FS_F_SB(folio),
+ struct_size(ffs, state, BITS_TO_LONGS(2 * nr_subpages)),
+ GFP_NOFS | __GFP_ZERO);
+ if (!ffs)
+ return NULL;

Thanks,
Nanzhe Zhao