Skip to content

Commit 7f09699

Browse files
fdmananakdave
authored andcommitted
btrfs: deduplicate log root free in error paths from btrfs_recover_log_trees()
Instead of duplicating the dropping of a log tree in case we jump to the 'error' label, move the dropping under the 'error' label and get rid of the the unnecessary setting of the log root to NULL since we return immediately after. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent efa44fc commit 7f09699

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

fs/btrfs/tree-log.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7491,8 +7491,6 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
74917491
ret = PTR_ERR(wc.root);
74927492
wc.root = NULL;
74937493
if (ret != -ENOENT) {
7494-
btrfs_put_root(wc.log);
7495-
wc.log = NULL;
74967494
btrfs_abort_transaction(trans, ret);
74977495
goto error;
74987496
}
@@ -7510,8 +7508,6 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
75107508
*/
75117509
ret = btrfs_pin_extent_for_log_replay(trans, wc.log->node);
75127510
if (ret) {
7513-
btrfs_put_root(wc.log);
7514-
wc.log = NULL;
75157511
btrfs_abort_transaction(trans, ret);
75167512
goto error;
75177513
}
@@ -7597,6 +7593,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
75977593
error:
75987594
if (wc.trans)
75997595
btrfs_end_transaction(wc.trans);
7596+
btrfs_put_root(wc.log);
76007597
clear_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags);
76017598
btrfs_free_path(path);
76027599
return ret;

0 commit comments

Comments
 (0)