From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 4/8] btrfs: always use left leaf variable in __push_leaf_right()
Date: Thu, 13 Nov 2025 16:56:35 +0000 [thread overview]
Message-ID: <5e46cd4c1e62517bb788d9bdabb75aa91cf6960f.1763052647.git.fdmanana@suse.com> (raw)
In-Reply-To: <cover.1763052647.git.fdmanana@suse.com>
From: Filipe Manana <fdmanana@suse.com>
The 'left' variable points to path->nodes[0] and path->nodes[0] is never
changed, but some places use 'left' while others refer to path->nodes[0].
Update all sites to use 'left' as not only it's shorter it's also easier
to reason since it means the left leaf and avoids any confusion with the
sibling right leaf.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
fs/btrfs/ctree.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index b5cf1b6f5adc..dada50d86731 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3214,10 +3214,10 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
/* then fixup the leaf pointer in the path */
if (path->slots[0] >= left_nritems) {
path->slots[0] -= left_nritems;
- if (btrfs_header_nritems(path->nodes[0]) == 0)
- btrfs_clear_buffer_dirty(trans, path->nodes[0]);
- btrfs_tree_unlock(path->nodes[0]);
- free_extent_buffer(path->nodes[0]);
+ if (btrfs_header_nritems(left) == 0)
+ btrfs_clear_buffer_dirty(trans, left);
+ btrfs_tree_unlock(left);
+ free_extent_buffer(left);
path->nodes[0] = right;
path->slots[1] += 1;
} else {
--
2.47.2
next prev parent reply other threads:[~2025-11-13 16:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 16:56 [PATCH 0/8] btrfs: a bug fix and some cleanups in ctree.c fdmanana
2025-11-13 16:56 ` [PATCH 1/8] btrfs: fix leaf leak in an error path in btrfs_del_items() fdmanana
2025-11-13 16:56 ` [PATCH 2/8] btrfs: remove pointless return value update " fdmanana
2025-11-13 16:56 ` [PATCH 3/8] btrfs: add unlikely to critical error in btrfs_extend_item() fdmanana
2025-11-13 16:56 ` fdmanana [this message]
2025-11-13 16:56 ` [PATCH 5/8] btrfs: remove duplicated leaf dirty status clearing in __push_leaf_right() fdmanana
2025-11-13 16:56 ` [PATCH 6/8] btrfs: always use right leaf variable in __push_leaf_left() fdmanana
2025-11-13 16:56 ` [PATCH 7/8] btrfs: abort transaction on item count overflow " fdmanana
2025-11-13 16:56 ` [PATCH 8/8] btrfs: update check_skip variable after unlocking current node fdmanana
2025-11-13 21:56 ` [PATCH 0/8] btrfs: a bug fix and some cleanups in ctree.c 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=5e46cd4c1e62517bb788d9bdabb75aa91cf6960f.1763052647.git.fdmanana@suse.com \
--to=fdmanana@kernel.org \
--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