From patchwork Wed Dec 20 17:22:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10125989 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 498FF60245 for ; Wed, 20 Dec 2017 17:23:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311A028A18 for ; Wed, 20 Dec 2017 17:23:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FF8029627; Wed, 20 Dec 2017 17:23:09 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 D187D28A18 for ; Wed, 20 Dec 2017 17:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756034AbdLTRXH (ORCPT ); Wed, 20 Dec 2017 12:23:07 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40141 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756013AbdLTRWg (ORCPT ); Wed, 20 Dec 2017 12:22:36 -0500 Received: by mail-wm0-f67.google.com with SMTP id f206so11105957wmf.5 for ; Wed, 20 Dec 2017 09:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m6GaGYy9ggsn1qu5y3Eyy64kzIH+oiarBAibS8mPfQs=; b=OI4ra+ticmmhOzKs/eW0xYSXopxXP2EnCx5xqF4fRapskkMeWftFFfTx/8qNIF6QC8 wfK3FXHcv4A1VcrZrXW1YJsMeYnP6tKbKfhhWbjPo7tysJ8WOBLdyXFkTb2aQwOsIyKZ TBkceV/C7WUge1P+h+SszS6s+zeWCi5caqy1o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m6GaGYy9ggsn1qu5y3Eyy64kzIH+oiarBAibS8mPfQs=; b=c9t6fLJyWGCcxQuGV0AK/8c/0/2oMGGeL4zx+hRmAo85D3859Ysy8OzCqnN89Groit Iv6tJC31cZESb9KAPGNyYb0vfEfWkhmrnwQ4R0E54KSS1qryNao8KM4cy89OXjVskQ9k 7YzE8+fVlqMJvo7Mnzl9RGsAqTfilCQvLe2u55Bqm4nutFmx/38yRcbuBNrmo6jkkheK gDi3NFiKpy/71GoKDYRm4GBGYrwHVGhNlA2YxzECI07QH7hm5Hw+ZtkbAn49hw2EYNvm zPaGraYZ07/iROFUk3ki12DZtVg7R9voeS+uaUxDqI8DLaP37y9wvCzV1pjatNsbnjf1 +wnA== X-Gm-Message-State: AKGB3mK3cE2BQzhzqDe9VBcriCjrhSz1BtGM6ny6L4w7Dbjtr5pRaV9G F/P4Jh9w8yMiWwZ+APDDYD/zYWG9 X-Google-Smtp-Source: ACJfBotjhh5hBjG7MkeRImMjJ6XrYNLScTifWdmb+lXNsTY08BYnuufnY5/oVgfZo59W/YyTA57nRA== X-Received: by 10.80.169.123 with SMTP id m56mr6356827edc.126.1513790555512; Wed, 20 Dec 2017 09:22:35 -0800 (PST) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id 26sm15339120eds.67.2017.12.20.09.22.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:22:35 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 22/25] lightnvm: pblk: free write buffer on init failure Date: Wed, 20 Dec 2017 18:22:02 +0100 Message-Id: <20171220172205.26464-23-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171220172205.26464-1-m@bjorling.me> References: <20171220172205.26464-1-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González Refactor the way we free the write buffer to ensure that all entries get freed in case of an error on the init sequence. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 3150b8f..d603b94 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -355,6 +355,8 @@ static void pblk_core_free(struct pblk *pblk) mempool_destroy(pblk->e_rq_pool); mempool_destroy(pblk->w_rq_pool); + pblk_rwb_free(pblk); + pblk_free_global_caches(pblk); } @@ -931,7 +933,6 @@ static void pblk_tear_down(struct pblk *pblk) pblk_pipeline_stop(pblk); pblk_writer_stop(pblk); pblk_rb_sync_l2p(&pblk->rwb); - pblk_rwb_free(pblk); pblk_rl_free(&pblk->rl); pr_debug("pblk: consistent tear down\n");