From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: "mason.zhang" <masonzhang.linuxer@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: add error checking in do_write_page()
Date: Fri, 25 Jul 2025 10:35:11 +0800 [thread overview]
Message-ID: <68c1c92b-5c29-49b9-a8af-916e5293c80e@kernel.org> (raw)
In-Reply-To: <20250724155945.206801-1-masonzhang.linuxer@gmail.com>
On 7/24/2025 11:59 PM, mason.zhang wrote:
> Otherwise, the filesystem may unaware of potential file corruption.
>
> Signed-off-by: mason.zhang <masonzhang.linuxer@gmail.com>
> ---
> fs/f2fs/segment.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index ae1223ef648f..ce80ba226aed 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3936,12 +3936,15 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
> int seg_type = log_type_to_seg_type(type);
> bool keep_order = (f2fs_lfs_mode(fio->sbi) &&
> seg_type == CURSEG_COLD_DATA);
> + int err;
>
> if (keep_order)
> f2fs_down_read(&fio->sbi->io_order_lock);
>
> - if (f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
> - &fio->new_blkaddr, sum, type, fio)) {
> + err = f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
> + &fio->new_blkaddr, sum, type, fio);
> + if (unlikely(err)) {
> + f2fs_err(fio->sbi, "Failed to allocate data block(%d)", err);
How about using f2fs_err_ratelimited() to avoid too many logs?
Can you please dump more informations about inode, page, blkaddr...?
Thanks,
> if (fscrypt_inode_uses_fs_layer_crypto(folio->mapping->host))
> fscrypt_finalize_bounce_page(&fio->encrypted_page);
> folio_end_writeback(folio);
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: "mason.zhang" <masonzhang.linuxer@gmail.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: add error checking in do_write_page()
Date: Fri, 25 Jul 2025 10:35:11 +0800 [thread overview]
Message-ID: <68c1c92b-5c29-49b9-a8af-916e5293c80e@kernel.org> (raw)
In-Reply-To: <20250724155945.206801-1-masonzhang.linuxer@gmail.com>
On 7/24/2025 11:59 PM, mason.zhang wrote:
> Otherwise, the filesystem may unaware of potential file corruption.
>
> Signed-off-by: mason.zhang <masonzhang.linuxer@gmail.com>
> ---
> fs/f2fs/segment.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index ae1223ef648f..ce80ba226aed 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3936,12 +3936,15 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
> int seg_type = log_type_to_seg_type(type);
> bool keep_order = (f2fs_lfs_mode(fio->sbi) &&
> seg_type == CURSEG_COLD_DATA);
> + int err;
>
> if (keep_order)
> f2fs_down_read(&fio->sbi->io_order_lock);
>
> - if (f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
> - &fio->new_blkaddr, sum, type, fio)) {
> + err = f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
> + &fio->new_blkaddr, sum, type, fio);
> + if (unlikely(err)) {
> + f2fs_err(fio->sbi, "Failed to allocate data block(%d)", err);
How about using f2fs_err_ratelimited() to avoid too many logs?
Can you please dump more informations about inode, page, blkaddr...?
Thanks,
> if (fscrypt_inode_uses_fs_layer_crypto(folio->mapping->host))
> fscrypt_finalize_bounce_page(&fio->encrypted_page);
> folio_end_writeback(folio);
next prev parent reply other threads:[~2025-07-25 2:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 15:59 [f2fs-dev] [PATCH] f2fs: add error checking in do_write_page() mason.zhang
2025-07-24 15:59 ` mason.zhang
2025-07-25 2:35 ` Chao Yu via Linux-f2fs-devel [this message]
2025-07-25 2:35 ` Chao Yu
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=68c1c92b-5c29-49b9-a8af-916e5293c80e@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masonzhang.linuxer@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.