Skip to content

Commit 3619c94

Browse files
josefbacikkdave
authored andcommitted
btrfs: open code btrfs_read_fs_root_no_name
All this does is call btrfs_get_fs_root() with check_ref == true. Just use btrfs_get_fs_root() so we don't have a bunch of different helpers that do the same thing. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 83db2aa commit 3619c94

12 files changed

Lines changed: 17 additions & 23 deletions

File tree

‎fs/btrfs/disk-io.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3178,7 +3178,7 @@ int __cold open_ctree(struct super_block *sb,
31783178
location.type = BTRFS_ROOT_ITEM_KEY;
31793179
location.offset = 0;
31803180

3181-
fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location);
3181+
fs_info->fs_root = btrfs_get_fs_root(fs_info, &location, true);
31823182
if (IS_ERR(fs_info->fs_root)) {
31833183
err = PTR_ERR(fs_info->fs_root);
31843184
btrfs_warn(fs_info, "failed to read fs tree: %d", err);

‎fs/btrfs/disk-io.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info);
7070
struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
7171
struct btrfs_key *key,
7272
bool check_ref);
73-
static inline struct btrfs_root *
74-
btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
75-
struct btrfs_key *location)
76-
{
77-
return btrfs_get_fs_root(fs_info, location, true);
78-
}
7973

8074
int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
8175
void btrfs_btree_balance_dirty(struct btrfs_fs_info *fs_info);

‎fs/btrfs/export.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
7777

7878
index = srcu_read_lock(&fs_info->subvol_srcu);
7979

80-
root = btrfs_read_fs_root_no_name(fs_info, &key);
80+
root = btrfs_get_fs_root(fs_info, &key, true);
8181
if (IS_ERR(root)) {
8282
err = PTR_ERR(root);
8383
goto fail;

‎fs/btrfs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
287287

288288
index = srcu_read_lock(&fs_info->subvol_srcu);
289289

290-
inode_root = btrfs_read_fs_root_no_name(fs_info, &key);
290+
inode_root = btrfs_get_fs_root(fs_info, &key, true);
291291
if (IS_ERR(inode_root)) {
292292
ret = PTR_ERR(inode_root);
293293
goto cleanup;

‎fs/btrfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5153,7 +5153,7 @@ static int fixup_tree_root_location(struct btrfs_fs_info *fs_info,
51535153

51545154
btrfs_release_path(path);
51555155

5156-
new_root = btrfs_read_fs_root_no_name(fs_info, location);
5156+
new_root = btrfs_get_fs_root(fs_info, location, true);
51575157
if (IS_ERR(new_root)) {
51585158
err = PTR_ERR(new_root);
51595159
goto out;

‎fs/btrfs/ioctl.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ static noinline int create_subvol(struct inode *dir,
666666
goto fail;
667667

668668
key.offset = (u64)-1;
669-
new_root = btrfs_read_fs_root_no_name(fs_info, &key);
669+
new_root = btrfs_get_fs_root(fs_info, &key, true);
670670
if (IS_ERR(new_root)) {
671671
ret = PTR_ERR(new_root);
672672
btrfs_abort_transaction(trans, ret);
@@ -2179,7 +2179,7 @@ static noinline int search_ioctl(struct inode *inode,
21792179
key.objectid = sk->tree_id;
21802180
key.type = BTRFS_ROOT_ITEM_KEY;
21812181
key.offset = (u64)-1;
2182-
root = btrfs_read_fs_root_no_name(info, &key);
2182+
root = btrfs_get_fs_root(info, &key, true);
21832183
if (IS_ERR(root)) {
21842184
btrfs_free_path(path);
21852185
return PTR_ERR(root);
@@ -2314,7 +2314,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
23142314
key.objectid = tree_id;
23152315
key.type = BTRFS_ROOT_ITEM_KEY;
23162316
key.offset = (u64)-1;
2317-
root = btrfs_read_fs_root_no_name(info, &key);
2317+
root = btrfs_get_fs_root(info, &key, true);
23182318
if (IS_ERR(root)) {
23192319
ret = PTR_ERR(root);
23202320
goto out;
@@ -2408,7 +2408,7 @@ static int btrfs_search_path_in_tree_user(struct inode *inode,
24082408
key.objectid = treeid;
24092409
key.type = BTRFS_ROOT_ITEM_KEY;
24102410
key.offset = (u64)-1;
2411-
root = btrfs_read_fs_root_no_name(fs_info, &key);
2411+
root = btrfs_get_fs_root(fs_info, &key, true);
24122412
if (IS_ERR(root)) {
24132413
ret = PTR_ERR(root);
24142414
goto out;
@@ -2653,7 +2653,7 @@ static int btrfs_ioctl_get_subvol_info(struct file *file, void __user *argp)
26532653
key.objectid = BTRFS_I(inode)->root->root_key.objectid;
26542654
key.type = BTRFS_ROOT_ITEM_KEY;
26552655
key.offset = (u64)-1;
2656-
root = btrfs_read_fs_root_no_name(fs_info, &key);
2656+
root = btrfs_get_fs_root(fs_info, &key, true);
26572657
if (IS_ERR(root)) {
26582658
ret = PTR_ERR(root);
26592659
goto out;
@@ -3983,7 +3983,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
39833983
location.type = BTRFS_ROOT_ITEM_KEY;
39843984
location.offset = (u64)-1;
39853985

3986-
new_root = btrfs_read_fs_root_no_name(fs_info, &location);
3986+
new_root = btrfs_get_fs_root(fs_info, &location, true);
39873987
if (IS_ERR(new_root)) {
39883988
ret = PTR_ERR(new_root);
39893989
goto out;

‎fs/btrfs/scrub.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,
653653
root_key.objectid = root;
654654
root_key.type = BTRFS_ROOT_ITEM_KEY;
655655
root_key.offset = (u64)-1;
656-
local_root = btrfs_read_fs_root_no_name(fs_info, &root_key);
656+
local_root = btrfs_get_fs_root(fs_info, &root_key, true);
657657
if (IS_ERR(local_root)) {
658658
ret = PTR_ERR(local_root);
659659
goto err;

‎fs/btrfs/send.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7195,7 +7195,7 @@ long btrfs_ioctl_send(struct file *mnt_file, struct btrfs_ioctl_send_args *arg)
71957195

71967196
index = srcu_read_lock(&fs_info->subvol_srcu);
71977197

7198-
clone_root = btrfs_read_fs_root_no_name(fs_info, &key);
7198+
clone_root = btrfs_get_fs_root(fs_info, &key, true);
71997199
if (IS_ERR(clone_root)) {
72007200
srcu_read_unlock(&fs_info->subvol_srcu, index);
72017201
ret = PTR_ERR(clone_root);
@@ -7234,7 +7234,7 @@ long btrfs_ioctl_send(struct file *mnt_file, struct btrfs_ioctl_send_args *arg)
72347234

72357235
index = srcu_read_lock(&fs_info->subvol_srcu);
72367236

7237-
sctx->parent_root = btrfs_read_fs_root_no_name(fs_info, &key);
7237+
sctx->parent_root = btrfs_get_fs_root(fs_info, &key, true);
72387238
if (IS_ERR(sctx->parent_root)) {
72397239
srcu_read_unlock(&fs_info->subvol_srcu, index);
72407240
ret = PTR_ERR(sctx->parent_root);

‎fs/btrfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ static char *get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
10961096
key.objectid = subvol_objectid;
10971097
key.type = BTRFS_ROOT_ITEM_KEY;
10981098
key.offset = (u64)-1;
1099-
fs_root = btrfs_read_fs_root_no_name(fs_info, &key);
1099+
fs_root = btrfs_get_fs_root(fs_info, &key, true);
11001100
if (IS_ERR(fs_root)) {
11011101
ret = PTR_ERR(fs_root);
11021102
goto err;

‎fs/btrfs/transaction.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
16331633
}
16341634

16351635
key.offset = (u64)-1;
1636-
pending->snap = btrfs_read_fs_root_no_name(fs_info, &key);
1636+
pending->snap = btrfs_get_fs_root(fs_info, &key, true);
16371637
if (IS_ERR(pending->snap)) {
16381638
ret = PTR_ERR(pending->snap);
16391639
btrfs_abort_transaction(trans, ret);

0 commit comments

Comments
 (0)