From patchwork Tue May 16 17:10:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 9729381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 462EC60386 for ; Tue, 16 May 2017 17:11:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30BC6286B8 for ; Tue, 16 May 2017 17:11:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25E33286CD; Tue, 16 May 2017 17:11:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B17B7286B8 for ; Tue, 16 May 2017 17:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752610AbdEPRLj (ORCPT ); Tue, 16 May 2017 13:11:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:42874 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752450AbdEPRLh (ORCPT ); Tue, 16 May 2017 13:11:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4EF79AD23 for ; Tue, 16 May 2017 17:11:26 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id D7656DA80E; Tue, 16 May 2017 19:10:29 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 03/10] btrfs: scrub: simplify cleanup of wr_ctx in scrub_free_ctx Date: Tue, 16 May 2017 19:10:29 +0200 Message-Id: X-Mailer: git-send-email 2.12.0 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Liu Bo --- fs/btrfs/scrub.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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); }