From: Qu Wenruo <wqu@suse.com>
To: Filipe Manana <fdmanana@kernel.org>, Sun YangKai <sunk67188@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: reorganize error handling in btrfs_tree_mod_log_insert_key
Date: Mon, 29 Sep 2025 18:13:30 +0930 [thread overview]
Message-ID: <90a2a601-8ea8-46f0-94f6-36db13f69c01@suse.com> (raw)
In-Reply-To: <CAL3q7H5aYJPeUtBJtmsA_TSSqR8BTaHifbabBCjn_jWS5An8og@mail.gmail.com>
在 2025/9/29 18:02, Filipe Manana 写道:
> On Mon, Sep 29, 2025 at 9:29 AM Sun YangKai <sunk67188@gmail.com> wrote:
>>
>>>> - ret = tree_mod_log_insert(eb->fs_info, tm);
>>>> -out_unlock:
>>>> + /* Deal with allocation error. */
>>>> + if (tm)
>>>> + ret = tree_mod_log_insert(eb->fs_info, tm);
>>>
>>> Sorry, I don't think this is really that better.
>>>
>>> In fact I'm wondering why we don't delay the allocation after
>>> tree_mod_dont_log()?
>>
>> That's what I want to do at first. However, after looking further into
>> tree_mod_dont_log(), I found that it trys to get the tree_mod_log_lock. I'm
>> not sure if it's better or worse to do the allocation things after getting the
>> lock.
>
> You can't do a GFP_NOFS allocation after acquiring a rw lock... The
> only allocation that can be done is a GFP_ATOMIC in that context, and
> we want to avoid them.
You're both right. Forgot it's a rwlock.
There is no better solution, I guess it's the best solution for now.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
>
>>
>>>
>>> That would be way more straightforward.
>>>
>>> Thanks,
>>> Qu
>>>
>>>> + else
>>>> + ret = -ENOMEM;
>>>> +
>>>>
>>
>> Thanks,
>> Sun YangKai
>>
>>
>>
>>
>>
next prev parent reply other threads:[~2025-09-29 8:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 6:56 [PATCH] btrfs: reorganize error handling in btrfs_tree_mod_log_insert_key Sun YangKai
2025-09-29 7:54 ` Qu Wenruo
2025-09-29 8:25 ` Sun YangKai
2025-09-29 8:32 ` Filipe Manana
2025-09-29 8:43 ` Qu Wenruo [this message]
2025-09-29 8:30 ` Filipe Manana
2025-09-29 10:24 ` Sun YangKai
2025-09-29 10:41 ` Filipe Manana
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=90a2a601-8ea8-46f0-94f6-36db13f69c01@suse.com \
--to=wqu@suse.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=sunk67188@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox