Btrf: cleanup: don't check for root_refs == 0 twice
authorStefan Behrens <sbehrens@giantdisaster.de>
Fri, 23 Aug 2013 08:34:43 +0000 (10:34 +0200)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:16:29 +0000 (08:16 -0400)
btrfs_read_fs_root_no_name() already checks if btrfs_root_refs()
is zero and returns ENOENT in this case. There is no need to do
it again in three more places.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/file.c
fs/btrfs/relocation.c
fs/btrfs/scrub.c

index 5e7ea996f105696fdb054923e257412f1660cfe9..5ba87b0d2ef86d1563705df7ae62f48e59b7cbae 100644 (file)
@@ -310,11 +310,6 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
                goto cleanup;
        }
 
-       if (btrfs_root_refs(&inode_root->root_item) == 0) {
-               ret = -ENOENT;
-               goto cleanup;
-       }
-
        key.objectid = defrag->ino;
        btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
        key.offset = 0;
index cf5e30ff7093ea5dbe4c2a1244848ebd3f6b7760..aacc2121e87c5df2f7dac46e90daca2514a7912f 100644 (file)
@@ -2354,9 +2354,6 @@ again:
                        if (IS_ERR(root))
                                continue;
 
-                       if (btrfs_root_refs(&root->root_item) == 0)
-                               continue;
-
                        trans = btrfs_join_transaction(root);
                        BUG_ON(IS_ERR(trans));
 
index ec6a33a20200ca813fd65c31a561b3310a569f38..0afcd452fcb3d62c9804089ef1cb056687917784 100644 (file)
@@ -3217,11 +3217,6 @@ static int copy_nocow_pages_for_inode(u64 inum, u64 offset, u64 root, void *ctx)
                return PTR_ERR(local_root);
        }
 
-       if (btrfs_root_refs(&local_root->root_item) == 0) {
-               srcu_read_unlock(&fs_info->subvol_srcu, srcu_index);
-               return -ENOENT;
-       }
-
        key.type = BTRFS_INODE_ITEM_KEY;
        key.objectid = inum;
        key.offset = 0;