Skip to content

Commit

Permalink
btrfs: use scrub_pause_on/off() to reduce code in scrub_enumerate_chu…
Browse files Browse the repository at this point in the history
…nks()

Use new intruduced scrub_pause_on/off() can make this code block
clean and more readable.

Signed-off-by: Zhao Lei <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
zhaoleidd authored and masoncl committed Aug 9, 2015
1 parent 0e22be8 commit b708ce9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3503,8 +3503,8 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,

wait_event(sctx->list_wait,
atomic_read(&sctx->bios_in_flight) == 0);
atomic_inc(&fs_info->scrubs_paused);
wake_up(&fs_info->scrub_pause_wait);

scrub_pause_on(fs_info);

/*
* must be called before we decrease @scrub_paused.
Expand All @@ -3515,11 +3515,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
atomic_read(&sctx->workers_pending) == 0);
atomic_set(&sctx->wr_ctx.flush_all_writes, 0);

mutex_lock(&fs_info->scrub_lock);
__scrub_blocked_if_needed(fs_info);
atomic_dec(&fs_info->scrubs_paused);
mutex_unlock(&fs_info->scrub_lock);
wake_up(&fs_info->scrub_pause_wait);
scrub_pause_off(fs_info);

btrfs_put_block_group(cache);
if (ret)
Expand Down

0 comments on commit b708ce9

Please sign in to comment.