Skip to content

Commit 6e812a9

Browse files
asjkdave
authored andcommitted
btrfs: rename return variables in btrfs_qgroup_rescan_worker()
Rename ret to ret2 compile and then err to ret. Also, new ret2 is found to be localized within the 'if (trans)' statement, so move its declaration there. Signed-off-by: Anand Jain <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 5e8fb9b commit 6e812a9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

fs/btrfs/qgroup.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,7 +3700,6 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
37003700
qgroup_rescan_work);
37013701
struct btrfs_path *path;
37023702
struct btrfs_trans_handle *trans = NULL;
3703-
int err = -ENOMEM;
37043703
int ret = 0;
37053704
bool stopped = false;
37063705
bool did_leaf_rescans = false;
@@ -3709,27 +3708,28 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
37093708
return;
37103709

37113710
path = btrfs_alloc_path();
3712-
if (!path)
3711+
if (!path) {
3712+
ret = -ENOMEM;
37133713
goto out;
3714+
}
37143715
/*
37153716
* Rescan should only search for commit root, and any later difference
37163717
* should be recorded by qgroup
37173718
*/
37183719
path->search_commit_root = 1;
37193720
path->skip_locking = 1;
37203721

3721-
err = 0;
3722-
while (!err && !(stopped = rescan_should_stop(fs_info))) {
3722+
while (!ret && !(stopped = rescan_should_stop(fs_info))) {
37233723
trans = btrfs_start_transaction(fs_info->fs_root, 0);
37243724
if (IS_ERR(trans)) {
3725-
err = PTR_ERR(trans);
3725+
ret = PTR_ERR(trans);
37263726
break;
37273727
}
37283728

3729-
err = qgroup_rescan_leaf(trans, path);
3729+
ret = qgroup_rescan_leaf(trans, path);
37303730
did_leaf_rescans = true;
37313731

3732-
if (err > 0)
3732+
if (ret > 0)
37333733
btrfs_commit_transaction(trans);
37343734
else
37353735
btrfs_end_transaction(trans);
@@ -3739,10 +3739,10 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
37393739
btrfs_free_path(path);
37403740

37413741
mutex_lock(&fs_info->qgroup_rescan_lock);
3742-
if (err > 0 &&
3742+
if (ret > 0 &&
37433743
fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT) {
37443744
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
3745-
} else if (err < 0 || stopped) {
3745+
} else if (ret < 0 || stopped) {
37463746
fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
37473747
}
37483748
mutex_unlock(&fs_info->qgroup_rescan_lock);
@@ -3757,11 +3757,11 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
37573757
if (did_leaf_rescans) {
37583758
trans = btrfs_start_transaction(fs_info->quota_root, 1);
37593759
if (IS_ERR(trans)) {
3760-
err = PTR_ERR(trans);
3760+
ret = PTR_ERR(trans);
37613761
trans = NULL;
37623762
btrfs_err(fs_info,
37633763
"fail to start transaction for status update: %d",
3764-
err);
3764+
ret);
37653765
}
37663766
} else {
37673767
trans = NULL;
@@ -3772,11 +3772,11 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
37723772
fs_info->qgroup_flags & BTRFS_QGROUP_RUNTIME_FLAG_CANCEL_RESCAN)
37733773
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;
37743774
if (trans) {
3775-
ret = update_qgroup_status_item(trans);
3776-
if (ret < 0) {
3777-
err = ret;
3778-
btrfs_err(fs_info, "fail to update qgroup status: %d",
3779-
err);
3775+
int ret2 = update_qgroup_status_item(trans);
3776+
3777+
if (ret2 < 0) {
3778+
ret = ret2;
3779+
btrfs_err(fs_info, "fail to update qgroup status: %d", ret);
37803780
}
37813781
}
37823782
fs_info->qgroup_rescan_running = false;
@@ -3793,11 +3793,11 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
37933793
btrfs_info(fs_info, "qgroup scan paused");
37943794
} else if (fs_info->qgroup_flags & BTRFS_QGROUP_RUNTIME_FLAG_CANCEL_RESCAN) {
37953795
btrfs_info(fs_info, "qgroup scan cancelled");
3796-
} else if (err >= 0) {
3796+
} else if (ret >= 0) {
37973797
btrfs_info(fs_info, "qgroup scan completed%s",
3798-
err > 0 ? " (inconsistency flag cleared)" : "");
3798+
ret > 0 ? " (inconsistency flag cleared)" : "");
37993799
} else {
3800-
btrfs_err(fs_info, "qgroup scan failed with %d", err);
3800+
btrfs_err(fs_info, "qgroup scan failed with %d", ret);
38013801
}
38023802
}
38033803

0 commit comments

Comments
 (0)