mirror of https://gitee.com/openkylin/linux.git
Btrfs: Cleanup btrfs_bio_counter_inc_blocked()
1: Remove no-need DEFINE_WAIT(wait) 2: Add likely() for BTRFS_FS_STATE_DEV_REPLACING condition 3: Use while loop instead of goto 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>
This commit is contained in:
parent
114ab50d82
commit
09dd7a01c3
|
@ -932,15 +932,15 @@ void btrfs_bio_counter_sub(struct btrfs_fs_info *fs_info, s64 amount)
|
||||||
|
|
||||||
void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
|
void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
DEFINE_WAIT(wait);
|
while (1) {
|
||||||
again:
|
percpu_counter_inc(&fs_info->bio_counter);
|
||||||
percpu_counter_inc(&fs_info->bio_counter);
|
if (likely(!test_bit(BTRFS_FS_STATE_DEV_REPLACING,
|
||||||
if (test_bit(BTRFS_FS_STATE_DEV_REPLACING, &fs_info->fs_state)) {
|
&fs_info->fs_state)))
|
||||||
|
break;
|
||||||
|
|
||||||
btrfs_bio_counter_dec(fs_info);
|
btrfs_bio_counter_dec(fs_info);
|
||||||
wait_event(fs_info->replace_wait,
|
wait_event(fs_info->replace_wait,
|
||||||
!test_bit(BTRFS_FS_STATE_DEV_REPLACING,
|
!test_bit(BTRFS_FS_STATE_DEV_REPLACING,
|
||||||
&fs_info->fs_state));
|
&fs_info->fs_state));
|
||||||
goto again;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue