Skip to content

Commit

Permalink
btrfs: scrub: simplify cleanup of wr_ctx in scrub_free_ctx
Browse files Browse the repository at this point in the history
We don't need to take the mutex and zero out wr_cur_bio, as this is
called after the scrub finished.

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed Jun 19, 2017
1 parent e241dde commit 4e2814e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,6 @@ static noinline_for_stack void scrub_free_ctx(struct scrub_ctx *sctx)
if (!sctx)
return;

mutex_lock(&sctx->wr_ctx.wr_lock);
kfree(sctx->wr_ctx.wr_curr_bio);
sctx->wr_ctx.wr_curr_bio = NULL;
mutex_unlock(&sctx->wr_ctx.wr_lock);

/* this can happen when scrub is cancelled */
if (sctx->curr != -1) {
struct scrub_bio *sbio = sctx->bios[sctx->curr];
Expand All @@ -663,6 +658,7 @@ static noinline_for_stack void scrub_free_ctx(struct scrub_ctx *sctx)
kfree(sbio);
}

kfree(sctx->wr_ctx.wr_curr_bio);
scrub_free_csums(sctx);
kfree(sctx);
}
Expand Down

0 comments on commit 4e2814e

Please sign in to comment.