]> git.hungrycats.org Git - linux/commitdiff
btrfs: kill the btrfs_read_fs_root_no_name helper
authorJosef Bacik <josef@toxicpanda.com>
Wed, 20 Nov 2019 14:56:46 +0000 (06:56 -0800)
committerJosef Bacik <josef@toxicpanda.com>
Fri, 6 Dec 2019 16:34:48 +0000 (08:34 -0800)
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.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
12 files changed:
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/export.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/scrub.c
fs/btrfs/send.c
fs/btrfs/super.c
fs/btrfs/transaction.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c

index e3957d6b6babba2329a2986585a4e4eda7792432..fba2ca4965c4c922df9286d40dbd519b58f264c7 100644 (file)
@@ -3179,7 +3179,7 @@ int __cold open_ctree(struct super_block *sb,
        location.type = BTRFS_ROOT_ITEM_KEY;
        location.offset = 0;
 
-       fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location);
+       fs_info->fs_root = btrfs_get_fs_root(fs_info, &location, true);
        if (IS_ERR(fs_info->fs_root)) {
                err = PTR_ERR(fs_info->fs_root);
                btrfs_warn(fs_info, "failed to read fs tree: %d", err);
index 614802bd709dcf809d128a32edcaa7df75c34393..f5ef9ace903a6def7d3c8c5b403df855aa85fe9a 100644 (file)
@@ -70,12 +70,6 @@ void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info);
 struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
                                     struct btrfs_key *key,
                                     bool check_ref);
-static inline struct btrfs_root *
-btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
-                          struct btrfs_key *location)
-{
-       return btrfs_get_fs_root(fs_info, location, true);
-}
 
 int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
 void btrfs_btree_balance_dirty(struct btrfs_fs_info *fs_info);
index 72e312cae69d9e2576c4af40e6a700447b66004b..08cd8c4a02a5d219d95027fb498da7648ca1c4e1 100644 (file)
@@ -77,7 +77,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
 
        index = srcu_read_lock(&fs_info->subvol_srcu);
 
-       root = btrfs_read_fs_root_no_name(fs_info, &key);
+       root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(root)) {
                err = PTR_ERR(root);
                goto fail;
index 32e620981485700853404e3e896cbc25efafa204..8baa1b44d514cb0419e75ef14af3a9f5296afaf1 100644 (file)
@@ -287,7 +287,7 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
 
        index = srcu_read_lock(&fs_info->subvol_srcu);
 
-       inode_root = btrfs_read_fs_root_no_name(fs_info, &key);
+       inode_root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(inode_root)) {
                ret = PTR_ERR(inode_root);
                goto cleanup;
index fc0624fbe3878fe0bf6939d7bd06ee369e94ee19..138c21f5ed120571503375bcf6eeaac5a732f27a 100644 (file)
@@ -2514,7 +2514,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
        key.type = BTRFS_ROOT_ITEM_KEY;
        key.offset = (u64)-1;
 
-       root = btrfs_read_fs_root_no_name(fs_info, &key);
+       root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(root)) {
                if (PTR_ERR(root) == -ENOENT)
                        return 0;
@@ -2698,7 +2698,7 @@ static noinline int relink_extent_backref(struct btrfs_path *path,
 
        index = srcu_read_lock(&fs_info->subvol_srcu);
 
-       root = btrfs_read_fs_root_no_name(fs_info, &key);
+       root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(root)) {
                srcu_read_unlock(&fs_info->subvol_srcu, index);
                if (PTR_ERR(root) == -ENOENT)
@@ -5675,7 +5675,7 @@ static int fixup_tree_root_location(struct btrfs_fs_info *fs_info,
 
        btrfs_release_path(path);
 
-       new_root = btrfs_read_fs_root_no_name(fs_info, location);
+       new_root = btrfs_get_fs_root(fs_info, location, true);
        if (IS_ERR(new_root)) {
                err = PTR_ERR(new_root);
                goto out;
index 375befdecc19ccc6d9162f444195c43b63e7fb8b..95b0488b7da6de6b4ca51533cfda14af6e4b95a5 100644 (file)
@@ -666,7 +666,7 @@ static noinline int create_subvol(struct inode *dir,
                goto fail;
 
        key.offset = (u64)-1;
-       new_root = btrfs_read_fs_root_no_name(fs_info, &key);
+       new_root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(new_root)) {
                ret = PTR_ERR(new_root);
                btrfs_abort_transaction(trans, ret);
@@ -2179,7 +2179,7 @@ static noinline int search_ioctl(struct inode *inode,
                key.objectid = sk->tree_id;
                key.type = BTRFS_ROOT_ITEM_KEY;
                key.offset = (u64)-1;
-               root = btrfs_read_fs_root_no_name(info, &key);
+               root = btrfs_get_fs_root(info, &key, true);
                if (IS_ERR(root)) {
                        btrfs_free_path(path);
                        return PTR_ERR(root);
@@ -2314,7 +2314,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
        key.objectid = tree_id;
        key.type = BTRFS_ROOT_ITEM_KEY;
        key.offset = (u64)-1;
-       root = btrfs_read_fs_root_no_name(info, &key);
+       root = btrfs_get_fs_root(info, &key, true);
        if (IS_ERR(root)) {
                ret = PTR_ERR(root);
                goto out;
@@ -2408,7 +2408,7 @@ static int btrfs_search_path_in_tree_user(struct inode *inode,
                key.objectid = treeid;
                key.type = BTRFS_ROOT_ITEM_KEY;
                key.offset = (u64)-1;
-               root = btrfs_read_fs_root_no_name(fs_info, &key);
+               root = btrfs_get_fs_root(fs_info, &key, true);
                if (IS_ERR(root)) {
                        ret = PTR_ERR(root);
                        goto out;
@@ -2653,7 +2653,7 @@ static int btrfs_ioctl_get_subvol_info(struct file *file, void __user *argp)
        key.objectid = BTRFS_I(inode)->root->root_key.objectid;
        key.type = BTRFS_ROOT_ITEM_KEY;
        key.offset = (u64)-1;
-       root = btrfs_read_fs_root_no_name(fs_info, &key);
+       root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(root)) {
                ret = PTR_ERR(root);
                goto out;
@@ -3986,7 +3986,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
        location.type = BTRFS_ROOT_ITEM_KEY;
        location.offset = (u64)-1;
 
-       new_root = btrfs_read_fs_root_no_name(fs_info, &location);
+       new_root = btrfs_get_fs_root(fs_info, &location, true);
        if (IS_ERR(new_root)) {
                ret = PTR_ERR(new_root);
                goto out;
index e2c87220600f407b2164af97dbf6cbcdb2c1ce20..eed3a84920924ba58a024a9214faa5f17d7b0edc 100644 (file)
@@ -652,7 +652,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,
        root_key.objectid = root;
        root_key.type = BTRFS_ROOT_ITEM_KEY;
        root_key.offset = (u64)-1;
-       local_root = btrfs_read_fs_root_no_name(fs_info, &root_key);
+       local_root = btrfs_get_fs_root(fs_info, &root_key, true);
        if (IS_ERR(local_root)) {
                ret = PTR_ERR(local_root);
                goto err;
index ae2db5eb15499f54b986584f5218e1e257eceb47..73e2e350f4a1c900cb14de74898ad017c690b761 100644 (file)
@@ -7200,7 +7200,7 @@ long btrfs_ioctl_send(struct file *mnt_file, struct btrfs_ioctl_send_args *arg)
 
                        index = srcu_read_lock(&fs_info->subvol_srcu);
 
-                       clone_root = btrfs_read_fs_root_no_name(fs_info, &key);
+                       clone_root = btrfs_get_fs_root(fs_info, &key, true);
                        if (IS_ERR(clone_root)) {
                                srcu_read_unlock(&fs_info->subvol_srcu, index);
                                ret = PTR_ERR(clone_root);
@@ -7239,7 +7239,7 @@ long btrfs_ioctl_send(struct file *mnt_file, struct btrfs_ioctl_send_args *arg)
 
                index = srcu_read_lock(&fs_info->subvol_srcu);
 
-               sctx->parent_root = btrfs_read_fs_root_no_name(fs_info, &key);
+               sctx->parent_root = btrfs_get_fs_root(fs_info, &key, true);
                if (IS_ERR(sctx->parent_root)) {
                        srcu_read_unlock(&fs_info->subvol_srcu, index);
                        ret = PTR_ERR(sctx->parent_root);
index a98c3c71fc5475ae4efe6f21a92d7bf49bec1ef9..e387ca1ac0e54f5689540c92dba7df7d1144fcbd 100644 (file)
@@ -1077,7 +1077,7 @@ static char *get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
                key.objectid = subvol_objectid;
                key.type = BTRFS_ROOT_ITEM_KEY;
                key.offset = (u64)-1;
-               fs_root = btrfs_read_fs_root_no_name(fs_info, &key);
+               fs_root = btrfs_get_fs_root(fs_info, &key, true);
                if (IS_ERR(fs_root)) {
                        ret = PTR_ERR(fs_root);
                        goto err;
index 55d8fd68775aa065c2027a20a34856067506c756..e194d3e4e3a9a5196dc1d90a37b80eca471feb9e 100644 (file)
@@ -1631,7 +1631,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
        }
 
        key.offset = (u64)-1;
-       pending->snap = btrfs_read_fs_root_no_name(fs_info, &key);
+       pending->snap = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(pending->snap)) {
                ret = PTR_ERR(pending->snap);
                btrfs_abort_transaction(trans, ret);
index 881d117a07db49f94f2894aff666e9e776816805..a4321bdcbf3e6eb6202bf981fc010799e38f3533 100644 (file)
@@ -6291,7 +6291,7 @@ again:
                tmp_key.type = BTRFS_ROOT_ITEM_KEY;
                tmp_key.offset = (u64)-1;
 
-               wc.replay_dest = btrfs_read_fs_root_no_name(fs_info, &tmp_key);
+               wc.replay_dest = btrfs_get_fs_root(fs_info, &tmp_key, true);
                if (IS_ERR(wc.replay_dest)) {
                        ret = PTR_ERR(wc.replay_dest);
 
index d8e5560db285a0bbee1e7ce5e52d224ce35b08ab..904c3e03467ffb71b2860fe844a7d7fea4da6ed3 100644 (file)
@@ -4372,7 +4372,7 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
        key.objectid = subid;
        key.type = BTRFS_ROOT_ITEM_KEY;
        key.offset = (u64)-1;
-       subvol_root = btrfs_read_fs_root_no_name(fs_info, &key);
+       subvol_root = btrfs_get_fs_root(fs_info, &key, true);
        if (IS_ERR(subvol_root)) {
                ret = PTR_ERR(subvol_root);
                if (ret == -ENOENT)