]> git.hungrycats.org Git - linux/commitdiff
Btrfs: btrfs_rm_dev_replace_blocked(): Use wait_event()
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 20 Jan 2015 07:11:38 +0000 (15:11 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 8 Mar 2015 04:04:53 +0000 (23:04 -0500)
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>
(cherry picked from commit 7653947fe6d59db72fbc26c4fc9ef842febc79e3)

fs/btrfs/dev-replace.c

index 2dae2b5d0826684546b9ed0238bfceb360e474fa..c2de569b95d66d8e1ce99b5a9500360aa2daf1c8 100644 (file)
@@ -439,18 +439,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));
 }
 
 /*