From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Yongpeng Yang <monty_pavel@sina.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Yongpeng Yang <yangyongpeng@xiaomi.com>,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v4 1/4] f2fs: refactor f2fs_move_node_folio function
Date: Wed, 18 Mar 2026 12:15:54 +0800 [thread overview]
Message-ID: <b8bef1a9-b930-4a73-ae71-73323137c50e@kernel.org> (raw)
In-Reply-To: <20260317115459.208306-2-monty_pavel@sina.com>
On 2026/3/17 19:54, Yongpeng Yang wrote:
> From: Yongpeng Yang <yangyongpeng@xiaomi.com>
>
> This patch refactor the f2fs_move_node_folio() function. No logical
> changes.
>
> Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
> ---
> fs/f2fs/f2fs.h | 2 ++
> fs/f2fs/node.c | 54 ++++++++++++++++++++++++++++++--------------------
> 2 files changed, 34 insertions(+), 22 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 660bf88a376f..afb4d10142dd 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -3950,6 +3950,8 @@ int f2fs_sanity_check_node_footer(struct f2fs_sb_info *sbi,
> enum node_type ntype, bool in_irq);
> struct folio *f2fs_get_inode_folio(struct f2fs_sb_info *sbi, pgoff_t ino);
> struct folio *f2fs_get_xnode_folio(struct f2fs_sb_info *sbi, pgoff_t xnid);
> +int f2fs_write_single_node_folio(struct folio *node_folio, int sync_mode,
> + bool mark_dirty, enum iostat_type io_type);
> int f2fs_move_node_folio(struct folio *node_folio, int gc_type);
> void f2fs_flush_inline_data(struct f2fs_sb_info *sbi);
> int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 17eab01ae8f9..2e74d2882b6f 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1845,41 +1845,51 @@ static bool __write_node_folio(struct folio *folio, bool atomic, bool *submitted
> return false;
> }
>
> -int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
> +int f2fs_write_single_node_folio(struct folio *node_folio, int sync_mode,
> + bool mark_dirty, enum iostat_type io_type)
> {
> int err = 0;
> + struct writeback_control wbc = {
> + .sync_mode = WB_SYNC_ALL,
> + .nr_to_write = 1,
> + };
>
> - if (gc_type == FG_GC) {
> - struct writeback_control wbc = {
> - .sync_mode = WB_SYNC_ALL,
> - .nr_to_write = 1,
> - };
> + if (!sync_mode) {
> + /* set page dirty and write it */
> + if (mark_dirty && !folio_test_writeback(node_folio))
If mark_dirty in this check condition is always true, we can removed it?
Thanks,
> + folio_mark_dirty(node_folio);
> + goto out_folio;
> + }
>
> - f2fs_folio_wait_writeback(node_folio, NODE, true, true);
> + f2fs_folio_wait_writeback(node_folio, NODE, true, true);
>
> + if (mark_dirty)
> folio_mark_dirty(node_folio);
> + else if (!folio_test_dirty(node_folio))
> + goto out_folio;
>
> - if (!folio_clear_dirty_for_io(node_folio)) {
> - err = -EAGAIN;
> - goto out_page;
> - }
> -
> - if (!__write_node_folio(node_folio, false, NULL,
> - &wbc, false, FS_GC_NODE_IO, NULL))
> - err = -EAGAIN;
> - goto release_page;
> - } else {
> - /* set page dirty and write it */
> - if (!folio_test_writeback(node_folio))
> - folio_mark_dirty(node_folio);
> + if (!folio_clear_dirty_for_io(node_folio)) {
> + err = -EAGAIN;
> + goto out_folio;
> }
> -out_page:
> +
> + if (!__write_node_folio(node_folio, false, NULL,
> + &wbc, false, FS_GC_NODE_IO, NULL))
> + err = -EAGAIN;
> + goto release_folio;
> +out_folio:
> folio_unlock(node_folio);
> -release_page:
> +release_folio:
> f2fs_folio_put(node_folio, false);
> return err;
> }
>
> +int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
> +{
> + return f2fs_write_single_node_folio(node_folio, gc_type == FG_GC,
> + true, FS_GC_NODE_IO);
> +}
> +
> int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
> struct writeback_control *wbc, bool atomic,
> unsigned int *seq_id)
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-03-18 4:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 11:54 [f2fs-dev] [PATCH v4 1/4] f2fs: refactor f2fs_move_node_folio function Yongpeng Yang
2026-03-17 11:54 ` [f2fs-dev] [PATCH v4 2/4] f2fs: refactor node footer flag setting related code Yongpeng Yang
2026-03-18 4:17 ` Chao Yu via Linux-f2fs-devel
2026-03-17 11:55 ` [f2fs-dev] [PATCH v4 3/4] f2fs: fix fsck inconsistency caused by FGGC of node block Yongpeng Yang
2026-03-18 4:26 ` Chao Yu via Linux-f2fs-devel
2026-03-17 11:56 ` [f2fs-dev] [PATCH v4 4/4] f2fs: fix inline data not being written to disk in writeback path Yongpeng Yang
2026-03-18 4:35 ` Chao Yu via Linux-f2fs-devel
2026-03-18 8:05 ` Yongpeng Yang
2026-03-18 4:15 ` Chao Yu via Linux-f2fs-devel [this message]
2026-03-18 8:03 ` [f2fs-dev] [PATCH v4 1/4] f2fs: refactor f2fs_move_node_folio function Yongpeng Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8bef1a9-b930-4a73-ae71-73323137c50e@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=monty_pavel@sina.com \
--cc=yangyongpeng@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox