summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index e85b243be5a2..cdc112d3bab2 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3033,13 +3033,13 @@ static noinline int __push_leaf_right(struct btrfs_path *path,
BTRFS_LEAF_DATA_OFFSET + leaf_data_end(left),
push_space);
- memmove_extent_buffer(right, btrfs_item_nr_offset(push_items),
- btrfs_item_nr_offset(0),
+ memmove_extent_buffer(right, btrfs_item_nr_offset(right, push_items),
+ btrfs_item_nr_offset(right, 0),
right_nritems * sizeof(struct btrfs_item));
/* copy the items from left to right */
- copy_extent_buffer(right, left, btrfs_item_nr_offset(0),
- btrfs_item_nr_offset(left_nritems - push_items),
+ copy_extent_buffer(right, left, btrfs_item_nr_offset(right, 0),
+ btrfs_item_nr_offset(left, left_nritems - push_items),
push_items * sizeof(struct btrfs_item));
/* update the item pointers */
@@ -3233,8 +3233,8 @@ static noinline int __push_leaf_left(struct btrfs_path *path, int data_size,
/* push data from right to left */
copy_extent_buffer(left, right,
- btrfs_item_nr_offset(btrfs_header_nritems(left)),
- btrfs_item_nr_offset(0),
+ btrfs_item_nr_offset(left, btrfs_header_nritems(left)),
+ btrfs_item_nr_offset(right, 0),
push_items * sizeof(struct btrfs_item));
push_space = BTRFS_LEAF_DATA_SIZE(fs_info) -
@@ -3272,8 +3272,8 @@ static noinline int __push_leaf_left(struct btrfs_path *path, int data_size,
BTRFS_LEAF_DATA_OFFSET +
leaf_data_end(right), push_space);
- memmove_extent_buffer(right, btrfs_item_nr_offset(0),
- btrfs_item_nr_offset(push_items),
+ memmove_extent_buffer(right, btrfs_item_nr_offset(right, 0),
+ btrfs_item_nr_offset(left, push_items),
(btrfs_header_nritems(right) - push_items) *
sizeof(struct btrfs_item));
}
@@ -3407,8 +3407,8 @@ static noinline void copy_for_split(struct btrfs_trans_handle *trans,
btrfs_set_header_nritems(right, nritems);
data_copy_size = btrfs_item_data_end(l, mid) - leaf_data_end(l);
- copy_extent_buffer(right, l, btrfs_item_nr_offset(0),
- btrfs_item_nr_offset(mid),
+ copy_extent_buffer(right, l, btrfs_item_nr_offset(right, 0),
+ btrfs_item_nr_offset(l, mid),
nritems * sizeof(struct btrfs_item));
copy_extent_buffer(right, l,
@@ -3784,8 +3784,8 @@ static noinline int split_item(struct btrfs_path *path,
nritems = btrfs_header_nritems(leaf);
if (slot != nritems) {
/* shift the items */
- memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + 1),
- btrfs_item_nr_offset(slot),
+ memmove_extent_buffer(leaf, btrfs_item_nr_offset(leaf, slot + 1),
+ btrfs_item_nr_offset(leaf, slot),
(nritems - slot) * sizeof(struct btrfs_item));
}
@@ -4077,9 +4077,10 @@ static void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *p
ioff - batch->total_data_size);
}
/* shift the items */
- memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + batch->nr),
- btrfs_item_nr_offset(slot),
- (nritems - slot) * sizeof(struct btrfs_item));
+ memmove_extent_buffer(leaf,
+ btrfs_item_nr_offset(leaf, slot + batch->nr),
+ btrfs_item_nr_offset(leaf, slot),
+ (nritems - slot) * sizeof(struct btrfs_item));
/* shift the data */
memmove_extent_buffer(leaf, BTRFS_LEAF_DATA_OFFSET +
@@ -4333,8 +4334,8 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
btrfs_set_token_item_offset(&token, i, ioff + dsize);
}
- memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot),
- btrfs_item_nr_offset(slot + nr),
+ memmove_extent_buffer(leaf, btrfs_item_nr_offset(leaf, slot),
+ btrfs_item_nr_offset(leaf, slot + nr),
sizeof(struct btrfs_item) *
(nritems - slot - nr));
}