Btrfs: btrfs_rm_dev_replace_blocked(): Use wait_event()
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
@@ -440,18 +440,9 @@ leave:
|
|||||||
*/
|
*/
|
||||||
static void btrfs_rm_dev_replace_blocked(struct btrfs_fs_info *fs_info)
|
static void btrfs_rm_dev_replace_blocked(struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
s64 writers;
|
|
||||||
DEFINE_WAIT(wait);
|
|
||||||
|
|
||||||
set_bit(BTRFS_FS_STATE_DEV_REPLACING, &fs_info->fs_state);
|
set_bit(BTRFS_FS_STATE_DEV_REPLACING, &fs_info->fs_state);
|
||||||
do {
|
wait_event(fs_info->replace_wait, !percpu_counter_sum(
|
||||||
prepare_to_wait(&fs_info->replace_wait, &wait,
|
&fs_info->bio_counter));
|
||||||
TASK_UNINTERRUPTIBLE);
|
|
||||||
writers = percpu_counter_sum(&fs_info->bio_counter);
|
|
||||||
if (writers)
|
|
||||||
schedule();
|
|
||||||
finish_wait(&fs_info->replace_wait, &wait);
|
|
||||||
} while (writers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user