From: Zhao Lei Date: Tue, 20 Jan 2015 07:11:38 +0000 (+0800) Subject: Btrfs: btrfs_rm_dev_replace_blocked(): Use wait_event() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7653947fe6d59db72fbc26c4fc9ef842febc79e3;p=openwrt%2Fstaging%2Fblogic.git Btrfs: btrfs_rm_dev_replace_blocked(): Use wait_event() Signed-off-by: Zhao Lei Signed-off-by: Miao Xie Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 92109b7c865c..5ec03d999c37 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -440,18 +440,9 @@ leave: */ 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)); } /*