aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
authorFilipe Manana <fdmanana@suse.com>2025-02-10 11:38:47 +0000
committerDavid Sterba <dsterba@suse.com>2025-03-18 20:35:45 +0100
commitdbee3fc55ac156006c47e71de3ed41a2307690c3 (patch)
treea32313a194345f233ba0c093ab932e81f9563930 /fs/btrfs
parenta77749b3e21813566cea050bbb3414ae74562eba (diff)
downloadath-dbee3fc55ac156006c47e71de3ed41a2307690c3.tar.gz
btrfs: send: simplify return logic from __get_cur_name_and_parent()
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/send.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index dcc1cf7d1dbda..393c9ca5de903 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -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;
}