Skip to content

Commit ac0ecda

Browse files
SaltyKitkatkdave
authored andcommitted
btrfs: remove redundant level reset in btrfs_del_items()
When btrfs_del_items() empties a leaf, it deletes the leaf unless it's the root node. For the root leaf case, the code used to reset its level to 0 via btrfs_set_header_level(). This is redundant as leaf nodes always have level == 0. Remove the unnecessary level assignment and invert the conditional to handle only the non-root leaf deletion. The root leaf is correctly left as-is. No functional change. Signed-off-by: Sun YangKai <sunk67188@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent bae7d4c commit ac0ecda

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/btrfs/ctree.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4520,9 +4520,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
45204520

45214521
/* delete the leaf if we've emptied it */
45224522
if (nritems == 0) {
4523-
if (leaf == root->node) {
4524-
btrfs_set_header_level(leaf, 0);
4525-
} else {
4523+
if (leaf != root->node) {
45264524
btrfs_clear_buffer_dirty(trans, leaf);
45274525
ret = btrfs_del_leaf(trans, root, path, leaf);
45284526
if (ret < 0)

0 commit comments

Comments
 (0)