Btrfs: Properly update right_nritems in push_leaf_left
authorYan <yanzheng@21cn.com>
Mon, 26 Nov 2007 15:58:13 +0000 (10:58 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:03:58 +0000 (11:03 -0400)
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>
fs/btrfs/ctree.c

index 1b47fe71e0b410b1efa8ae03c9e94b484c769761..3b16051b121bfcfaa20e62999ab6f1f2d5246a8e 100644 (file)
@@ -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);