[03/10] btrfs: scrub: simplify cleanup of wr_ctx in scrub_free_ctx
diff mbox

Message ID d14a9943b4c755604d3021c8af1377723667b6ad.1494954480.git.dsterba@suse.com
State New
Headers show

Commit Message

David Sterba May 16, 2017, 5:10 p.m. UTC
We don't need to take the mutex and zero out wr_cur_bio, as this is
called after the scrub finished.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/scrub.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Liu Bo May 19, 2017, 12:25 a.m. UTC | #1
On Tue, May 16, 2017 at 07:10:29PM +0200, David Sterba wrote:
> We don't need to take the mutex and zero out wr_cur_bio, as this is
> called after the scrub finished.
> 
> Signed-off-by: David Sterba <dsterba@suse.com>

Looks good.

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 43c208dff67f..333f63a59059 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -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];
@@ -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);
 }