Re: [f2fs-dev] [PATCH v3] f2fs: change the current atomic write way

From: Tudor Ambarus
Date: Fri Mar 31 2023 - 10:23:02 EST


Hi!

On 4/28/22 19:18, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> Current atomic write has three major issues like below.
> - keeps the updates in non-reclaimable memory space and they are even
> hard to be migrated, which is not good for contiguous memory
> allocation.
> - disk spaces used for atomic files cannot be garbage collected, so
> this makes it difficult for the filesystem to be defragmented.
> - If atomic write operations hit the threshold of either memory usage
> or garbage collection failure count, All the atomic write operations
> will fail immediately.
>
> To resolve the issues, I will keep a COW inode internally for all the
> updates to be flushed from memory, when we need to flush them out in a
> situation like high memory pressure. These COW inodes will be tagged
> as orphan inodes to be reclaimed in case of sudden power-cut or system
> failure during atomic writes.
>
> Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
> ---
> v2: removed inmem tracepoints. changed page flush timing. fixed hole
> handling.
> v3: removed unused atomic related page flag.
> ---
> fs/f2fs/data.c | 180 +++++++++++------
> fs/f2fs/debug.c | 12 +-
> fs/f2fs/f2fs.h | 33 +---
> fs/f2fs/file.c | 48 ++---
> fs/f2fs/gc.c | 27 +--
> fs/f2fs/inode.c | 3 +-
> fs/f2fs/namei.c | 28 ++-
> fs/f2fs/node.c | 4 -
> fs/f2fs/node.h | 1 -
> fs/f2fs/segment.c | 380 ++++++++++++------------------------
> fs/f2fs/segment.h | 4 +-
> fs/f2fs/super.c | 6 +-
> include/trace/events/f2fs.h | 22 ---
> 13 files changed, 302 insertions(+), 446 deletions(-)

This patch fixes the bug reported at:
LINK:
https://syzkaller.appspot.com/bug?id=50ac8d898487cade14315bf673e8d74fd4716ecf

One may find the strace log at:
LINK: https://syzkaller.appspot.com/text?tag=CrashLog&x=11f5de2ac80000
and the C reproducer at:
LINK: https://syzkaller.appspot.com/text?tag=ReproC&x=111facdcc80000

The patch does not apply cleanly on stable/linux-5.15.y. Backporting the
patch is a bit risky for me as I'm not familiar with f2fs. I'm seeking
for some guidance. Is there a plan to backport this patch to Linux
stable? If not, shall I try to backport it? Would you advise me to try
to find all the prerequisite patches for this patch to apply cleanly on
stable/linux-5.15.y, or just to fix the conflicts?

Thanks,
ta