diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/dev-replace.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index ca6a3a3b6b6c..92109b7c865c 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -932,15 +932,15 @@ void btrfs_bio_counter_sub(struct btrfs_fs_info *fs_info, s64 amount) | |||
932 | 932 | ||
933 | void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info) | 933 | void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info) |
934 | { | 934 | { |
935 | DEFINE_WAIT(wait); | 935 | while (1) { |
936 | again: | 936 | percpu_counter_inc(&fs_info->bio_counter); |
937 | percpu_counter_inc(&fs_info->bio_counter); | 937 | if (likely(!test_bit(BTRFS_FS_STATE_DEV_REPLACING, |
938 | if (test_bit(BTRFS_FS_STATE_DEV_REPLACING, &fs_info->fs_state)) { | 938 | &fs_info->fs_state))) |
939 | break; | ||
940 | |||
939 | btrfs_bio_counter_dec(fs_info); | 941 | btrfs_bio_counter_dec(fs_info); |
940 | wait_event(fs_info->replace_wait, | 942 | wait_event(fs_info->replace_wait, |
941 | !test_bit(BTRFS_FS_STATE_DEV_REPLACING, | 943 | !test_bit(BTRFS_FS_STATE_DEV_REPLACING, |
942 | &fs_info->fs_state)); | 944 | &fs_info->fs_state)); |
943 | goto again; | ||
944 | } | 945 | } |
945 | |||
946 | } | 946 | } |