Commit 5ee78ac7 authored by Chris Mason's avatar Chris Mason

Btrfs: Fix split_leaf to avoid incorrect double splits

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent ff190c0c
......@@ -1865,9 +1865,13 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root
return ret;
}
mid = slot;
if (mid != nritems &&
leaf_space_used(l, mid, nritems - mid) +
space_needed > BTRFS_LEAF_DATA_SIZE(root)) {
double_split = 1;
}
}
}
nritems = nritems - mid;
btrfs_set_header_nritems(right, nritems);
data_copy_size = btrfs_item_end_nr(l, mid) - leaf_data_end(root, l);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment