diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-19 14:01:21 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | 5ee78ac70f6c01f2a5acf662c2af975665710edc (patch) | |
tree | b6359b9df3d436a87853e84fed6a88fbb3aeb6d6 /fs/btrfs/ctree.c | |
parent | ff190c0c004d8e51195c7bcf5a8490aeefccbce0 (diff) |
Btrfs: Fix split_leaf to avoid incorrect double splits
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e8466940fa30..53e40b5c084d 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1865,7 +1865,11 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1865 | return ret; | 1865 | return ret; |
1866 | } | 1866 | } |
1867 | mid = slot; | 1867 | mid = slot; |
1868 | double_split = 1; | 1868 | if (mid != nritems && |
1869 | leaf_space_used(l, mid, nritems - mid) + | ||
1870 | space_needed > BTRFS_LEAF_DATA_SIZE(root)) { | ||
1871 | double_split = 1; | ||
1872 | } | ||
1869 | } | 1873 | } |
1870 | } | 1874 | } |
1871 | nritems = nritems - mid; | 1875 | nritems = nritems - mid; |