aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-02-27 03:24:25 -0500
committerChris Mason <clm@fb.com>2015-04-13 10:52:57 -0400
commit53b7cde9d5aa58cf7605664f0e34419156b02698 (patch)
tree54c7779a0c62f542952a867b8f45f08581a596c6 /fs/btrfs
parent3393168d22fd5f1be5b5429a818c10f642e88ae3 (diff)
btrfs: Update btrfs qgroup status item when rescan is done.
Update qgroup status when rescan is done. Before this patch, status item is not updated on rescan finish, which causing the RESCAN and INCONSISTENT flags never cleared. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/qgroup.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 44192370310b..2e04e99f1e5b 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2665,6 +2665,7 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
2665 struct ulist *tmp = NULL, *qgroups = NULL; 2665 struct ulist *tmp = NULL, *qgroups = NULL;
2666 struct extent_buffer *scratch_leaf = NULL; 2666 struct extent_buffer *scratch_leaf = NULL;
2667 int err = -ENOMEM; 2667 int err = -ENOMEM;
2668 int ret = 0;
2668 2669
2669 path = btrfs_alloc_path(); 2670 path = btrfs_alloc_path();
2670 if (!path) 2671 if (!path)
@@ -2715,6 +2716,28 @@ out:
2715 } 2716 }
2716 mutex_unlock(&fs_info->qgroup_rescan_lock); 2717 mutex_unlock(&fs_info->qgroup_rescan_lock);
2717 2718
2719 /*
2720 * only update status, since the previous part has alreay updated the
2721 * qgroup info.
2722 */
2723 trans = btrfs_start_transaction(fs_info->quota_root, 1);
2724 if (IS_ERR(trans)) {
2725 err = PTR_ERR(trans);
2726 btrfs_err(fs_info,
2727 "fail to start transaction for status update: %d\n",
2728 err);
2729 goto done;
2730 }
2731 ret = update_qgroup_status_item(trans, fs_info, fs_info->quota_root);
2732 if (ret < 0) {
2733 err = ret;
2734 btrfs_err(fs_info, "fail to update qgroup status: %d\n",
2735 err);
2736 btrfs_abort_transaction(trans, fs_info->quota_root, err);
2737 goto done;
2738 }
2739 btrfs_end_transaction(trans, fs_info->quota_root);
2740
2718 if (err >= 0) { 2741 if (err >= 0) {
2719 btrfs_info(fs_info, "qgroup scan completed%s", 2742 btrfs_info(fs_info, "qgroup scan completed%s",
2720 err > 0 ? " (inconsistency flag cleared)" : ""); 2743 err > 0 ? " (inconsistency flag cleared)" : "");
@@ -2722,6 +2745,7 @@ out:
2722 btrfs_err(fs_info, "qgroup scan failed with %d", err); 2745 btrfs_err(fs_info, "qgroup scan failed with %d", err);
2723 } 2746 }
2724 2747
2748done:
2725 complete_all(&fs_info->qgroup_rescan_completion); 2749 complete_all(&fs_info->qgroup_rescan_completion);
2726} 2750}
2727 2751
@@ -2756,7 +2780,6 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid,
2756 mutex_unlock(&fs_info->qgroup_rescan_lock); 2780 mutex_unlock(&fs_info->qgroup_rescan_lock);
2757 goto err; 2781 goto err;
2758 } 2782 }
2759
2760 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_RESCAN; 2783 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_RESCAN;
2761 } 2784 }
2762 2785