aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Behrens <sbehrens@giantdisaster.de>2013-05-13 09:53:35 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-06-14 11:29:30 -0400
commit3c64a1aba7cfcb04f79e76f859b3d66660275d59 (patch)
treeb84ec1bcce88d60d5c3fd7a68d4dbcbdf985a6cb
parentb1b195969fe6d936f8c8bb63abf7efd2cc4cd5cf (diff)
Btrfs: cleanup: don't check the same thing twice
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>
-rw-r--r--fs/btrfs/export.c5
-rw-r--r--fs/btrfs/file.c4
-rw-r--r--fs/btrfs/inode.c10
-rw-r--r--fs/btrfs/ioctl.c5
-rw-r--r--fs/btrfs/super.c3
5 files changed, 0 insertions, 27 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 81ee29eeb7ca..4b8691607373 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -82,11 +82,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
82 goto fail; 82 goto fail;
83 } 83 }
84 84
85 if (btrfs_root_refs(&root->root_item) == 0) {
86 err = -ENOENT;
87 goto fail;
88 }
89
90 key.objectid = objectid; 85 key.objectid = objectid;
91 btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); 86 btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
92 key.offset = 0; 87 key.offset = 0;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index b3e359bc8e68..185af15ad9e4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -308,10 +308,6 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
308 ret = PTR_ERR(inode_root); 308 ret = PTR_ERR(inode_root);
309 goto cleanup; 309 goto cleanup;
310 } 310 }
311 if (btrfs_root_refs(&inode_root->root_item) == 0) {
312 ret = -ENOENT;
313 goto cleanup;
314 }
315 311
316 key.objectid = defrag->ino; 312 key.objectid = defrag->ino;
317 btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); 313 btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c931a4dbd031..3817c1e49035 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2262,11 +2262,6 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
2262 return 0; 2262 return 0;
2263 return PTR_ERR(root); 2263 return PTR_ERR(root);
2264 } 2264 }
2265 if (btrfs_root_refs(&root->root_item) == 0) {
2266 srcu_read_unlock(&fs_info->subvol_srcu, index);
2267 /* parse ENOENT to 0 */
2268 return 0;
2269 }
2270 2265
2271 /* step 2: get inode */ 2266 /* step 2: get inode */
2272 key.objectid = backref->inum; 2267 key.objectid = backref->inum;
@@ -4821,11 +4816,6 @@ static int fixup_tree_root_location(struct btrfs_root *root,
4821 goto out; 4816 goto out;
4822 } 4817 }
4823 4818
4824 if (btrfs_root_refs(&new_root->root_item) == 0) {
4825 err = -ENOENT;
4826 goto out;
4827 }
4828
4829 *sub_root = new_root; 4819 *sub_root = new_root;
4830 location->objectid = btrfs_root_dirid(&new_root->root_item); 4820 location->objectid = btrfs_root_dirid(&new_root->root_item);
4831 location->type = BTRFS_INODE_ITEM_KEY; 4821 location->type = BTRFS_INODE_ITEM_KEY;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index fe655bc48994..10484f4bb2cc 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2951,11 +2951,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
2951 goto out; 2951 goto out;
2952 } 2952 }
2953 2953
2954 if (btrfs_root_refs(&new_root->root_item) == 0) {
2955 ret = -ENOENT;
2956 goto out;
2957 }
2958
2959 path = btrfs_alloc_path(); 2954 path = btrfs_alloc_path();
2960 if (!path) { 2955 if (!path) {
2961 ret = -ENOMEM; 2956 ret = -ENOMEM;
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0805dd3b856e..2a6a908d0017 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -775,9 +775,6 @@ find_root:
775 if (IS_ERR(new_root)) 775 if (IS_ERR(new_root))
776 return ERR_CAST(new_root); 776 return ERR_CAST(new_root);
777 777
778 if (btrfs_root_refs(&new_root->root_item) == 0)
779 return ERR_PTR(-ENOENT);
780
781 dir_id = btrfs_root_dirid(&new_root->root_item); 778 dir_id = btrfs_root_dirid(&new_root->root_item);
782setup_root: 779setup_root:
783 location.objectid = dir_id; 780 location.objectid = dir_id;