Commit 4e2814ef authored by David Sterba's avatar David Sterba

btrfs: scrub: simplify cleanup of wr_ctx in scrub_free_ctx

We don't need to take the mutex and zero out wr_cur_bio, as this is
called after the scrub finished.
Reviewed-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e241ddeb
...@@ -639,11 +639,6 @@ static noinline_for_stack void scrub_free_ctx(struct scrub_ctx *sctx) ...@@ -639,11 +639,6 @@ static noinline_for_stack void scrub_free_ctx(struct scrub_ctx *sctx)
if (!sctx) if (!sctx)
return; 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 */ /* this can happen when scrub is cancelled */
if (sctx->curr != -1) { if (sctx->curr != -1) {
struct scrub_bio *sbio = sctx->bios[sctx->curr]; struct scrub_bio *sbio = sctx->bios[sctx->curr];
...@@ -663,6 +658,7 @@ static noinline_for_stack void scrub_free_ctx(struct scrub_ctx *sctx) ...@@ -663,6 +658,7 @@ static noinline_for_stack void scrub_free_ctx(struct scrub_ctx *sctx)
kfree(sbio); kfree(sbio);
} }
kfree(sctx->wr_ctx.wr_curr_bio);
scrub_free_csums(sctx); scrub_free_csums(sctx);
kfree(sctx); kfree(sctx);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment