Btrfs: rescan for qgroups
If qgroup tracking is out of sync, a rescan operation can be started. It iterates the complete extent tree and recalculates all qgroup tracking data. This is an expensive operation and should not be used unless required. A filesystem under rescan can still be umounted. The rescan continues on the next mount. Status information is provided with a separate ioctl while a rescan operation is in progress. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
@@ -1976,6 +1976,7 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)
|
||||
btrfs_stop_workers(&fs_info->caching_workers);
|
||||
btrfs_stop_workers(&fs_info->readahead_workers);
|
||||
btrfs_stop_workers(&fs_info->flush_workers);
|
||||
btrfs_stop_workers(&fs_info->qgroup_rescan_workers);
|
||||
}
|
||||
|
||||
/* helper to cleanup tree roots */
|
||||
@@ -2267,6 +2268,7 @@ int open_ctree(struct super_block *sb,
|
||||
fs_info->qgroup_seq = 1;
|
||||
fs_info->quota_enabled = 0;
|
||||
fs_info->pending_quota_state = 0;
|
||||
mutex_init(&fs_info->qgroup_rescan_lock);
|
||||
|
||||
btrfs_init_free_cluster(&fs_info->meta_alloc_cluster);
|
||||
btrfs_init_free_cluster(&fs_info->data_alloc_cluster);
|
||||
@@ -2476,6 +2478,8 @@ int open_ctree(struct super_block *sb,
|
||||
btrfs_init_workers(&fs_info->readahead_workers, "readahead",
|
||||
fs_info->thread_pool_size,
|
||||
&fs_info->generic_worker);
|
||||
btrfs_init_workers(&fs_info->qgroup_rescan_workers, "qgroup-rescan", 1,
|
||||
&fs_info->generic_worker);
|
||||
|
||||
/*
|
||||
* endios are largely parallel and should have a very
|
||||
@@ -2510,6 +2514,7 @@ int open_ctree(struct super_block *sb,
|
||||
ret |= btrfs_start_workers(&fs_info->caching_workers);
|
||||
ret |= btrfs_start_workers(&fs_info->readahead_workers);
|
||||
ret |= btrfs_start_workers(&fs_info->flush_workers);
|
||||
ret |= btrfs_start_workers(&fs_info->qgroup_rescan_workers);
|
||||
if (ret) {
|
||||
err = -ENOMEM;
|
||||
goto fail_sb_buffer;
|
||||
|
Reference in New Issue
Block a user