Btrfs: Correct redundant test in add_inode_ref
authorJulia Lawall <julia@diku.dk>
Mon, 27 Jul 2009 17:57:00 +0000 (13:57 -0400)
committerChris Mason <chris.mason@oracle.com>
Mon, 27 Jul 2009 17:57:00 +0000 (13:57 -0400)
dir has already been tested.  It seems that this test should be on the
recently returned value inode.

A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/tree-log.c

index 1956068626183ad854435ee8934dc16a231c2d5f..11d0787c618827b3bd0934430987b15fef053b72 100644 (file)
@@ -797,7 +797,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
                return -ENOENT;
 
        inode = read_one_inode(root, key->objectid);
-       BUG_ON(!dir);
+       BUG_ON(!inode);
 
        ref_ptr = btrfs_item_ptr_offset(eb, slot);
        ref_end = ref_ptr + btrfs_item_size_nr(eb, slot);