diff options
author | Qu Wenruo <wqu@suse.com> | 2018-05-02 01:28:03 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-05-30 10:46:43 -0400 |
commit | 9593bf49675efc5567c9bdb8c51cdb204b6f85b3 (patch) | |
tree | 1ad13b58c54e0e47ce2a1c934bef47f8fc7f0f7d | |
parent | fd4e994bd1f9dc9628e168a7f619bf69f6984635 (diff) |
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 <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
[ update the messages and level ]
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/qgroup.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 457219d6a16b..1874a6d2e6f5 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -2782,26 +2782,36 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, | |||
2782 | { | 2782 | { |
2783 | int ret = 0; | 2783 | int ret = 0; |
2784 | 2784 | ||
2785 | if (!init_flags && | 2785 | if (!init_flags) { |
2786 | (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) || | 2786 | /* we're resuming qgroup rescan at mount time */ |
2787 | !(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON))) { | 2787 | if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN)) |
2788 | ret = -EINVAL; | 2788 | btrfs_warn(fs_info, |
2789 | goto err; | 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; | ||
2790 | } | 2794 | } |
2791 | 2795 | ||
2792 | mutex_lock(&fs_info->qgroup_rescan_lock); | 2796 | mutex_lock(&fs_info->qgroup_rescan_lock); |
2793 | spin_lock(&fs_info->qgroup_lock); | 2797 | spin_lock(&fs_info->qgroup_lock); |
2794 | 2798 | ||
2795 | if (init_flags) { | 2799 | 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"); | ||
2797 | ret = -EINPROGRESS; | 2803 | 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"); | ||
2799 | ret = -EINVAL; | 2808 | ret = -EINVAL; |
2809 | } | ||
2800 | 2810 | ||
2801 | if (ret) { | 2811 | if (ret) { |
2802 | spin_unlock(&fs_info->qgroup_lock); | 2812 | spin_unlock(&fs_info->qgroup_lock); |
2803 | mutex_unlock(&fs_info->qgroup_rescan_lock); | 2813 | mutex_unlock(&fs_info->qgroup_rescan_lock); |
2804 | goto err; | 2814 | return ret; |
2805 | } | 2815 | } |
2806 | fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_RESCAN; | 2816 | fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_RESCAN; |
2807 | } | 2817 | } |
@@ -2820,13 +2830,6 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, | |||
2820 | btrfs_init_work(&fs_info->qgroup_rescan_work, | 2830 | btrfs_init_work(&fs_info->qgroup_rescan_work, |
2821 | btrfs_qgroup_rescan_helper, | 2831 | btrfs_qgroup_rescan_helper, |
2822 | btrfs_qgroup_rescan_worker, NULL, NULL); | 2832 | 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 | |||
2830 | return 0; | 2833 | return 0; |
2831 | } | 2834 | } |
2832 | 2835 | ||