Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7653947f authored by Zhao Lei's avatar Zhao Lei Committed by Chris Mason
Browse files

Btrfs: btrfs_rm_dev_replace_blocked(): Use wait_event()



Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 09dd7a01
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -440,18 +440,9 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
 */
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);
	do {
		prepare_to_wait(&fs_info->replace_wait, &wait,
				TASK_UNINTERRUPTIBLE);
		writers = percpu_counter_sum(&fs_info->bio_counter);
		if (writers)
			schedule();
		finish_wait(&fs_info->replace_wait, &wait);
	} while (writers);
	wait_event(fs_info->replace_wait, !percpu_counter_sum(
		   &fs_info->bio_counter));
}

/*