From patchwork Tue Nov 6 13:33:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AF83175A for ; Tue, 6 Nov 2018 13:33:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 782002A3CE for ; Tue, 6 Nov 2018 13:33:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68E0F2A3D4; Tue, 6 Nov 2018 13:33:45 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 0D87E2A3CE for ; Tue, 6 Nov 2018 13:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388343AbeKFW65 (ORCPT ); Tue, 6 Nov 2018 17:58:57 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:37502 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388310AbeKFW65 (ORCPT ); Tue, 6 Nov 2018 17:58:57 -0500 Received: by mail-it1-f195.google.com with SMTP id j79-v6so5639738itb.2 for ; Tue, 06 Nov 2018 05:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8hHPwN4g6a4SDExe3kUgDdBPm98FRozlO3nCP6bTp2w=; b=AnWiL5xR37/te7QeJB1ltNOvAsU0SgZe+F7ArNF7uPqRfG9OsJ2MGBPP1lJfUZLX4m tTx+L1PennzTEDPoNpkEHbXIPLHExR4wyobaBLZBoI5kgEDNz7br8850flNeZ7icnqFp nAcASjEscgoxS5N3mWaevjaKg4L8sdEjJ5WMX/hkNmXGJfv5ymOBW5w/60z9dkynXpu7 CMihqHwJz8BjfNdGugwCKS6Th1YvsPNIdYFaIZRXfRmJesYH1w9aEYzlw8PcZyst4lUO xBjHfcjohRr6kRL3U12y6dOP8aux79EHeX/POQPthI02ypE9/oBx+ssQNInOuqYPSXHc x2Vg== 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; bh=8hHPwN4g6a4SDExe3kUgDdBPm98FRozlO3nCP6bTp2w=; b=K5kq6G7VXgwRvGTicHydF+90z0T8TKrNzWVQ+yzYx4Ugx/jwd29FRQjf1bapSWEaTi dP118W9dlT8ftLFr/Z8DokMDmp7nqOjcPamX7BROTzTUoifxd5eXMxolBbQL+ax4JRff v8jHa5JzVSGfeh1IIOdHvmGh5RaiWbB7s0DK6C+KCZBpVKiB6M1yJrgZqrM/D5m2iPEo Ah4g7XLB7iSfX2fOz3m+LsL4BKX6DPaxLiILBa9jM39NQyNx9OnEDWcs0R0gcEa8V1dA uzwIrou8t7s6UNDCv0HOdzjIjL+7uieTAVqrkwj4Uz6n8kNR+pRtmNBsDZ1sYqMyhjnF TDyg== X-Gm-Message-State: AGRZ1gJJV8QxqD9nQgOVgML5t6BVvN3/L29OUHnTyZIMAm6LCwVJnLIv +QXn6QWE65Uo6Mt5AK3nlBr1gg== X-Google-Smtp-Source: AJdET5eYWq7eKNDmFdB7WJOVyQ7blK4eW+6cBgW3zICvRi1HTKsdszuxLbf6A+9hAHyJrDVqKS2qqA== X-Received: by 2002:a02:22ca:: with SMTP id o193-v6mr22163997jao.83.1541511220442; Tue, 06 Nov 2018 05:33:40 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:39 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Tue, 6 Nov 2018 14:33:24 +0100 Message-Id: <20181106133330.26570-2-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg Make sure we only look up valid lba addresses on the resubmission path. If an lba is invalidated in the write buffer, that sector will be submitted to disk (as it is already mapped to a ppa), and that write might fail, resulting in a crash when trying to look up the lba in the mapping table (as the lba is marked as invalid). Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-write.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index fa8726493b39..3ddd16f47106 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -148,9 +148,11 @@ static void pblk_prepare_resubmit(struct pblk *pblk, unsigned int sentry, w_ctx = &entry->w_ctx; /* Check if the lba has been overwritten */ - ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); - if (!pblk_ppa_comp(ppa_l2p, entry->cacheline)) - w_ctx->lba = ADDR_EMPTY; + if (w_ctx->lba != ADDR_EMPTY) { + ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); + if (!pblk_ppa_comp(ppa_l2p, entry->cacheline)) + w_ctx->lba = ADDR_EMPTY; + } /* Mark up the entry as submittable again */ flags = READ_ONCE(w_ctx->flags); From patchwork Tue Nov 6 13:33:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 344F61803 for ; Tue, 6 Nov 2018 13:34:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21DCA2A3D4 for ; Tue, 6 Nov 2018 13:34:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1693E2A3E0; Tue, 6 Nov 2018 13:34:14 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 B4A5E2A3D4 for ; Tue, 6 Nov 2018 13:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388351AbeKFW67 (ORCPT ); Tue, 6 Nov 2018 17:58:59 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:36725 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388244AbeKFW66 (ORCPT ); Tue, 6 Nov 2018 17:58:58 -0500 Received: by mail-it1-f193.google.com with SMTP id w7-v6so17603627itd.1 for ; Tue, 06 Nov 2018 05:33:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cnKaeRoQQa8i6RB5+OFZeMivpWgE29k57o0EeueExqw=; b=LA6L1IQUzuO7LC97IoxUFJ778GmWPnjKnd181fn1Ini/4EZFzqI2WR7H1iV8OHKZ16 AbXJVL6bANE3obMTJwdjHkF06XuAAjZXaMmeOl98MLlBqzbEPoEcOzTpAAkXz9RKN5We 0sKl1qCIHXKlOaH16rV/6rA9LUblii89utgG5byK4b418tC3c7DgWm3p5qtcDEfEuJ38 eNMKT1qdvwYEGJEKvpxcXOv9PO6unuvguxfvm5yteT+QjbkOzNAQ4BMbFDzSpmxqz15/ OSbmI9J5Cv+Vyc3eHnV/Qs9SpmyqhPVjX/T2KUHjCjHechMin4nceQN5zbzUbGAEeyc/ f06w== 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; bh=cnKaeRoQQa8i6RB5+OFZeMivpWgE29k57o0EeueExqw=; b=MLnIJTZDbEGxRy5G/dkhDy9NyDsbJJwr7WQ4KCGRlsT6x5ieH9KIhCRBwJ+GJnr926 LJRJ0TwzoInfP3ItgBbBGu09NivLnlBTm3R2liffJuVq5lbdwTUSmEOjent5FamVc+76 jJpMOtXRzZ4gsr3Gv9wn+VWiUnNWltW4c6fXt23sewThyKm6EUn0O5gFVCXC3CC30j4K JA1Va7oj+JNNy7Q0I33fia0LOw4k6YGvqBz3g3PklaHGyRADfgyYFeYUj5CLmfpGTCIE DgsA3ZqBxoNKDMAblGzQBZn9JHqLdArBJqPsrMxiulB+lXwceadv4V5pGfQi2k4QgjhS Rp1A== X-Gm-Message-State: AGRZ1gLHICHzORVUuMUuX8B29lU7vPWchxmktMoi1UiH6RhNP3LxGatu zLsrCsJ1rSre5l3mV+Etw0jz82oYT5KddA== X-Google-Smtp-Source: AJdET5c9JGSZL+3CGhx0pmgvDHQlJdOwX0yjQFs41YDdKAFmrYMLXMOTeUw4TnidTWXXreij/iK2Jg== X-Received: by 2002:a24:59c1:: with SMTP id p184-v6mr1986559itb.93.1541511222242; Tue, 06 Nov 2018 05:33:42 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:41 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 2/7] lightnvm: pblk: account for write error sectors in emeta Date: Tue, 6 Nov 2018 14:33:25 +0100 Message-Id: <20181106133330.26570-3-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg Lines inflicted with write errors lines might be recovered if they have not been recycled after write error garbage collection. Ensure that the emeta accounting of valid lbas is correct for such lines to avoid recovery inconsistencies. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-write.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index 3ddd16f47106..750f04b8a227 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -105,14 +105,20 @@ static void pblk_complete_write(struct pblk *pblk, struct nvm_rq *rqd, } /* Map remaining sectors in chunk, starting from ppa */ -static void pblk_map_remaining(struct pblk *pblk, struct ppa_addr *ppa) +static void pblk_map_remaining(struct pblk *pblk, struct ppa_addr *ppa, + int rqd_ppas) { struct pblk_line *line; struct ppa_addr map_ppa = *ppa; + __le64 addr_empty = cpu_to_le64(ADDR_EMPTY); + __le64 *lba_list; u64 paddr; int done = 0; + int n = 0; line = pblk_ppa_to_line(pblk, *ppa); + lba_list = emeta_to_lbas(pblk, line->emeta->buf); + spin_lock(&line->lock); while (!done) { @@ -121,10 +127,17 @@ static void pblk_map_remaining(struct pblk *pblk, struct ppa_addr *ppa) if (!test_and_set_bit(paddr, line->map_bitmap)) line->left_msecs--; + if (n < rqd_ppas && lba_list[paddr] != addr_empty) + line->nr_valid_lbas--; + + lba_list[paddr] = addr_empty; + if (!test_and_set_bit(paddr, line->invalid_bitmap)) le32_add_cpu(line->vsc, -1); done = nvm_next_ppa_in_chk(pblk->dev, &map_ppa); + + n++; } line->w_err_gc->has_write_err = 1; @@ -202,7 +215,7 @@ static void pblk_submit_rec(struct work_struct *work) pblk_log_write_err(pblk, rqd); - pblk_map_remaining(pblk, ppa_list); + pblk_map_remaining(pblk, ppa_list, rqd->nr_ppas); pblk_queue_resubmit(pblk, c_ctx); pblk_up_rq(pblk, c_ctx->lun_bitmap); From patchwork Tue Nov 6 13:33:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEC9913A4 for ; Tue, 6 Nov 2018 13:34:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DB8A2A3D4 for ; Tue, 6 Nov 2018 13:34:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9194A2A3E0; Tue, 6 Nov 2018 13:34:13 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 ED12B2A3D4 for ; Tue, 6 Nov 2018 13:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388048AbeKFW70 (ORCPT ); Tue, 6 Nov 2018 17:59:26 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:39721 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388310AbeKFW67 (ORCPT ); Tue, 6 Nov 2018 17:58:59 -0500 Received: by mail-it1-f194.google.com with SMTP id m15so17567044itl.4 for ; Tue, 06 Nov 2018 05:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qJENJpltTXoiY8uShjo3N2WZ0qX/Eh5ypT7qWea+7hU=; b=rLMzL0/agsJKNS/L/h1h7zyGsSz7tDW9lkUeNff8FpJQEWEzP8vSpzZaHUhMGNs6AJ BOrcrxo60mTLp524DXyaDXt2PJbMcXa3ymqz03ZBtApRFTn21clnIegNTGc8/SE/VTwi y2+GeGytHryxTefKBblksvEkyhwDsOHsJ3QDFH+qe/y8vRVorcwLK6IE90BoWa+xgfco eh4K/XQ8iQNkAIDrI8GmTqW1YsevYG3rIGsmZ/5TjbMFaZViIVvTNcNeYBSK2uw0FudD g5CnNaKtPXwjbzdOznnW2t6+Cs1YttIM9rF1jO5U9XY4xuTA979dUqypJv2IMLQ450GD OmXA== 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; bh=qJENJpltTXoiY8uShjo3N2WZ0qX/Eh5ypT7qWea+7hU=; b=EVvNDjQCLBxNZzL4DiEDKtN0vCflnHNwgvcOHHXuiSUmr6XnjQ58cOhezERNgBuw7U J7nsKMzkaR4RTWSqKBiIqCQN0lsVPwlx+LgafXRYdsSg8Lht570lfERsbZMoq++J+as7 4djisRyrZ+Y6O6cmX+alrPM0ciJ8EIPK65Wwg0n9BFPiRp+GlWMNyugg8zU1jMYBPszZ 4H1E467AshdDvgg4Fs0tEgFeyLa+4JRIXcU276fVUZGoqXhYuryRswIy1YyPBwQ7w1ah IXNVXMnBcv9qlNez3Tv/wSG8XHlSGT2j1pQVCpMQD5gFuUQ01m+48NSar3VI6mektmG8 SxpQ== X-Gm-Message-State: AGRZ1gIEb2XdjxKtobdC147Jtemq1ZBYxzYFJDhZ4jTZtb9w1vT+vJcp FDCF2PWObpX5J3ZP2TxrwRT12wE09B9ZDw== X-Google-Smtp-Source: AJdET5en29fDS/z1RByinqHLSsA5Ztdq7CqpA9PolDH7tdhXKvCbjQNUKnCWtmJ1mkT5SiNG+VYc4g== X-Received: by 2002:a24:4e13:: with SMTP id r19-v6mr2040918ita.175.1541511223986; Tue, 06 Nov 2018 05:33:43 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:43 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 3/7] lightnvm: pblk: stop writes gracefully when running out of lines Date: Tue, 6 Nov 2018 14:33:26 +0100 Message-Id: <20181106133330.26570-4-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg If mapping fails (i.e. when running out of lines), handle the error and stop writing. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-map.c | 47 +++++++++++++++++++++-------------- drivers/lightnvm/pblk-write.c | 30 ++++++++++++++-------- drivers/lightnvm/pblk.h | 4 +-- 3 files changed, 51 insertions(+), 30 deletions(-) diff --git a/drivers/lightnvm/pblk-map.c b/drivers/lightnvm/pblk-map.c index 6dcbd44e3acb..5a3c28cce8ab 100644 --- a/drivers/lightnvm/pblk-map.c +++ b/drivers/lightnvm/pblk-map.c @@ -33,6 +33,9 @@ static int pblk_map_page_data(struct pblk *pblk, unsigned int sentry, int nr_secs = pblk->min_write_pgs; int i; + if (!line) + return -ENOSPC; + if (pblk_line_is_full(line)) { struct pblk_line *prev_line = line; @@ -42,8 +45,11 @@ static int pblk_map_page_data(struct pblk *pblk, unsigned int sentry, line = pblk_line_replace_data(pblk); pblk_line_close_meta(pblk, prev_line); - if (!line) - return -EINTR; + if (!line) { + pblk_pipeline_stop(pblk); + return -ENOSPC; + } + } emeta = line->emeta; @@ -84,7 +90,7 @@ static int pblk_map_page_data(struct pblk *pblk, unsigned int sentry, return 0; } -void pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, +int pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, unsigned long *lun_bitmap, unsigned int valid_secs, unsigned int off) { @@ -93,20 +99,22 @@ void pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, unsigned int map_secs; int min = pblk->min_write_pgs; int i; + int ret; for (i = off; i < rqd->nr_ppas; i += min) { map_secs = (i + min > valid_secs) ? (valid_secs % min) : min; - if (pblk_map_page_data(pblk, sentry + i, &ppa_list[i], - lun_bitmap, &meta_list[i], map_secs)) { - bio_put(rqd->bio); - pblk_free_rqd(pblk, rqd, PBLK_WRITE); - pblk_pipeline_stop(pblk); - } + + ret = pblk_map_page_data(pblk, sentry + i, &ppa_list[i], + lun_bitmap, &meta_list[i], map_secs); + if (ret) + return ret; } + + return 0; } /* only if erase_ppa is set, acquire erase semaphore */ -void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, +int pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, unsigned long *lun_bitmap, unsigned int valid_secs, struct ppa_addr *erase_ppa) { @@ -119,15 +127,16 @@ void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int map_secs; int min = pblk->min_write_pgs; int i, erase_lun; + int ret; + for (i = 0; i < rqd->nr_ppas; i += min) { map_secs = (i + min > valid_secs) ? (valid_secs % min) : min; - if (pblk_map_page_data(pblk, sentry + i, &ppa_list[i], - lun_bitmap, &meta_list[i], map_secs)) { - bio_put(rqd->bio); - pblk_free_rqd(pblk, rqd, PBLK_WRITE); - pblk_pipeline_stop(pblk); - } + + ret = pblk_map_page_data(pblk, sentry + i, &ppa_list[i], + lun_bitmap, &meta_list[i], map_secs); + if (ret) + return ret; erase_lun = pblk_ppa_to_pos(geo, ppa_list[i]); @@ -163,7 +172,7 @@ void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, */ e_line = pblk_line_get_erase(pblk); if (!e_line) - return; + return -ENOSPC; /* Erase blocks that are bad in this line but might not be in next */ if (unlikely(pblk_ppa_empty(*erase_ppa)) && @@ -174,7 +183,7 @@ void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, bit = find_next_bit(d_line->blk_bitmap, lm->blk_per_line, bit + 1); if (bit >= lm->blk_per_line) - return; + return 0; spin_lock(&e_line->lock); if (test_bit(bit, e_line->erase_bitmap)) { @@ -188,4 +197,6 @@ void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, *erase_ppa = pblk->luns[bit].bppa; /* set ch and lun */ erase_ppa->a.blk = e_line->id; } + + return 0; } diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index 750f04b8a227..2bf78f81862d 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -334,12 +334,13 @@ static int pblk_setup_w_rq(struct pblk *pblk, struct nvm_rq *rqd, } if (likely(!e_line || !atomic_read(&e_line->left_eblks))) - pblk_map_rq(pblk, rqd, c_ctx->sentry, lun_bitmap, valid, 0); + ret = pblk_map_rq(pblk, rqd, c_ctx->sentry, lun_bitmap, + valid, 0); else - pblk_map_erase_rq(pblk, rqd, c_ctx->sentry, lun_bitmap, + ret = pblk_map_erase_rq(pblk, rqd, c_ctx->sentry, lun_bitmap, valid, erase_ppa); - return 0; + return ret; } static int pblk_calc_secs_to_sync(struct pblk *pblk, unsigned int secs_avail, @@ -563,7 +564,7 @@ static void pblk_free_write_rqd(struct pblk *pblk, struct nvm_rq *rqd) c_ctx->nr_padded); } -static int pblk_submit_write(struct pblk *pblk) +static int pblk_submit_write(struct pblk *pblk, int *secs_left) { struct bio *bio; struct nvm_rq *rqd; @@ -572,6 +573,8 @@ static int pblk_submit_write(struct pblk *pblk) unsigned long pos; unsigned int resubmit; + *secs_left = 0; + spin_lock(&pblk->resubmit_lock); resubmit = !list_empty(&pblk->resubmit_list); spin_unlock(&pblk->resubmit_lock); @@ -601,17 +604,17 @@ static int pblk_submit_write(struct pblk *pblk) */ secs_avail = pblk_rb_read_count(&pblk->rwb); if (!secs_avail) - return 1; + return 0; secs_to_flush = pblk_rb_flush_point_count(&pblk->rwb); if (!secs_to_flush && secs_avail < pblk->min_write_pgs) - return 1; + return 0; secs_to_sync = pblk_calc_secs_to_sync(pblk, secs_avail, secs_to_flush); if (secs_to_sync > pblk->max_write_pgs) { pblk_err(pblk, "bad buffer sync calculation\n"); - return 1; + return 0; } secs_to_com = (secs_to_sync > secs_avail) ? @@ -640,6 +643,7 @@ static int pblk_submit_write(struct pblk *pblk) atomic_long_add(secs_to_sync, &pblk->sub_writes); #endif + *secs_left = 1; return 0; fail_free_bio: @@ -648,16 +652,22 @@ static int pblk_submit_write(struct pblk *pblk) bio_put(bio); pblk_free_rqd(pblk, rqd, PBLK_WRITE); - return 1; + return -EINTR; } int pblk_write_ts(void *data) { struct pblk *pblk = data; + int secs_left; + int write_failure = 0; while (!kthread_should_stop()) { - if (!pblk_submit_write(pblk)) - continue; + if (!write_failure) { + write_failure = pblk_submit_write(pblk, &secs_left); + + if (secs_left) + continue; + } set_current_state(TASK_INTERRUPTIBLE); io_schedule(); } diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 02bb2e98f8a9..f415aae600c8 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -871,10 +871,10 @@ int pblk_write_gc_to_cache(struct pblk *pblk, struct pblk_gc_rq *gc_rq); /* * pblk map */ -void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, +int pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, unsigned long *lun_bitmap, unsigned int valid_secs, struct ppa_addr *erase_ppa); -void pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, +int pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry, unsigned long *lun_bitmap, unsigned int valid_secs, unsigned int off); From patchwork Tue Nov 6 13:33:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 043B0175A for ; Tue, 6 Nov 2018 13:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E70012A3CE for ; Tue, 6 Nov 2018 13:33:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAD862A3D4; Tue, 6 Nov 2018 13:33:51 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 206132A3CE for ; Tue, 6 Nov 2018 13:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388372AbeKFW7B (ORCPT ); Tue, 6 Nov 2018 17:59:01 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:37516 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388111AbeKFW7B (ORCPT ); Tue, 6 Nov 2018 17:59:01 -0500 Received: by mail-it1-f196.google.com with SMTP id j79-v6so5640111itb.2 for ; Tue, 06 Nov 2018 05:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bvaul9mon6EWHTTGLVuoHFaIgp/GGBZICJDtZAMqK6o=; b=1RMUG+GY47T2+WiSu2dIgb6ngdkzaeA/HfvkJbVkSfPahHRScd2x/axKm2f3Okok/d aOOb0n/EEOgyDK/1KdMARXY9DpXPQ1r4szdc2goGX2b+1LiLY4kM7/yxSOt1K0CRPIJU EYJ4JoyCIgn/UQgbLgA0+OIk+YmXdmSfDG+oZsct5tx2rypW4I+V1elihH4180+r1xuy 8SCcdijprc9bZANsBgJE6xzqkCAO2wI4I6ad0PCXuJq7os44TIS0DcJu8iG0fvgD2Vmc 5kcQavSMQFSXlD5A3OxliVH+wkcpVxjqf4s8h/H6aEPKsAUcoh4N0HET4eacHnxN7LGH zxjA== 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; bh=Bvaul9mon6EWHTTGLVuoHFaIgp/GGBZICJDtZAMqK6o=; b=mvnFizeTdBFnfyt7jpHNmaun8sY2Zx1lQkj1fz1AN2iEkK7+hUib8HRUwHbijaWnDM /gbo8TqqVDh7tdQHI4MbbhsUJ5oJPBUGLHXhqR/OY/DOYOCuHoqLybQ3q/UeIZEJOsfW I1l3sFriOKO+iBF0hHCi8JbtAQ4I0dARm3fm2ktIgpRJQlYzKTuIZAMFAxxIUQVoRMNO toMzt5Ib2nC8yC+QvFNPLyB01ZOL+QFhXIfuU0mkakfwVEv/HUrIZNx6B1tlNE83J57B 73VGS5l6G4K1wtaRVjXBMdX5jxMWi0jrPaVvwaQ+f+XLBCvTPMQ6JGaV/C2x4RIqNbX1 NSpg== X-Gm-Message-State: AGRZ1gLzhZJ1+Rm3yPfYvhF3Z5shfDxOH3dm07I/1puu/KYKPv2sbIbj QT50OZTQJaX/HMoRUOy2IZHFPg== X-Google-Smtp-Source: AJdET5d3caW/skE/Kpv2j0MshCP5RQR3nNsslFybhz022CL6EIYZi/1WQm9ZLEKCpBWkt7s55P9Xrg== X-Received: by 2002:a02:4cd4:: with SMTP id q81-v6mr24442201jad.119.1541511225802; Tue, 06 Nov 2018 05:33:45 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:45 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 4/7] lightnvm: pblk: set conservative threshold for user writes Date: Tue, 6 Nov 2018 14:33:27 +0100 Message-Id: <20181106133330.26570-5-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg In a worst-case scenario (random writes), OP% of sectors in each line will be invalid, and we will then need to move data out of 100/OP% lines to free a single line. So, to prevent the possibility of running out of lines, temporarily block user writes when there is less than 100/OP% free lines. Also ensure that pblk creation does not produce instances with insufficient over provisioning. Insufficient over-provising is not a problem on real hardware, but often an issue when running QEMU simulations (with few lines). 100 lines is enough to create a sane instance with the standard (11%) over provisioning. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-init.c | 40 ++++++++++++++++++++++++++++-------- drivers/lightnvm/pblk-rl.c | 5 ++--- drivers/lightnvm/pblk.h | 12 ++++++++++- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 13822594647c..f083130d9920 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -635,7 +635,7 @@ static unsigned int calc_emeta_len(struct pblk *pblk) return (lm->emeta_len[1] + lm->emeta_len[2] + lm->emeta_len[3]); } -static void pblk_set_provision(struct pblk *pblk, long nr_free_blks) +static int pblk_set_provision(struct pblk *pblk, int nr_free_chks) { struct nvm_tgt_dev *dev = pblk->dev; struct pblk_line_mgmt *l_mg = &pblk->l_mg; @@ -643,23 +643,41 @@ static void pblk_set_provision(struct pblk *pblk, long nr_free_blks) struct nvm_geo *geo = &dev->geo; sector_t provisioned; int sec_meta, blk_meta; + int minimum; if (geo->op == NVM_TARGET_DEFAULT_OP) pblk->op = PBLK_DEFAULT_OP; else pblk->op = geo->op; - provisioned = nr_free_blks; + minimum = pblk_get_min_chks(pblk); + provisioned = nr_free_chks; provisioned *= (100 - pblk->op); sector_div(provisioned, 100); - pblk->op_blks = nr_free_blks - provisioned; + if ((nr_free_chks - provisioned) < minimum) { + if (geo->op != NVM_TARGET_DEFAULT_OP) { + pblk_err(pblk, "OP too small to create a sane instance\n"); + return -EINTR; + } + + /* If the user did not specify an OP value, and PBLK_DEFAULT_OP + * is not enough, calculate and set sane value + */ + + provisioned = nr_free_chks - minimum; + pblk->op = (100 * minimum) / nr_free_chks; + pblk_info(pblk, "Default OP insufficient, adjusting OP to %d\n", + pblk->op); + } + + pblk->op_blks = nr_free_chks - provisioned; /* Internally pblk manages all free blocks, but all calculations based * on user capacity consider only provisioned blocks */ - pblk->rl.total_blocks = nr_free_blks; - pblk->rl.nr_secs = nr_free_blks * geo->clba; + pblk->rl.total_blocks = nr_free_chks; + pblk->rl.nr_secs = nr_free_chks * geo->clba; /* Consider sectors used for metadata */ sec_meta = (lm->smeta_sec + lm->emeta_sec[0]) * l_mg->nr_free_lines; @@ -667,8 +685,10 @@ static void pblk_set_provision(struct pblk *pblk, long nr_free_blks) pblk->capacity = (provisioned - blk_meta) * geo->clba; - atomic_set(&pblk->rl.free_blocks, nr_free_blks); - atomic_set(&pblk->rl.free_user_blocks, nr_free_blks); + atomic_set(&pblk->rl.free_blocks, nr_free_chks); + atomic_set(&pblk->rl.free_user_blocks, nr_free_chks); + + return 0; } static int pblk_setup_line_meta_chk(struct pblk *pblk, struct pblk_line *line, @@ -984,7 +1004,7 @@ static int pblk_lines_init(struct pblk *pblk) struct pblk_line_mgmt *l_mg = &pblk->l_mg; struct pblk_line *line; void *chunk_meta; - long nr_free_chks = 0; + int nr_free_chks = 0; int i, ret; ret = pblk_line_meta_init(pblk); @@ -1031,7 +1051,9 @@ static int pblk_lines_init(struct pblk *pblk) goto fail_free_lines; } - pblk_set_provision(pblk, nr_free_chks); + ret = pblk_set_provision(pblk, nr_free_chks); + if (ret) + goto fail_free_lines; vfree(chunk_meta); return 0; diff --git a/drivers/lightnvm/pblk-rl.c b/drivers/lightnvm/pblk-rl.c index db55a1c89997..76116d5f78e4 100644 --- a/drivers/lightnvm/pblk-rl.c +++ b/drivers/lightnvm/pblk-rl.c @@ -214,11 +214,10 @@ void pblk_rl_init(struct pblk_rl *rl, int budget) struct nvm_geo *geo = &dev->geo; struct pblk_line_mgmt *l_mg = &pblk->l_mg; struct pblk_line_meta *lm = &pblk->lm; - int min_blocks = lm->blk_per_line * PBLK_GC_RSV_LINE; int sec_meta, blk_meta; - unsigned int rb_windows; + /* Consider sectors used for metadata */ sec_meta = (lm->smeta_sec + lm->emeta_sec[0]) * l_mg->nr_free_lines; blk_meta = DIV_ROUND_UP(sec_meta, geo->clba); @@ -226,7 +225,7 @@ void pblk_rl_init(struct pblk_rl *rl, int budget) rl->high = pblk->op_blks - blk_meta - lm->blk_per_line; rl->high_pw = get_count_order(rl->high); - rl->rsv_blocks = min_blocks; + rl->rsv_blocks = pblk_get_min_chks(pblk); /* This will always be a power-of-2 */ rb_windows = budget / NVM_MAX_VLBA; diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index f415aae600c8..e5b88a25d4d6 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -905,7 +905,6 @@ int pblk_recov_check_emeta(struct pblk *pblk, struct line_emeta *emeta); #define PBLK_GC_MAX_READERS 8 /* Max number of outstanding GC reader jobs */ #define PBLK_GC_RQ_QD 128 /* Queue depth for inflight GC requests */ #define PBLK_GC_L_QD 4 /* Queue depth for inflight GC lines */ -#define PBLK_GC_RSV_LINE 1 /* Reserved lines for GC */ int pblk_gc_init(struct pblk *pblk); void pblk_gc_exit(struct pblk *pblk, bool graceful); @@ -1370,4 +1369,15 @@ static inline char *pblk_disk_name(struct pblk *pblk) return disk->disk_name; } + +static inline unsigned int pblk_get_min_chks(struct pblk *pblk) +{ + struct pblk_line_meta *lm = &pblk->lm; + /* In a worst-case scenario every line will have OP invalid sectors. + * We will then need a minimum of 1/OP lines to free up a single line + */ + + return DIV_ROUND_UP(100, pblk->op) * lm->blk_per_line; + +} #endif /* PBLK_H_ */ From patchwork Tue Nov 6 13:33:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 439DD175A for ; Tue, 6 Nov 2018 13:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 340442A3DF for ; Tue, 6 Nov 2018 13:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 287772A3E2; Tue, 6 Nov 2018 13:34:07 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 B71212A3DF for ; Tue, 6 Nov 2018 13:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388408AbeKFW7D (ORCPT ); Tue, 6 Nov 2018 17:59:03 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:37517 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388110AbeKFW7D (ORCPT ); Tue, 6 Nov 2018 17:59:03 -0500 Received: by mail-it1-f194.google.com with SMTP id j79-v6so5640218itb.2 for ; Tue, 06 Nov 2018 05:33:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2I81Vy/QYABDh4xcEesSgnRV1G45mEQK0f/pFSOiyt0=; b=wXFUZChoukWVTsdsKwU4Ux6xId+xMR/Ny7DTkaDuIENqe+O0iYINOXjB1myzZV3diT ikSr0iBmBedcTV6UI/ZqN1rXkBznW+2nv6R1BP6PYsRtFG+1wLd8jHy9s2Ns5/bdLPOn +g4XWTRRQ1O3sKSU7K0/NMXOYWvnaymdtKS0CmUYrCQtxwrHMZNtKxsmbfQHtB9Pgwwv 8l0pscStEUPJud8o66KHzQxJTSPYgiSmNAjRPYGvixAoIQWNTqbEvP2k7WF3jasAsJDT O5/DSMPSGMLNVjk8cv8+TWUGRszcJIi6V5XsTxzkAsYH5RHb1qPmlhuaEBbdqV9SNV1Q UMIA== 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; bh=2I81Vy/QYABDh4xcEesSgnRV1G45mEQK0f/pFSOiyt0=; b=aOdxc3j4CTCqJFNbBhRPffEDaWDTgNsfKacmtaPDRiRraqGXvl2T8qLd/XNNcrE+3s VDFr8Da8fOKYY44aV93vV7eZrBLQiVVTm/biplo/P8WCn8h8H/P6w4Gxl+6bXkiBpDnJ 6Ko/Alhhs/8hGsg7Sksln3DjKfksXxepLwhWmDwzrzITaZz7Hg4B9OdeyQ5GJ9ubgdGQ w60K2CDIsaML0F2zr3LrdIdfPIcjV2LTUVaZlParj8N8SkogCyZgXG3BLAjQ/SJM1OhF zF/XhMWfLbWSPSMHHRDGpObYsOHcI1srgkO+w197grpECPlXNSWB795/N5JQwfoyuhxe U6Xw== X-Gm-Message-State: AGRZ1gJCHTBr++BCBRIYxiGRBbhMsqsOwZWpuHisKZOoboQwqSKn6lNd rBEnS6eTJkzckQlDTeZ3ytAHTRjvT9T5Vw== X-Google-Smtp-Source: AJdET5epKgrxR673IGTnDxeQF0wui91v6e8Hslifz5IHcjXNN14pWVEofEZIJHlmQAqGci1s4+E3fQ== X-Received: by 2002:a24:8784:: with SMTP id f126-v6mr1908911ite.28.1541511227530; Tue, 06 Nov 2018 05:33:47 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:47 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 5/7] lightnvm: pblk: remove unused macro Date: Tue, 6 Nov 2018 14:33:28 +0100 Message-Id: <20181106133330.26570-6-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg ADDR_POOL_SIZE is not used anymore, so remove the define. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-init.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index f083130d9920..3219f335fce9 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -207,9 +207,6 @@ static int pblk_rwb_init(struct pblk *pblk) return pblk_rb_init(&pblk->rwb, buffer_size, threshold, geo->csecs); } -/* Minimum pages needed within a lun */ -#define ADDR_POOL_SIZE 64 - static int pblk_set_addrf_12(struct pblk *pblk, struct nvm_geo *geo, struct nvm_addrf_12 *dst) { From patchwork Tue Nov 6 13:33:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F7DD13A4 for ; Tue, 6 Nov 2018 13:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 802FD2A3CE for ; Tue, 6 Nov 2018 13:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74B522A3D4; Tue, 6 Nov 2018 13:33:52 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 2BB212A3CE for ; Tue, 6 Nov 2018 13:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388399AbeKFW7F (ORCPT ); Tue, 6 Nov 2018 17:59:05 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:39942 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388419AbeKFW7E (ORCPT ); Tue, 6 Nov 2018 17:59:04 -0500 Received: by mail-it1-f194.google.com with SMTP id e11so14300036itl.5 for ; Tue, 06 Nov 2018 05:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gL8Qq0VcYDDfyeqaS1taQ6NLTbooICca+pVmxUz1Mwk=; b=lgRahNFTqvHcWN3GqBAzJEm3bTa9ZHnOoY+UG+kPmA2Hs5tTh4BMGGmM8i0kEjUgIO Hlr7Cs0ayZQ4S5K5MMB7mXHbjXHxU/31WTJmd4nrgRCWXC+1MG5PG5MCh5xBO2zroyXD N4TvHuH3Q5irbZefgTJN/vG9+5Y8OzTfn1GWjLXA4FP50a2l3TFzJQEKtE+rQHEgS9/I ZFOo/AfDmbr9Wq1D0JPc558rnE+oyNuGtLLdwwfF7Ca9VK5+A4OJjSeTqxRVlm2Y2gDh PUwIK/DT5vbRsHs2Y80QfN0l8JU2Nf3hvyz8phw5GAU+eJXhql7TJGb4rzzSP1OLQRyF IEdQ== 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; bh=gL8Qq0VcYDDfyeqaS1taQ6NLTbooICca+pVmxUz1Mwk=; b=WdQCtipOOD0azp/zOFFSjypRoBbQ19GDt1GQCydw22L6moie4E1t+1uRkLXLpmJS42 ix2Sb4KvTzrNIpr+aPAfJ01byCZvMaGI12y3lFgr7onHAgBfSy97caR36SYpjNTNZgJy iMqRNm1NAQgM04ddoA+QMZuTlIWfROxy6AWd1z9QsM/COnquNLZUYd2Jn7mGZYyxJ1NV Eysb+CQkmjRkUaGqG8guTGiF8xccszQ+uNAUDVtfLXpZe44vA5z0fl7o2Gn8i/y8U5MK srNG3KgJ2IJXDolm4DbApZtCf+FhCE7d1PBPRQEsuFzsyFiHVk2eL/MjNVfg7/80egYL 1OQQ== X-Gm-Message-State: AGRZ1gIewBt+SiJX8evLeWOe2Oftrd9kr98J59sDo3OZEWEA9hdhgCmt g9U/8Z745U79AG4C2ztpXxBaGg== X-Google-Smtp-Source: AJdET5d/TunfhIrWQ+iW3biEouvoczOl1RfiAnxRayvAZwihEy5GOYyP/ipB+qTOAop6iyuUJP7RQA== X-Received: by 2002:a02:8a74:: with SMTP id e49-v6mr24954950jal.81.1541511229274; Tue, 06 Nov 2018 05:33:49 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:48 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 6/7] lightnvm: pblk: fix pblk_lines_init error handling path Date: Tue, 6 Nov 2018 14:33:29 +0100 Message-Id: <20181106133330.26570-7-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg The chunk metadata is allocated with vmalloc, so we need to use vfree to free it. Fixes: 090ee26fd512 ("lightnvm: use internal allocation for chunk log page") Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 3219f335fce9..0e37104de596 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -1060,7 +1060,7 @@ static int pblk_lines_init(struct pblk *pblk) pblk_line_meta_free(l_mg, &pblk->lines[i]); kfree(pblk->lines); fail_free_chunk_meta: - kfree(chunk_meta); + vfree(chunk_meta); fail_free_luns: kfree(pblk->luns); fail_free_meta: From patchwork Tue Nov 6 13:33:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10670421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C817E175A for ; Tue, 6 Nov 2018 13:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B89052A3CE for ; Tue, 6 Nov 2018 13:33:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACD932A3D4; Tue, 6 Nov 2018 13:33:53 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 660C22A3CE for ; Tue, 6 Nov 2018 13:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388426AbeKFW7G (ORCPT ); Tue, 6 Nov 2018 17:59:06 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:55445 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388424AbeKFW7F (ORCPT ); Tue, 6 Nov 2018 17:59:05 -0500 Received: by mail-it1-f195.google.com with SMTP id b7-v6so17770107itd.5 for ; Tue, 06 Nov 2018 05:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=im8NeFbgzA6SbKu0U4oV8gAJiI5O2suBuQF856AHMAw=; b=kj9Zxz7GZStsQLPH3kPSTiGkZXstVtaXHmqS9oo0vKZ79ZVFZ9zAGgQgdGWLGQedVO 9uri9OrQ5MxMyYcupktu8whM4qeV96s2qjeabX+sm/hGPpIC6UBo7B5weCk+yW8ySNds YbpCR0cBfgvior1wKBWRajXIm7sY+7BSB3blDSwrPGxYPSCprQCaZEhOU0JMzaSAXUEy apiQPPsyCTP6i8PojxYAdunsuRmN2S4WCk0oBGAeHGkbS8YFA3zg6TNnS/U1iQTvhtS0 lkTvV+LF1rUzmCVjr/jEAqoTHu5PvEhQ5zR6DDZueo7KSY/VNj9E/V6dOmo1VHYUsh/e uA7A== 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; bh=im8NeFbgzA6SbKu0U4oV8gAJiI5O2suBuQF856AHMAw=; b=AousOn/09d45Cm0dzckZE/NPlJd6oULk/eb89WhkE+LKvmD3o0i/bDrMp4k3ewRMvU Up4A5JDe8ymFweKwW6fg2x9/CDrjRwoiFaUrcTV8EfCWZ8uh86xwbvZtc8o5NemRAk31 WYGnc1qDCCNna35kelxk+p1+Cc0fOAbCBAKmrAfTAUCaZPi+0SIjdrj7t2YJW7hL2otK wCdZvdrOYpVZ+jVosMrfzxL9HPGiNBlMRklAuTGDyyeWkoPN4xlsIXBgHP6fMtuxpmDA KI+jf8KG7fxXzFU3ZxZJPYBaJ8Yt/dk5OBK0u6Rzz5XQ3TZlwFe5JoJILLDnqZFuvCMF 6xjA== X-Gm-Message-State: AGRZ1gKEBkjoQqmD1wcdLtl4C2PjK9kaPTDRulWzGQy2Np/Ryk8hyfQ/ ebDFpkTa478GgO/pNXnHHUuCYAUhWtvfuA== X-Google-Smtp-Source: AJdET5eetHOQVtYnyLotcA/5StnVthdrsjDJWEwnklfzT8GX/EQltKtKjmOkiQppjmkh935c6U4z9g== X-Received: by 2002:a24:81d7:: with SMTP id q206-v6mr1764195itd.94.1541511230985; Tue, 06 Nov 2018 05:33:50 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id u132-v6sm897282itb.21.2018.11.06.05.33.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:50 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 7/7] lightnvm: pblk: remove dead code in pblk_recov_l2p Date: Tue, 6 Nov 2018 14:33:30 +0100 Message-Id: <20181106133330.26570-8-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> 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: Hans Holmberg Remove the call to pblk_line_replace_data as it returns directly because we have not set l_mg->data_next yet. Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-recovery.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 0fbd30e0a587..416d9840544b 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -805,7 +805,6 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk) WARN_ON_ONCE(!test_and_clear_bit(meta_line, &l_mg->meta_bitmap)); spin_unlock(&l_mg->free_lock); - pblk_line_replace_data(pblk); } else { spin_lock(&l_mg->free_lock); /* Allocate next line for preparation */