From: Qu Wenruo <wqu@suse.com>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
linux-btrfs@vger.kernel.org
Cc: Filipe Manana <fdmanana@suse.com>,
Naohiro Aota <naohiro.aota@wdc.com>,
Damien Le Moal <dlemoal@kernel.org>
Subject: Re: [PATCH 1/5] btrfs: factor out dirty-clearing part of btrfs_clear_buffer_dirty
Date: Fri, 17 Jul 2026 08:01:40 +0930 [thread overview]
Message-ID: <8c6979b0-8ff9-480c-9027-29986bafa71c@suse.com> (raw)
In-Reply-To: <20260716115656.1319295-2-johannes.thumshirn@wdc.com>
在 2026/7/16 21:26, Johannes Thumshirn 写道:
> Split the dirty-clearing part of btrfs_clear_buffer_dirty() into a helper so
> a later caller can reuse it while bypassing the zoned zero-out deferral.
> No functional change.
I'd prefer fold this patch into the user.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> fs/btrfs/extent_io.c | 47 +++++++++++++++++++++++++-------------------
> 1 file changed, 27 insertions(+), 20 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 647b109ef61b..4dd8fc5ad247 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -3788,6 +3788,32 @@ void free_extent_buffer_stale(struct extent_buffer *eb)
> release_extent_buffer(eb);
> }
>
> +static void __btrfs_clear_buffer_dirty(struct extent_buffer *eb)
Not sure if we still allow double underline function names.
Thanks,
Qu
> +{
> + struct btrfs_fs_info *fs_info = eb->fs_info;
> +
> + if (!test_and_clear_bit(EXTENT_BUFFER_DIRTY, &eb->bflags))
> + return;
> +
> + buffer_tree_clear_mark(eb, PAGECACHE_TAG_DIRTY);
> + percpu_counter_add_batch(&fs_info->dirty_metadata_bytes, -(s64)eb->len,
> + fs_info->dirty_metadata_batch);
> +
> + for (int i = 0; i < num_extent_folios(eb); i++) {
> + struct folio *folio = eb->folios[i];
> + bool last;
> +
> + if (!folio_test_dirty(folio))
> + continue;
> + folio_lock(folio);
> + last = btrfs_meta_folio_clear_and_test_dirty(folio, eb);
> + if (last)
> + btrfs_clear_folio_dirty_tag(folio);
> + folio_unlock(folio);
> + }
> + WARN_ON(refcount_read(&eb->refs) == 0);
> +}
> +
> void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
> struct extent_buffer *eb)
> {
> @@ -3812,26 +3838,7 @@ void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
> return;
> }
>
> - if (!test_and_clear_bit(EXTENT_BUFFER_DIRTY, &eb->bflags))
> - return;
> -
> - buffer_tree_clear_mark(eb, PAGECACHE_TAG_DIRTY);
> - percpu_counter_add_batch(&fs_info->dirty_metadata_bytes, -(s64)eb->len,
> - fs_info->dirty_metadata_batch);
> -
> - for (int i = 0; i < num_extent_folios(eb); i++) {
> - struct folio *folio = eb->folios[i];
> - bool last;
> -
> - if (!folio_test_dirty(folio))
> - continue;
> - folio_lock(folio);
> - last = btrfs_meta_folio_clear_and_test_dirty(folio, eb);
> - if (last)
> - btrfs_clear_folio_dirty_tag(folio);
> - folio_unlock(folio);
> - }
> - WARN_ON(refcount_read(&eb->refs) == 0);
> + __btrfs_clear_buffer_dirty(eb);
> }
>
> void set_extent_buffer_dirty(struct extent_buffer *eb)
next prev parent reply other threads:[~2026-07-16 22:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 11:56 [PATCH 0/5] btrfs: zoned: fix two deadlocks when runing fstests Johannes Thumshirn
2026-07-16 11:56 ` [PATCH 1/5] btrfs: factor out dirty-clearing part of btrfs_clear_buffer_dirty Johannes Thumshirn
2026-07-16 22:31 ` Qu Wenruo [this message]
2026-07-16 11:56 ` [PATCH 2/5] btrfs: zoned: drop stale dirty btree buffers at close_ctree() Johannes Thumshirn
2026-07-16 22:49 ` Qu Wenruo
2026-07-17 6:56 ` Johannes Thumshirn
2026-07-17 14:17 ` Johannes Thumshirn
2026-07-17 22:45 ` Qu Wenruo
2026-07-16 11:56 ` [PATCH 3/5] btrfs: walk waited ordered extents in place Johannes Thumshirn
2026-07-16 11:56 ` [PATCH 4/5] btrfs: walk waited ordered roots " Johannes Thumshirn
2026-07-16 11:56 ` [PATCH 5/5] btrfs: zoned: avoid ordered_operations_mutex when finishing a zone Johannes Thumshirn
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=8c6979b0-8ff9-480c-9027-29986bafa71c@suse.com \
--to=wqu@suse.com \
--cc=dlemoal@kernel.org \
--cc=fdmanana@suse.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=naohiro.aota@wdc.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