]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: cleanup: don't check the same thing twice
authorStefan Behrens <sbehrens@giantdisaster.de>
Mon, 13 May 2013 13:53:35 +0000 (13:53 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Fri, 14 Jun 2013 15:29:30 +0000 (11:29 -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 six places.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/export.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/super.c

index 81ee29eeb7ca569dd53bea2b35789c1fe9c2c777..4b86916073737a175770605de4a25b862faa6929 100644 (file)
@@ -82,11 +82,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
                goto fail;
        }
 
-       if (btrfs_root_refs(&root->root_item) == 0) {
-               err = -ENOENT;
-               goto fail;
-       }
-
        key.objectid = objectid;
        btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
        key.offset = 0;
index b3e359bc8e68641c80205d4ef8fc8f534e32e734..185af15ad9e471d0a78d180814ea29f37a62f1af 100644 (file)
@@ -308,10 +308,6 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
                ret = PTR_ERR(inode_root);
                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);
index c931a4dbd03136ca3de74ab1ad9371b6fbdf23f4..3817c1e49035f82314a644db7b0f7bec9fce5939 100644 (file)
@@ -2262,11 +2262,6 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
                        return 0;
                return PTR_ERR(root);
        }
-       if (btrfs_root_refs(&root->root_item) == 0) {
-               srcu_read_unlock(&fs_info->subvol_srcu, index);
-               /* parse ENOENT to 0 */
-               return 0;
-       }
 
        /* step 2: get inode */
        key.objectid = backref->inum;
@@ -4821,11 +4816,6 @@ static int fixup_tree_root_location(struct btrfs_root *root,
                goto out;
        }
 
-       if (btrfs_root_refs(&new_root->root_item) == 0) {
-               err = -ENOENT;
-               goto out;
-       }
-
        *sub_root = new_root;
        location->objectid = btrfs_root_dirid(&new_root->root_item);
        location->type = BTRFS_INODE_ITEM_KEY;
index fe655bc489945a6f949995d9b563522042c6fe31..10484f4bb2cce3bb44e46a7eafefa61331c58492 100644 (file)
@@ -2951,11 +2951,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
                goto out;
        }
 
-       if (btrfs_root_refs(&new_root->root_item) == 0) {
-               ret = -ENOENT;
-               goto out;
-       }
-
        path = btrfs_alloc_path();
        if (!path) {
                ret = -ENOMEM;
index 0805dd3b856ec8ef70a8a22404d3f5db7c27f339..2a6a908d00179f1345c74494345d79a54018eae0 100644 (file)
@@ -775,9 +775,6 @@ find_root:
        if (IS_ERR(new_root))
                return ERR_CAST(new_root);
 
-       if (btrfs_root_refs(&new_root->root_item) == 0)
-               return ERR_PTR(-ENOENT);
-
        dir_id = btrfs_root_dirid(&new_root->root_item);
 setup_root:
        location.objectid = dir_id;