]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: send: simplify return logic from __get_cur_name_and_parent()
authorFilipe Manana <fdmanana@suse.com>
Mon, 10 Feb 2025 11:38:47 +0000 (11:38 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:45 +0000 (20:35 +0100)
There is no need to have an 'out' label and jump into it since there are
no resource cleanups to perform (release locks, free memory, etc), so
make this simpler by removing the label and goto and instead return
directly.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c

index dcc1cf7d1dbdaf63f0931d015ffe5531f088c382..393c9ca5de9037eb5ee58f515422fc8f62d17996 100644 (file)
@@ -2309,9 +2309,8 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
                        *parent_gen = nce->parent_gen;
                        ret = fs_path_add(dest, nce->name, nce->name_len);
                        if (ret < 0)
-                               goto out;
-                       ret = nce->ret;
-                       goto out;
+                               return ret;
+                       return nce->ret;
                }
        }
 
@@ -2322,12 +2321,12 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
         */
        ret = is_inode_existent(sctx, ino, gen, NULL, NULL);
        if (ret < 0)
-               goto out;
+               return ret;
 
        if (!ret) {
                ret = gen_unique_name(sctx, ino, gen, dest);
                if (ret < 0)
-                       goto out;
+                       return ret;
                ret = 1;
                goto out_cache;
        }
@@ -2343,7 +2342,7 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
                ret = get_first_ref(sctx->parent_root, ino,
                                    parent_ino, parent_gen, dest);
        if (ret < 0)
-               goto out;
+               return ret;
 
        /*
         * Check if the ref was overwritten by an inode's ref that was processed
@@ -2352,12 +2351,12 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
        ret = did_overwrite_ref(sctx, *parent_ino, *parent_gen, ino, gen,
                                dest->start, fs_path_len(dest));
        if (ret < 0)
-               goto out;
+               return ret;
        if (ret) {
                fs_path_reset(dest);
                ret = gen_unique_name(sctx, ino, gen, dest);
                if (ret < 0)
-                       goto out;
+                       return ret;
                ret = 1;
        }
 
@@ -2366,10 +2365,8 @@ out_cache:
         * Store the result of the lookup in the name cache.
         */
        nce = kmalloc(sizeof(*nce) + fs_path_len(dest), GFP_KERNEL);
-       if (!nce) {
-               ret = -ENOMEM;
-               goto out;
-       }
+       if (!nce)
+               return -ENOMEM;
 
        nce->entry.key = ino;
        nce->entry.gen = gen;
@@ -2387,10 +2384,9 @@ out_cache:
        nce_ret = btrfs_lru_cache_store(&sctx->name_cache, &nce->entry, GFP_KERNEL);
        if (nce_ret < 0) {
                kfree(nce);
-               ret = nce_ret;
+               return nce_ret;
        }
 
-out:
        return ret;
 }