diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-01-20 02:11:38 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-01-21 21:06:48 -0500 |
commit | 7653947fe6d59db72fbc26c4fc9ef842febc79e3 (patch) | |
tree | 7766695ee6800bf7c98c69c82330e10275bd5ef4 /fs | |
parent | 09dd7a01c3436344fb4c3974b275e016264e0a27 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/dev-replace.c | 13 |
1 files changed, 2 insertions, 11 deletions
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: | |||
440 | */ | 440 | */ |
441 | static void btrfs_rm_dev_replace_blocked(struct btrfs_fs_info *fs_info) | 441 | static void btrfs_rm_dev_replace_blocked(struct btrfs_fs_info *fs_info) |
442 | { | 442 | { |
443 | s64 writers; | ||
444 | DEFINE_WAIT(wait); | ||
445 | |||
446 | set_bit(BTRFS_FS_STATE_DEV_REPLACING, &fs_info->fs_state); | 443 | set_bit(BTRFS_FS_STATE_DEV_REPLACING, &fs_info->fs_state); |
447 | do { | 444 | wait_event(fs_info->replace_wait, !percpu_counter_sum( |
448 | prepare_to_wait(&fs_info->replace_wait, &wait, | 445 | &fs_info->bio_counter)); |
449 | TASK_UNINTERRUPTIBLE); | ||
450 | writers = percpu_counter_sum(&fs_info->bio_counter); | ||
451 | if (writers) | ||
452 | schedule(); | ||
453 | finish_wait(&fs_info->replace_wait, &wait); | ||
454 | } while (writers); | ||
455 | } | 446 | } |
456 | 447 | ||
457 | /* | 448 | /* |