Skip to content

Commit 9593bf4

Browse files
adam900710kdave
authored andcommitted
btrfs: qgroup: show more meaningful qgroup_rescan_init error message
Error message from qgroup_rescan_init() mostly looks like: BTRFS info (device nvme0n1p1): qgroup_rescan_init failed with -115 Which is far from meaningful, and sometimes confusing as for above -EINPROGRESS it's mostly (despite the init race) harmless, but sometimes it can also indicate problem if the return value is -EINVAL. Change it to some more meaningful messages like: BTRFS info (device nvme0n1p1): qgroup rescan is already in progress And BTRFS err(device nvme0n1p1): qgroup rescan init failed, qgroup is not enabled Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> [ update the messages and level ] Signed-off-by: David Sterba <[email protected]>
1 parent fd4e994 commit 9593bf4

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

fs/btrfs/qgroup.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,26 +2782,36 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid,
27822782
{
27832783
int ret = 0;
27842784

2785-
if (!init_flags &&
2786-
(!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) ||
2787-
!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON))) {
2788-
ret = -EINVAL;
2789-
goto err;
2785+
if (!init_flags) {
2786+
/* we're resuming qgroup rescan at mount time */
2787+
if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN))
2788+
btrfs_warn(fs_info,
2789+
"qgroup rescan init failed, qgroup is not enabled");
2790+
else if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON))
2791+
btrfs_warn(fs_info,
2792+
"qgroup rescan init failed, qgroup rescan is not queued");
2793+
return -EINVAL;
27902794
}
27912795

27922796
mutex_lock(&fs_info->qgroup_rescan_lock);
27932797
spin_lock(&fs_info->qgroup_lock);
27942798

27952799
if (init_flags) {
2796-
if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN)
2800+
if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) {
2801+
btrfs_warn(fs_info,
2802+
"qgroup rescan is already in progress");
27972803
ret = -EINPROGRESS;
2798-
else if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON))
2804+
} else if (!(fs_info->qgroup_flags &
2805+
BTRFS_QGROUP_STATUS_FLAG_ON)) {
2806+
btrfs_warn(fs_info,
2807+
"qgroup rescan init failed, qgroup is not enabled");
27992808
ret = -EINVAL;
2809+
}
28002810

28012811
if (ret) {
28022812
spin_unlock(&fs_info->qgroup_lock);
28032813
mutex_unlock(&fs_info->qgroup_rescan_lock);
2804-
goto err;
2814+
return ret;
28052815
}
28062816
fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_RESCAN;
28072817
}
@@ -2820,13 +2830,6 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid,
28202830
btrfs_init_work(&fs_info->qgroup_rescan_work,
28212831
btrfs_qgroup_rescan_helper,
28222832
btrfs_qgroup_rescan_worker, NULL, NULL);
2823-
2824-
if (ret) {
2825-
err:
2826-
btrfs_info(fs_info, "qgroup_rescan_init failed with %d", ret);
2827-
return ret;
2828-
}
2829-
28302833
return 0;
28312834
}
28322835

0 commit comments

Comments
 (0)