Btrfs: remove scrub_super_lock holding in btrfs_sync_log()
Originally, we introduced scrub_super_lock to synchronize tree log code with scrubbing super. However we can replace scrub_super_lock with device_list_mutex, because writing super will hold this mutex, this will reduce an extra lock holding when writing supers in sync log code. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
committed by
Chris Mason
parent
7fdf4b608d
commit
9b011adfe1
@ -2932,13 +2932,15 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
|
||||
|
||||
atomic_inc(&fs_info->scrubs_running);
|
||||
mutex_unlock(&fs_info->scrub_lock);
|
||||
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
||||
|
||||
if (!is_dev_replace) {
|
||||
down_read(&fs_info->scrub_super_lock);
|
||||
/*
|
||||
* by holding device list mutex, we can
|
||||
* kick off writing super in log tree sync.
|
||||
*/
|
||||
ret = scrub_supers(sctx, dev);
|
||||
up_read(&fs_info->scrub_super_lock);
|
||||
}
|
||||
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
||||
|
||||
if (!ret)
|
||||
ret = scrub_enumerate_chunks(sctx, dev, start, end,
|
||||
@ -2988,16 +2990,6 @@ void btrfs_scrub_continue(struct btrfs_root *root)
|
||||
wake_up(&fs_info->scrub_pause_wait);
|
||||
}
|
||||
|
||||
void btrfs_scrub_pause_super(struct btrfs_root *root)
|
||||
{
|
||||
down_write(&root->fs_info->scrub_super_lock);
|
||||
}
|
||||
|
||||
void btrfs_scrub_continue_super(struct btrfs_root *root)
|
||||
{
|
||||
up_write(&root->fs_info->scrub_super_lock);
|
||||
}
|
||||
|
||||
int btrfs_scrub_cancel(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
mutex_lock(&fs_info->scrub_lock);
|
||||
|
Reference in New Issue
Block a user