Btrfs: don't run __tree_mod_log_free_eb on leaves
authorChris Mason <chris.mason@fusionio.com>
Tue, 7 Aug 2012 19:34:49 +0000 (15:34 -0400)
committerChris Mason <chris.mason@oracle.com>
Tue, 28 Aug 2012 20:53:34 +0000 (16:53 -0400)
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: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/ctree.c

index 08e0b11ba0a1072dc03742a2d3930e0b7d7461b7..6d183f60d63a0521e8c4461e4d5fd705163d17d1 100644 (file)
@@ -625,6 +625,9 @@ __tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
        u32 nritems;
        int ret;
 
+       if (btrfs_header_level(eb) == 0)
+               return;
+
        nritems = btrfs_header_nritems(eb);
        for (i = nritems - 1; i >= 0; i--) {
                ret = tree_mod_log_insert_key_locked(fs_info, eb, i,