diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-02-27 09:24:25 +0100 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-13 16:52:57 +0200 |
commit | 53b7cde9d5aa58cf7605664f0e34419156b02698 (patch) | |
tree | 54c7779a0c62f542952a867b8f45f08581a596c6 /fs/btrfs/qgroup.c | |
parent | btrfs: qgroup: Fix dead judgement on qgroup_rescan_leaf() return value. (diff) | |
download | linux-53b7cde9d5aa58cf7605664f0e34419156b02698.tar.xz linux-53b7cde9d5aa58cf7605664f0e34419156b02698.zip |
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/qgroup.c')
-rw-r--r-- | fs/btrfs/qgroup.c | 25 |
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) struct ulist *tmp = NULL, *qgroups = NULL; struct extent_buffer *scratch_leaf = NULL; int err = -ENOMEM; + int ret = 0; path = btrfs_alloc_path(); if (!path) @@ -2715,6 +2716,28 @@ out: } mutex_unlock(&fs_info->qgroup_rescan_lock); + /* + * only update status, since the previous part has alreay updated the + * qgroup info. + */ + trans = btrfs_start_transaction(fs_info->quota_root, 1); + if (IS_ERR(trans)) { + err = PTR_ERR(trans); + btrfs_err(fs_info, + "fail to start transaction for status update: %d\n", + err); + goto done; + } + ret = update_qgroup_status_item(trans, fs_info, fs_info->quota_root); + if (ret < 0) { + err = ret; + btrfs_err(fs_info, "fail to update qgroup status: %d\n", + err); + btrfs_abort_transaction(trans, fs_info->quota_root, err); + goto done; + } + btrfs_end_transaction(trans, fs_info->quota_root); + if (err >= 0) { btrfs_info(fs_info, "qgroup scan completed%s", err > 0 ? " (inconsistency flag cleared)" : ""); @@ -2722,6 +2745,7 @@ out: btrfs_err(fs_info, "qgroup scan failed with %d", err); } +done: complete_all(&fs_info->qgroup_rescan_completion); } @@ -2756,7 +2780,6 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, mutex_unlock(&fs_info->qgroup_rescan_lock); goto err; } - fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_RESCAN; } |