Linux Kernels

Btrfs: Properly update right_nritems in push_leaf_left

This change “Btrfs: Properly update right_nritems in push_leaf_left” (commit eef1c49) in Linux kernel is authored by Yan <yanzheng [at] 21cn.com> on Mon Nov 26 10:58:13 2007 -0500.

Description of "Btrfs: Properly update right_nritems in push_leaf_left"

The change “Btrfs: Properly update right_nritems in push_leaf_left” introduces changes as follows.

Btrfs: Properly update right_nritems in push_leaf_left

The codes that fixup the right leaf and the codes that dirty the
extnet buffer use the variable 'right_nritems' ,  both of them expect
'right_nritems' is the number of items in right leaf after the push.

Signed-off-by: Chris Mason <chris.mason@oracle.com>

Linux kernel releases containing commit eef1c49

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "Btrfs: Properly update right_nritems in push_leaf_left"

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/btrfs/ctree.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
 
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 1b47fe71e0b4..3b16051b121b 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1717,11 +1717,10 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
 			      btrfs_item_nr_offset(push_items),
 			     (btrfs_header_nritems(right) - push_items) *
 			     sizeof(struct btrfs_item));
-
 	}
-	btrfs_set_header_nritems(right, right_nritems - push_items);
+	right_nritems -= push_items;
+	btrfs_set_header_nritems(right, right_nritems);
 	push_space = BTRFS_LEAF_DATA_SIZE(root);
-
 	for (i = 0; i < right_nritems; i++) {
 		item = btrfs_item_nr(right, i);
 

The commit for this change in Linux stable tree is eef1c49 (patch).

Last modified: 2020/01/11 06:55