From: Qu Wenruo <wqu@suse.com>
To: Tavian Barnes <tavianator@tavianator.com>, linux-btrfs@vger.kernel.org
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs: New helper to clear EXTENT_BUFFER_READING
Date: Tue, 19 Mar 2024 06:30:41 +1030 [thread overview]
Message-ID: <ea4ebb71-df6d-40e1-9e37-a0131b23d63d@suse.com> (raw)
In-Reply-To: <477327c2e21e253b56261f504a91603419bb167a.1710769876.git.tavianator@tavianator.com>
在 2024/3/19 00:26, Tavian Barnes 写道:
> We are clearing the bit and waking up any waiters in two different
> places. Factor that code out into a static helper function.
>
> Signed-off-by: Tavian Barnes <tavianator@tavianator.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/extent_io.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 61594eaf1f89..46173dcfde4f 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -4270,6 +4270,13 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)
> }
> }
>
> +static void clear_extent_buffer_reading(struct extent_buffer *eb)
> +{
> + clear_bit(EXTENT_BUFFER_READING, &eb->bflags);
> + smp_mb__after_atomic();
> + wake_up_bit(&eb->bflags, EXTENT_BUFFER_READING);
> +}
> +
> static void end_bbio_meta_read(struct btrfs_bio *bbio)
> {
> struct extent_buffer *eb = bbio->private;
> @@ -4304,9 +4311,7 @@ static void end_bbio_meta_read(struct btrfs_bio *bbio)
> bio_offset += len;
> }
>
> - clear_bit(EXTENT_BUFFER_READING, &eb->bflags);
> - smp_mb__after_atomic();
> - wake_up_bit(&eb->bflags, EXTENT_BUFFER_READING);
> + clear_extent_buffer_reading(eb);
> free_extent_buffer(eb);
>
> bio_put(&bbio->bio);
> @@ -4340,9 +4345,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
> * will now be set, and we shouldn't read it in again.
> */
> if (unlikely(test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))) {
> - clear_bit(EXTENT_BUFFER_READING, &eb->bflags);
> - smp_mb__after_atomic();
> - wake_up_bit(&eb->bflags, EXTENT_BUFFER_READING);
> + clear_extent_buffer_reading(eb);
> return 0;
> }
>
next prev parent reply other threads:[~2024-03-18 20:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 13:56 [PATCH 0/2] extent_buffer read cleanups Tavian Barnes
2024-03-18 13:56 ` [PATCH 1/2] btrfs: New helper to clear EXTENT_BUFFER_READING Tavian Barnes
2024-03-18 20:00 ` Qu Wenruo [this message]
2024-03-18 13:56 ` [PATCH 2/2] btrfs: WARN if EXTENT_BUFFER_UPTODATE is set while reading Tavian Barnes
2024-03-18 20:02 ` Qu Wenruo
2024-03-22 19:22 ` [PATCH 0/2] extent_buffer read cleanups David Sterba
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=ea4ebb71-df6d-40e1-9e37-a0131b23d63d@suse.com \
--to=wqu@suse.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tavianator@tavianator.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
Powered by JetHome