Skip to content

Commit

Permalink
Btrfs: Fix split_leaf to avoid incorrect double splits
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
chrismason-xx committed Sep 25, 2008
1 parent ff190c0 commit 5ee78ac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,11 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root
return ret;
}
mid = slot;
double_split = 1;
if (mid != nritems &&
leaf_space_used(l, mid, nritems - mid) +
space_needed > BTRFS_LEAF_DATA_SIZE(root)) {
double_split = 1;
}
}
}
nritems = nritems - mid;
Expand Down

0 comments on commit 5ee78ac

Please sign in to comment.