From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, linux-btrfs@vger.kernel.org
Cc: Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH v2] btrfs: report filemap_fdata<write|wait>_range error
Date: Thu, 18 Apr 2024 15:18:49 +0800 [thread overview]
Message-ID: <d3a646ed-ce67-4380-82f9-920fcbec5300@oracle.com> (raw)
In-Reply-To: <041bef79-743b-4726-adee-9c0ddf332e6b@gmx.com>
On 4/18/24 14:30, Qu Wenruo wrote:
>
>
> 在 2024/4/18 15:44, Anand Jain 写道:
>> In the function btrfs_write_marked_extents() and in
>> __btrfs_wait_marked_extents()
>> return the actual error if when filemap_fdata<write|wait>_range() fails.
>>
>> Suggested-by: Josef Bacik <josef@toxicpanda.com>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>
> Looks fine for the patch, although I have a small question.
>
> If we failed to write some metadata extents, we break out, meaning there
> would be dirty metadata still hanging there.
>
> Would it be a problem?
>
I had the exact same question, but what I discovered is that the
error originated here will lead to our handle errors and to readonly
state. So it should be fine. Further, if submit layer write/wait is
failing there is nothing much we can do as of now. However, in the
long run we probably should provide an option to fail-safe.
Thanks, Anand
> Thanks,
> Qu
>> ---
>> v2: add __btrfs_wait_marked_extents() as well.
>>
>> fs/btrfs/transaction.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
>> index 3e3bcc5f64c6..8c3b3cda1390 100644
>> --- a/fs/btrfs/transaction.c
>> +++ b/fs/btrfs/transaction.c
>> @@ -1156,6 +1156,8 @@ int btrfs_write_marked_extents(struct
>> btrfs_fs_info *fs_info,
>> else if (wait_writeback)
>> werr = filemap_fdatawait_range(mapping, start, end);
>> free_extent_state(cached_state);
>> + if (werr)
>> + break;
>> cached_state = NULL;
>> cond_resched();
>> start = end + 1;
>> @@ -1198,6 +1200,8 @@ static int __btrfs_wait_marked_extents(struct
>> btrfs_fs_info *fs_info,
>> if (err)
>> werr = err;
>> free_extent_state(cached_state);
>> + if (werr)
>> + break;
>> cached_state = NULL;
>> cond_resched();
>> start = end + 1;
next prev parent reply other threads:[~2024-04-18 7:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 2:36 [PATCH 1/1] btrfs: report filemap_fdata<write|wait>_range error Anand Jain
2024-04-18 6:14 ` [PATCH v2] " Anand Jain
2024-04-18 6:30 ` Qu Wenruo
2024-04-18 7:18 ` Anand Jain [this message]
2024-04-18 7:22 ` Qu Wenruo
2024-04-18 8:23 ` Qu Wenruo
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=d3a646ed-ce67-4380-82f9-920fcbec5300@oracle.com \
--to=anand.jain@oracle.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.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.