From patchwork Mon Nov 5 12:26:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668117 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 6CDAB1751 for ; Mon, 5 Nov 2018 12:26:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E41E294D0 for ; Mon, 5 Nov 2018 12:26:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52188294D9; Mon, 5 Nov 2018 12:26:48 +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 014BA294D0 for ; Mon, 5 Nov 2018 12:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729438AbeKEVqQ (ORCPT ); Mon, 5 Nov 2018 16:46:16 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38763 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728970AbeKEVqP (ORCPT ); Mon, 5 Nov 2018 16:46:15 -0500 Received: by mail-ed1-f66.google.com with SMTP id a2-v6so2729671edi.5 for ; Mon, 05 Nov 2018 04:26: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=aYpv+KMDP/i822XuAPfSWo4UcCeaEVbMte2++xZ1ARE=; b=p/isB/ZHmM9OQxSnxxS1ej9Mp6k0hjsDL/Tud1uZ9nyX8JMCUZpm/vXugixU0PMXTi DbHFlGQO4/MNFp6T1+OvYojsslJKZoSpBCm9y3Z0etdGlYesWL029b19ooeAyJw7WGKt TkSH7GXo023B4WxdaxqhO2+QLTPNqEoBlLn/MUVkUTpZxRP+qMnKETsfDLT+6WJgFTRa Khvou/FQFvwBG/h1CPoPkPlJW8SjAIwms0JhDZ8LwwvKA/hvJ60seth0TRjgavVLrnw+ driQEnCo/zJlUlg7OjT5rMiMvsueJ1fs95TKSbhhenuWpu6/D8rqKM1dSOQPcc9ON71A ccVQ== 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=aYpv+KMDP/i822XuAPfSWo4UcCeaEVbMte2++xZ1ARE=; b=K6PWJNM3CIXY3ph9UN4r6LeihW4i3w1WDSgRle8grlUb45hf+b15MVfhwLUFzUDZ8n SkqlYsQEwC64arBWSUY4xezPSm3wc4rxsHMdom/nXlFJu4Fo+3ljfLLVxTSCRa93lZfT ykrIF4L3uANox0sPCfTP9A1bzfGZ/Tm1l2YKyis4ah4E5ace9MA6xlW+N8U1rpVXBONW LVsURvJLfVULOedFkyKmNf+Ugi/NeaTpECKZWPHbQ1kVdkwzLHEE0LiWjbk/cdHCRKpt 9OWuJNRD5gJb4NywtAqeACdXiemr8eWpyOqwwT6MDgU9AX4bHQOtYRjWgs6bmQK5YvFg oQtw== X-Gm-Message-State: AGRZ1gI1vD/7jViwSViAk9ja2C8jg1bjvdkazwmpQsB2XI54Ng/o9LBa +JF+pG9L4gCEtSwqPxoFbJ5xHA== X-Google-Smtp-Source: AJdET5fKGtnX4gSVPfJFPe0zFSTaXMMEsPVuKSeqk18G5as0jvaeQ+Pc/GxW+WPwoJ3avwN1WiMuXQ== X-Received: by 2002:a17:906:c7c9:: with SMTP id dc9-v6mr13584726ejb.232.1541420803901; Mon, 05 Nov 2018 04:26: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 9-v6sm7046056ejw.46.2018.11.05.04.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:43 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Mon, 5 Nov 2018 13:26:04 +0100 Message-Id: <20181105122610.1555-2-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 Mon Nov 5 12:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668129 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 49B0A1751 for ; Mon, 5 Nov 2018 12:27:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AD95294D9 for ; Mon, 5 Nov 2018 12:27:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F3FE294E2; Mon, 5 Nov 2018 12:27:23 +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 C6709294E1 for ; Mon, 5 Nov 2018 12:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728961AbeKEVqS (ORCPT ); Mon, 5 Nov 2018 16:46:18 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42012 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729402AbeKEVqR (ORCPT ); Mon, 5 Nov 2018 16:46:17 -0500 Received: by mail-ed1-f65.google.com with SMTP id h21-v6so6862585edq.9 for ; Mon, 05 Nov 2018 04:26:45 -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=te6Hid59cIIWKRRQciZfIZ1h7Cv6AXnsglt3poBcaSqT2WaDwyp8N5qxRwMBsSSl3Y ny/nTAL66fQ54S//nu8XROrYTQjQPtUmQXfKx6pCmq0R4nFez80ld4//OJd0ZFFGL0en fkRXfFxM7j0hhLFp7UW9HzXXBpSbODwUwQsetLMukMJ+xY1sCWkKOdqi21wdGXOEDomL /p/mez+f3j3JEEyzyM/MSzBmrp4PT5GFOGxNnlAc0I5KxiEiNepNxQ3ynkEX3cnGDl8N fwt5+GWY8pfQLq+Hqh1wAgi/nMIcbxo5jw0NWT7L9bwKkVRQ9lEJiSeyubq2LZspnMRt awKQ== 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=XOHNWrnDAt51Hvx+oL80p+SqD7c3F1oVSLyRX1UAO78QKf+QRRXSn19WVN2piNOkqN 31IXQlPhxHsyCKgT1l4MwsUaxQ7MVVkSQuVIE0oAHuwumT5WWSBe9uPlMNY/kU1nfqNG RPUcdsOG9NYFwh4y+h3waYcVt1WwMMj6l73UwCNaq91ypQSX9DDoL6dKFLjd5o94jZWK gH13LO8hs+TBXsCrTdHuJ8RtuprlCznRHyMBcBghzkKx4SEfebRuM/Mc5+pNm5OimClm al6DzRg//3K3bzSxuxYPmn5EqxjglTqE5ZrNK7I+l0ZyBy3bB0j6B23wF9VuE7FaGEWd iLag== X-Gm-Message-State: AGRZ1gIbrR+y+ihYt6uCx2baKyQUKsf98rkju1Qgg4T52eCPx9oBfyBp N+bm058LnBDQ6IGJnb8W7nM4hg== X-Google-Smtp-Source: AJdET5ej0cCSl8cvEGawBuv/2L9zrSC6apK1d/eaAxf4ucQS8Q2vCY7HpQQpBaOjsG6HOw75wYhvVw== X-Received: by 2002:a17:906:5387:: with SMTP id g7-v6mr14054240ejo.174.1541420804987; Mon, 05 Nov 2018 04:26:44 -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 9-v6sm7046056ejw.46.2018.11.05.04.26.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:44 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 2/7] lightnvm: pblk: account for write error sectors in emeta Date: Mon, 5 Nov 2018 13:26:05 +0100 Message-Id: <20181105122610.1555-3-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 Mon Nov 5 12:26:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668127 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 1A9C71709 for ; Mon, 5 Nov 2018 12:27:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B7CC294D9 for ; Mon, 5 Nov 2018 12:27:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3FC9294E3; Mon, 5 Nov 2018 12:27:22 +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 59489294D9 for ; Mon, 5 Nov 2018 12:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729663AbeKEVqv (ORCPT ); Mon, 5 Nov 2018 16:46:51 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37339 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729505AbeKEVqS (ORCPT ); Mon, 5 Nov 2018 16:46:18 -0500 Received: by mail-ed1-f68.google.com with SMTP id y10-v6so813546edr.4 for ; Mon, 05 Nov 2018 04:26: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=qJENJpltTXoiY8uShjo3N2WZ0qX/Eh5ypT7qWea+7hU=; b=nOTPyZhvHlRZZJSqC/inx6HuM5Y4hEXarqJ/WeXDj1PbOsxqyGK8tepJEDpADpeMD0 +FnbeTJfnngKgyv9yK/RN+1z9BPOhNFnhNDqjALIxKFFyS44ijofaIQWSD0rYu9jI/9z xas7ToYlwiXidA9WpMbMtbu6mYJ3UgB6RqNKnAGh+HPJBgh+yUS2j0JK91a3T0ZkEk7h V4drlT9IcBgPtWxw/tGOMgcSF9V69howmCirMbd+WgVDMuYxqy6A4Lm3xF9xRVNSlgTL /Q3/VkXtnKF2mbcHFYjprUFORjhECBB/kzt0GzSHGdK4J2DTxtlOoW42kRf/acmpv9ZJ /P5A== 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=Wu7H5TYwXT2oDwjkHRFN08agi3xzlD3lpVdwgrGxm6T84eKwl8NtbDM+C110wZ8BFp q06e9a7JTUdG12VAflPBlvnBvAbIZfBzgrn04q4u+mirDifGm9+krleLoYVthh8LHj5l mRNbQAszRFqaoB7Vo6jYToZBUyNxywgAaLkR1ra0+nQrH/+g8B/1uUCmdZGIZA7hDwSm oE44AX64ioVpTjodY1VBd3opZ6vz/rs/QDNVtMiIuAc3bvYlRbxorY78YaqPPFLcNZ+F HVLWfGHi+jPkhRuG5XFlU3TyAdA0pjPp+a0DYx3ShuUtb5i0CNb3TA2MylihkAPhHyc7 ruYw== X-Gm-Message-State: AGRZ1gI6MBQbmLIYrhu3BjZG70J9QO7OlO6SMXeYu7iQsai6dI552TuX PgDE6/45KwgZVSqRCgQeuR82WQ== X-Google-Smtp-Source: AJdET5eM63YBhgP3FtkdAWJXWPpZJUy8vfpfrUUjLwHN7bS/CF5q6iWNKEOOPreCWkh4x0rdYl5Wtg== X-Received: by 2002:a17:906:b243:: with SMTP id ce3-v6mr13728220ejb.87.1541420806230; Mon, 05 Nov 2018 04:26:46 -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 9-v6sm7046056ejw.46.2018.11.05.04.26.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:45 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 3/7] lightnvm: pblk: stop writes gracefully when running out of lines Date: Mon, 5 Nov 2018 13:26:06 +0100 Message-Id: <20181105122610.1555-4-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 Mon Nov 5 12:26:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668125 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 272D41751 for ; Mon, 5 Nov 2018 12:27:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19A2B294D0 for ; Mon, 5 Nov 2018 12:27:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CFB5294DF; Mon, 5 Nov 2018 12:27:19 +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 6D317294D0 for ; Mon, 5 Nov 2018 12:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729675AbeKEVqU (ORCPT ); Mon, 5 Nov 2018 16:46:20 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:41345 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729655AbeKEVqT (ORCPT ); Mon, 5 Nov 2018 16:46:19 -0500 Received: by mail-ed1-f65.google.com with SMTP id c25-v6so7289689edt.8 for ; Mon, 05 Nov 2018 04:26:48 -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=BbATI04AvfDQt/uj9GFlTM1b1yy2fJbmCnQhKQ8O89E=; b=hrsWnlpzLADYm8HXc98CjIiwk5viUxxDRWOEWKys52elzJ1HH7ZSUMw6F7RA6HWnPj gVV4IvZfomvz/FJRu38Qwtz4saT3hEvTYaEZMVzhDZ3HwdZaYRB/qV8tSkXEAZsZ8P0o 0/J38DOv1Ocd+BeJAAu/7Xn9FItlAFjGuMir/3hs7+e5ovIQpqSI3EzZQRQ3cs6Brl7w TPnw5oqizScJJFLKLY5SFdosKVllVmi2/zzbOsSelGkAmBMBAYWkJ88OUsSdlmCW4cVY X16CseHaeiCmbFQsrA88wyIHKS4w6aJT6PBHYgjymKNmdih5vV5KIDbf/nPppe1YxEPH 8G5g== 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=BbATI04AvfDQt/uj9GFlTM1b1yy2fJbmCnQhKQ8O89E=; b=BpLWg0tgTKRPEkSLchFHxsO0ciCH4zC3H8WAUm76LxXUxVQArWUCesnnKYuNPvmaFl v82pZVLysq+pSRW12rOf27zS29SC1mYXGZFUdXmZkLmKB3qmoCyQKSNeQB+gG7FpCivY SzsvsjspPTIKDnLZs4xpRg3hxhWnW3ncue80LYH0eHYJLgrmNhm7bXOCXEy9xK6IHmUL iaQ/9rQwVVclSZDhRbjOWc7tXYKm6tcps5++9Eep2mBiT37q+nhnL0ubh26yflr7b/ni tXcsgFiT+KVKy7fD2YzxXmOS51H52yd4sbrBKhPvPVtlgOUkxB9GaUyUZDQtAnwqmg7N uwhw== X-Gm-Message-State: AGRZ1gKoY+sDUmuVoSy5eWDwMw0qpZ8i+0TAsRxxN98ZW352gX7tXEjS cTOtJPfoeI+Ea68EGl2meNNA+A== X-Google-Smtp-Source: AJdET5eFrkGZFp6sPVBH11P3mGd1XckzlWWTR4Qht4Pk9jYk9Mtio8X6RRZ6BDCSpd1EQxCffsETNQ== X-Received: by 2002:a17:906:3b8c:: with SMTP id u12-v6mr14164181ejf.143.1541420807543; Mon, 05 Nov 2018 04:26: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 9-v6sm7046056ejw.46.2018.11.05.04.26.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:46 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 4/7] lightnvm: pblk: set conservative threshold for user writes Date: Mon, 5 Nov 2018 13:26:07 +0100 Message-Id: <20181105122610.1555-5-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 | 43 ++++++++++++++++++++++++------------ drivers/lightnvm/pblk-rl.c | 5 ++--- drivers/lightnvm/pblk.h | 12 +++++++++- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 13822594647c..8b89bb26b0f1 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -635,13 +635,13 @@ 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, long nr_free_chks) { struct nvm_tgt_dev *dev = pblk->dev; struct pblk_line_mgmt *l_mg = &pblk->l_mg; struct pblk_line_meta *lm = &pblk->lm; struct nvm_geo *geo = &dev->geo; - sector_t provisioned; + sector_t provisioned, minimum; int sec_meta, blk_meta; if (geo->op == NVM_TARGET_DEFAULT_OP) @@ -649,17 +649,34 @@ static void pblk_set_provision(struct pblk *pblk, long nr_free_blks) 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 +684,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, @@ -1025,13 +1044,9 @@ static int pblk_lines_init(struct pblk *pblk) line->state); } - if (!nr_free_chks) { - pblk_err(pblk, "too many bad blocks prevent for sane instance\n"); - ret = -EINTR; + ret = pblk_set_provision(pblk, nr_free_chks); + if (ret) goto fail_free_lines; - } - - pblk_set_provision(pblk, nr_free_chks); 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 Mon Nov 5 12:26:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668123 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 94B831709 for ; Mon, 5 Nov 2018 12:27:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8593E294D0 for ; Mon, 5 Nov 2018 12:27:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77B64294D9; Mon, 5 Nov 2018 12:27: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 75A0D294D0 for ; Mon, 5 Nov 2018 12:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728870AbeKEVqU (ORCPT ); Mon, 5 Nov 2018 16:46:20 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:35167 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729657AbeKEVqU (ORCPT ); Mon, 5 Nov 2018 16:46:20 -0500 Received: by mail-ed1-f68.google.com with SMTP id d6-v6so7323796edi.2 for ; Mon, 05 Nov 2018 04:26: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=teEQfAz1c6m6rCPJfgLRxoSrnS8LNHIA5afev5lUxns=; b=LoPTsKQsAP+zS++JqKVLPkejyAxyOr3CzGAE/hrzpPdH1tTdfOqoJcqbNjTZBQ+r0j GX//652zX5wqDxlmpWgHMjdWU85TefPhXh2GZk9Mp02KjeauLpFlB0sEoItdBOoWtqFZ S+qPTV+b5EXDO2beVm6i74xjlF5zoZ15L6gbUN089hkzh416cyrukDoa4XLHpmn8FpRE HwHwj2muGaOBqPOEt58jPyHHuNTyDZdvde06t3l9oXagdapjDBdtB9AcwNRTgpZGpOMo ExRof+I0gQSQseiuLI6i3qoE5Q/TW9zhAO4NUaUs2Z8MrVR4tkSjqDLhqAzMhjoSZSiS mdwQ== 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=teEQfAz1c6m6rCPJfgLRxoSrnS8LNHIA5afev5lUxns=; b=EY8UIGTRQsqqmOX8fO86W44fraJ4neWbcEN4D+AcrDHHHDlxXO8qROwBLtOFSN2fuR jWL/ppcIzdYvMmp94lGDr3Z34fuHYna123wP3ye+9EwNM7rypvCAHcGF6jQ/YNTxnBny s8lhJEhEZy8EY2nRFMToMRDmfFqyfe9MnDdATKArDb6G0lEetg/VjiSvQuNlxJdB3Dn/ yyTQM5uVXHzqnioi/SVHrrpT8UM8wDuJeX2BMI+Q5Kr88AkCeu8JEP0VbRAA2FdPg7/d 4okNOjlUAHra/UrDgn9b6rNx5hsrDtYY76NgGmZDLArGYqRvDWB1R5clZ4WbIicFJ1Gc O4xA== X-Gm-Message-State: AGRZ1gKYF06z2Bhvp8skx462KKocOTEtFnEwuU0/I3CLuAs8BHDrUHKN 2HjnLWX/nSEYQtyTQUn7UJF+Aw== X-Google-Smtp-Source: AJdET5eJP26S1glPFZkJfBv29jmXa6CW4Svf0mHNjgIHDIOihzQb9pdgyWV3WjD9EaRA5p+7oFMqbA== X-Received: by 2002:a17:906:6411:: with SMTP id d17-v6mr13317366ejm.73.1541420808384; Mon, 05 Nov 2018 04:26:48 -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 9-v6sm7046056ejw.46.2018.11.05.04.26.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:47 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 5/7] lightnvm: pblk: remove unused macro Date: Mon, 5 Nov 2018 13:26:08 +0100 Message-Id: <20181105122610.1555-6-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 8b89bb26b0f1..33c1e83327c3 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 Mon Nov 5 12:26:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668121 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 34A8E1709 for ; Mon, 5 Nov 2018 12:27:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25A48294D0 for ; Mon, 5 Nov 2018 12:27:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E24294D9; Mon, 5 Nov 2018 12:27:06 +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 C4F5E294D0 for ; Mon, 5 Nov 2018 12:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbeKEVqc (ORCPT ); Mon, 5 Nov 2018 16:46:32 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40139 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729658AbeKEVqV (ORCPT ); Mon, 5 Nov 2018 16:46:21 -0500 Received: by mail-ed1-f67.google.com with SMTP id a14-v6so3117708edr.7 for ; Mon, 05 Nov 2018 04:26:50 -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=SBI5wmJR3GrCOuVAoVisL6o6BQzzsk47CQDsKZGf3JU=; b=yViJVCvIpa/MIRdTSmN11wUdmGX6zk7Twps88VA2eK5t0/IggmgRUUQ/C1Vt/iaVPg cTORBnBuR3dSXdu+emG6HozYCmBxWI67+IrMOss0tuimS6DE5BUteo1NGxE4WebtpCF0 kWE8sO6hUifRXuma8fEgBHVw+vz1pY4xcZEdNHmDnCnqoR13lqB07B+mlHvOnBMCTDp9 zL3BkMDGVZYpm/XMzAqCtn8ZG3CBMnM38sQnNxfTNH2R5iyjpXHh4YUT2fK9VXNZs+lY fuwWytEZI9TkfVKaXo3u5l8EPsUR0F/1OYI882ZvpUjHyhKf/kNYdFtBV8sRamHH6fQM aNyQ== 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=SBI5wmJR3GrCOuVAoVisL6o6BQzzsk47CQDsKZGf3JU=; b=DqI1nMHmAvdiaEdoxHPPQRnXM5gDg5uxBh0Smpyildh5et+zsPWPoA3Em+OQbd8PUp FP5IRm9KCwbUkZGrZYomNMDniBnhGzvrVVMMMcJycaRCpu25KOQU01fMYFH9U0VgwIik zXNyC3i1TsJ8nXFldbXVr1/1x0Y1qlzXes1T43hkRj8HwMF7P97j0MNtPsBf3WdRatGW dc1LcPK9CHU9eDhlNnqzo1NFrRLdcaTzb25784SakVA7F6l3IcvPHpr6Pi5B1y4+9ib1 1tivuG9I7ZcmQd2TvTOHczzYVCsS/WJfqHPpRzpQOjQNlmaZ0dxjDte/XHXz0wkZxFSR 2YJw== X-Gm-Message-State: AGRZ1gKYys5ea0eaqlSC1SAvEitTNUJlsiB6P22xCk+PX74r4nzD1i+U z0NL8pNW5yRR3Z53YeoKAsULEA== X-Google-Smtp-Source: AJdET5cuRs3qouhWGwILRbVwzlGeUX6O4tzs5q87eYFWeeWF3hLt4heEFCwd3H5EjmCKGnIFJEb86w== X-Received: by 2002:a17:906:4e14:: with SMTP id z20-v6mr13554086eju.187.1541420809369; Mon, 05 Nov 2018 04:26: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 9-v6sm7046056ejw.46.2018.11.05.04.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:48 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 6/7] lightnvm: pblk: fix pblk_lines_init error handling path Date: Mon, 5 Nov 2018 13:26:09 +0100 Message-Id: <20181105122610.1555-7-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 33c1e83327c3..ae9686b5d521 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -1053,7 +1053,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 Mon Nov 5 12:26:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10668119 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 E5D481751 for ; Mon, 5 Nov 2018 12:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D623A294D9 for ; Mon, 5 Nov 2018 12:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9975294E1; Mon, 5 Nov 2018 12:26:58 +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 7FEC3294D9 for ; Mon, 5 Nov 2018 12:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728798AbeKEVq1 (ORCPT ); Mon, 5 Nov 2018 16:46:27 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:44808 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729742AbeKEVqW (ORCPT ); Mon, 5 Nov 2018 16:46:22 -0500 Received: by mail-ed1-f65.google.com with SMTP id n19-v6so7282338edq.11 for ; Mon, 05 Nov 2018 04:26: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=YuGGm/kvIUR64EfEJF8Xc35VgZELoo5NN5dE/gXYmfQ=; b=nwX8goWLq3/PU7hl5yIl5XCHNBeAuz+lAhtBRv3n/duhlL1+pQF+6w4xp1o1bstrSr iFQs5y6LnShfnER9RY0T3SHr0aq2r6/exFAvhP/oTwQ74hN4mAg9ZEE2rfufoIUnfWA/ chNDlQVKoWqmQERj/b3Q8dTOSD7YYAm/FSqMTzH7XTEDDFPWqqG5Ls1KxXTERq3jDxZb kNhOSu6nDojy5kY61oNDFdzZRFmVGNsAqsZFFOaimaTCoyHrRh3xDC0l7pOpUuNucImK q10tR9ybWG4Gik/F0uaJp8cy8UMLveIu1LtodB0bE/Zz1h4pLzELOk87oxDuKkSZMnJV po+g== 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=YuGGm/kvIUR64EfEJF8Xc35VgZELoo5NN5dE/gXYmfQ=; b=dX9GZxcly725vcsDwSgEQS1mXN6DMvwo5G02zchGQhzKES+MXDbV3a1Aljm8kZjlUY erlxkbRHXNTvKpC1orpAmldwSthlRSjoHuKV/d6zVZklqRiKqFoboExyL4cz9D7e+6gK ywFLs8BoAtdYFiwQ6+372nH46f2mTm2xGG789A3MkhMOhu38CwZcoD11FrmSIyoTuTzv hW1EP6IH1mbP3asr14QkMco0QWukMFLHIUZFtHHAKCBUEcr77SFguZTrEPVtmdC4XTkf v3yfbz7rXUSe4r72PsvLVGuHpMWFC8/oGbrXJkN7jIWpgq8fK2XTzSf3RYYVDFIZ6lG8 AJDg== X-Gm-Message-State: AGRZ1gJS/veNMR8G9YlbV765U2osjLP3JJqohkSi3bMU0KyOQhm85jFB JOiqtsoI5m6O/gvxNzAvijnUNw== X-Google-Smtp-Source: AJdET5da6wVH3UMraaSgSs5yZ++UmAaFYT79I5Gg1ALa7WyijnT/p9bIB9eMESz3iVNyu23gdbMyIQ== X-Received: by 2002:a05:6402:170a:: with SMTP id y10mr18358000edu.45.1541420810433; Mon, 05 Nov 2018 04:26: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 9-v6sm7046056ejw.46.2018.11.05.04.26.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:49 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 7/7] lightnvm: pblk: remove dead code in pblk_recov_l2p Date: Mon, 5 Nov 2018 13:26:10 +0100 Message-Id: <20181105122610.1555-8-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-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 as 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 */