Commit 3c64a1ab authored by Stefan Behrens's avatar Stefan Behrens Committed by Josef Bacik

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: default avatarStefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent b1b19596
...@@ -82,11 +82,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, ...@@ -82,11 +82,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
goto fail; goto fail;
} }
if (btrfs_root_refs(&root->root_item) == 0) {
err = -ENOENT;
goto fail;
}
key.objectid = objectid; key.objectid = objectid;
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
key.offset = 0; key.offset = 0;
......
...@@ -308,10 +308,6 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info, ...@@ -308,10 +308,6 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
ret = PTR_ERR(inode_root); ret = PTR_ERR(inode_root);
goto cleanup; goto cleanup;
} }
if (btrfs_root_refs(&inode_root->root_item) == 0) {
ret = -ENOENT;
goto cleanup;
}
key.objectid = defrag->ino; key.objectid = defrag->ino;
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
......
...@@ -2262,11 +2262,6 @@ static noinline int relink_extent_backref(struct btrfs_path *path, ...@@ -2262,11 +2262,6 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
return 0; return 0;
return PTR_ERR(root); 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 */ /* step 2: get inode */
key.objectid = backref->inum; key.objectid = backref->inum;
...@@ -4821,11 +4816,6 @@ static int fixup_tree_root_location(struct btrfs_root *root, ...@@ -4821,11 +4816,6 @@ static int fixup_tree_root_location(struct btrfs_root *root,
goto out; goto out;
} }
if (btrfs_root_refs(&new_root->root_item) == 0) {
err = -ENOENT;
goto out;
}
*sub_root = new_root; *sub_root = new_root;
location->objectid = btrfs_root_dirid(&new_root->root_item); location->objectid = btrfs_root_dirid(&new_root->root_item);
location->type = BTRFS_INODE_ITEM_KEY; location->type = BTRFS_INODE_ITEM_KEY;
......
...@@ -2951,11 +2951,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) ...@@ -2951,11 +2951,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
goto out; goto out;
} }
if (btrfs_root_refs(&new_root->root_item) == 0) {
ret = -ENOENT;
goto out;
}
path = btrfs_alloc_path(); path = btrfs_alloc_path();
if (!path) { if (!path) {
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -775,9 +775,6 @@ static struct dentry *get_default_root(struct super_block *sb, ...@@ -775,9 +775,6 @@ static struct dentry *get_default_root(struct super_block *sb,
if (IS_ERR(new_root)) if (IS_ERR(new_root))
return ERR_CAST(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); dir_id = btrfs_root_dirid(&new_root->root_item);
setup_root: setup_root:
location.objectid = dir_id; location.objectid = dir_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment