From: Sun YangKai <sunk67188@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Sun YangKai <sunk67188@gmail.com>
Subject: [PATCH 1/2] btrfs: add comment for btrfs_clear_buffer_dirty
Date: Thu, 20 Nov 2025 21:57:04 +0800 [thread overview]
Message-ID: <20251120140030.2770-4-sunk67188@gmail.com> (raw)
In-Reply-To: <20251120140030.2770-2-sunk67188@gmail.com>
Signed-off-by: Sun YangKai <sunk67188@gmail.com>
---
fs/btrfs/extent_io.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 23273d0e6f22..e80066fc0f02 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3678,6 +3678,26 @@ static void btree_clear_folio_dirty_tag(struct folio *folio)
xa_unlock_irq(&folio->mapping->i_pages);
}
+/*
+ * btrfs_clear_buffer_dirty - Clear the dirty state of an extent buffer
+ * @trans: Transaction handle, may be NULL.
+ * If provided, the buffer must belong to the transaction
+ * (checked via btrfs_header_generation). If the check failed,
+ * the function returns immediately.
+ * @eb: The extent buffer to clean.
+ *
+ * This function clears the dirty flag from @eb and updates all accounting
+ * that depends on it (per-CPU counter of dirty metadata bytes, folio dirty
+ * state, address-space tags).
+ *
+ * Special behaviour in zoned mode:
+ * When the filesystem is zoned (btrfs_is_zoned) the buffer is *not*
+ * immediately cleaned. Instead the EXTENT_BUFFER_ZONED_ZEROOUT flag is
+ * set and the buffer remains conceptually dirty. The physical zero-out
+ * required by zoned devices is deferred until btree_csum_one_bio(), which
+ * preserves write-ordering constraints without forcing callers to re-dirty
+ * the buffer later.
+ */
void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
struct extent_buffer *eb)
{
--
2.51.2
next prev parent reply other threads:[~2025-11-20 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 13:57 [PATCH 0/2] btrfs: drop premature generation setting in btrfs_init_new_buffer() Sun YangKai
2025-11-20 13:57 ` Sun YangKai [this message]
2025-11-20 13:57 ` [PATCH 2/2] " Sun YangKai
2025-11-20 18:57 ` [PATCH 0/2] " Boris Burkov
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=20251120140030.2770-4-sunk67188@gmail.com \
--to=sunk67188@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/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