Commit b12a3b1e authored by Chris Mason's avatar Chris Mason Committed by Chris Mason

Btrfs: don't run __tree_mod_log_free_eb on leaves

When we split a leaf, we may end up inserting a new root on top of that
leaf.  The reflog code was incorrectly assuming the old root was always
a node.  This makes sure we skip over leaves.
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 6fc823b1
...@@ -625,6 +625,9 @@ __tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb) ...@@ -625,6 +625,9 @@ __tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
u32 nritems; u32 nritems;
int ret; int ret;
if (btrfs_header_level(eb) == 0)
return;
nritems = btrfs_header_nritems(eb); nritems = btrfs_header_nritems(eb);
for (i = nritems - 1; i >= 0; i--) { for (i = nritems - 1; i >= 0; i--) {
ret = tree_mod_log_insert_key_locked(fs_info, eb, i, ret = tree_mod_log_insert_key_locked(fs_info, eb, i,
......
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