From patchwork Mon Nov 5 11:41: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: 10667909 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 F142315A6 for ; Mon, 5 Nov 2018 11:42:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE73829711 for ; Mon, 5 Nov 2018 11:42:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D255529720; Mon, 5 Nov 2018 11:42: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 79D9A29711 for ; Mon, 5 Nov 2018 11:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729019AbeKEVBZ (ORCPT ); Mon, 5 Nov 2018 16:01:25 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:37528 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbeKEVBX (ORCPT ); Mon, 5 Nov 2018 16:01:23 -0500 Received: by mail-it1-f195.google.com with SMTP id j79-v6so138276itb.2 for ; Mon, 05 Nov 2018 03:42:04 -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=qCw1dkDLslu/HElVaRw3FdhfQGOps1Ieu66UCGRSzO0=; b=LRcIBwzF8OGzX4fSBdZBIEU9gtjaLxX7Sw1SJMzHumUcNrq1cVhT4VjANjKBxDNKtV XBaeSIeFLZTZ6D+k/DcEaBU88AqfsrcjTdXyivAbufZeYFIDmK5e9TPapYgnJMoKN34F hSkjfgKyaD7Cks9ZxnQjaG8eLtsteMRV+pTFLw4nvnnitzsyDdE7ui+YVNBnZFpqlL1U TGC6/PgReyRgt5G+sv7GBM+Hy935NReAb08LRrm6PKx26FSZLcRxQN7hP2DNRuRUuGtU gHqbU5a1oTqJ7pHxB8A93D/F2V67+SNO9R4gXED0rNXdBojBa09Y3EJ9TRr+TJ/ivE+w xd/w== 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=qCw1dkDLslu/HElVaRw3FdhfQGOps1Ieu66UCGRSzO0=; b=l54L03CqitcNEk2UjgGijPXSYo3jDKzNTC0JfzyA0J42OXb+0T9d1BrHA9X9ZUSGvo nx3OdYBRALXV0aJxFBCXDQDZDKfDb4fo/W+wv0X9b6ESQTFge6eYjYgin2Drda07fmWT urtEnxR83s+DN14p4W2RM9UksQOu8iPRKJv6sVJJGoRcNw7FkEnUeUYn485GmzxkFMFZ t6kv7sZxvA/iNTNzisXwRENUys/WwEGI84lKBVLZw7sqIXvH7T1P1En5QgjAUyocgRIi VneKO2+4qJCSNhwOZGxKPAhTrfEeYAgG3r9z3RvyTXfMKwWZAqFognQRMXf22KeWiqhq LSlA== X-Gm-Message-State: AGRZ1gI9IIOpWKHqiAiZ96CT0jUXwSA/ok/60i7kQtKm9sEf36EynIip tPLX80HQu2su/ohyUS5UA2GyyQ== X-Google-Smtp-Source: AJdET5eJjtZ2Ztd6LkCJAASSZAbLTHJ+DdtbzeUzvyZUvNhyuDYTKZT03yfsoGLzvKrhX2NNzLEHAw== X-Received: by 2002:a05:660c:606:: with SMTP id i6mr6510208itk.110.1541418123848; Mon, 05 Nov 2018 03:42:03 -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 186-v6sm14880824itf.11.2018.11.05.03.42.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:03 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Mon, 5 Nov 2018 12:41:07 +0100 Message-Id: <20181105114113.30932-2-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 11:41: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: 10667931 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 C285A175A for ; Mon, 5 Nov 2018 11:43:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFB0A29720 for ; Mon, 5 Nov 2018 11:43:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A227B2972E; Mon, 5 Nov 2018 11:43: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 311F929720 for ; Mon, 5 Nov 2018 11:43:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726358AbeKEVCX (ORCPT ); Mon, 5 Nov 2018 16:02:23 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:40140 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729015AbeKEVBZ (ORCPT ); Mon, 5 Nov 2018 16:01:25 -0500 Received: by mail-it1-f196.google.com with SMTP id e11so8805666itl.5 for ; Mon, 05 Nov 2018 03:42:05 -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=r0quzrvzfUc+HIm+eh/BxAuTv5KVldRphwW9NWd7VSo=; b=13N0a9HsfaO2AhbJXeA3vtZIfDjx9BfeFj3OQIUvCxFR/dqPfhCXw+nmEkacTNkHPX yfZg20WS95RtkVWUk/k0WsdjvMmw4NwVHmRY3t0FaVSFeD4itTylBIOQcih+0INYwZjb oyFPi4IIaUs+dRLm7meeuMOdE1JoOpZjOJE7J5citlxk6h7FOEaoGI2AC2Ddw2vnhDAc 3b4dtTyVb8qQyzTKFjPV7oqqBFKPDJxtZn6UQnODI8Ckjf8l08F/QTb7r/3O/2GMYRWS WhRmmFyMVvy5DJYRCn9wMsHJpshCvJmXVXG8v3MBYXsLIJ1xSEOs/Vds8RpFozXHrg2J aXAQ== 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=r0quzrvzfUc+HIm+eh/BxAuTv5KVldRphwW9NWd7VSo=; b=nPzNrPplEM1pvI3gbQERKMAxNoayldL5hkP/TFsp2pMZMZVeVGnIK1u2jUmtgvrSuu UN8ecR25AMx3RDF5zoSmml04EnRia6dLkiVtYuDYTrzCsMaggY25dfdkf5jTe+y+nTgY 4pbegFYXOVvSS3GO4sYHDjlBWI2TQ0TKJ/WgD5NGn2a/RfwS31CTx6MJign1x95sVgbc PlIdqfvdO5tLPbCNFugP5o+VAmTkJH9KMGsz2chJDmXFvCcTRdRFDJOpxuJy5H8SKq9O xPdQGA4lqDXDVFeoUOMTvKwJ1XndtComnYF1Iq+ULH7fbqaFhDoZobob6L0RM8JvZIsV uW/g== X-Gm-Message-State: AGRZ1gLTr86FcXtKNiZBLgs7R4SNBN81RKosqA2xC/778DC4dkDJ7Nhh 6qKTOZ0wuPL8SOW6HrLu19Hq5w== X-Google-Smtp-Source: AJdET5dnUg1UmleJlFJefYJnfEEXmiFh8eO0WXx8WF4+Bzy9e4dYBgd4HJQ4svdZDqD+owqjGWfYKQ== X-Received: by 2002:a24:37ce:: with SMTP id r197-v6mr6045938itr.166.1541418125501; Mon, 05 Nov 2018 03:42:05 -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 186-v6sm14880824itf.11.2018.11.05.03.42.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:05 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 2/7] lightnvm: pblk: account for write error sectors in emeta Date: Mon, 5 Nov 2018 12:41:08 +0100 Message-Id: <20181105114113.30932-3-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 11:41: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: 10667913 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 B8A45175A for ; Mon, 5 Nov 2018 11:42:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A64B8296F8 for ; Mon, 5 Nov 2018 11:42:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A55929720; Mon, 5 Nov 2018 11:42:11 +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 E4D8A296F8 for ; Mon, 5 Nov 2018 11:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbeKEVB2 (ORCPT ); Mon, 5 Nov 2018 16:01:28 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:53987 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729205AbeKEVB1 (ORCPT ); Mon, 5 Nov 2018 16:01:27 -0500 Received: by mail-it1-f195.google.com with SMTP id r12-v6so9396218ita.3 for ; Mon, 05 Nov 2018 03:42:07 -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=sx1ajo5hZmYpBUQGxeD/kBzJSjvXlL/mCrEYSCy7h00=; b=FXgOKPD4pUJdjhD7cG6p71jP7/SwDYuTo19m8KPys2RpuYVduMHeKp2PZ9LyXYwTB0 LAHxBkgybesZOxHIP0R6Z5IHCMubohbxPy/pVsNuUSvJa0NNvttwBRXocnJ3K+AY6Ezu Do3VY9iVTdmofFnw3P7BxIm134sRs32rxfQL+atTvaOitn7SaCDAUB3+ACrA7gZK8kkb PlKeFDZAbJ4j37KmDSQMKU96EvLBxWWGvdy2ioWX2W1T7TTQ5Qj7PHpKjO5SKAASO5Qo lwlD4BTwlwS9g0sEE3HCRBXzSwS4XCoOCm85c/9lf1+ZgrmevhWdvi3mzAzi6HH9B7hv N4lg== 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=sx1ajo5hZmYpBUQGxeD/kBzJSjvXlL/mCrEYSCy7h00=; b=WdAXL7jB33uVRu5kjqvRfF2WtkqeoeCA8RMOPOzlpbe5GZ+kmHIbqiF26+103/lriV jZze+iBoqTifqk7GU1c6VaphtDZn66NUvcUEMFpJriLO5/BS7hMbTA1PofmlczNrLLgE JY5P8P56Dqj7ybhZuGmSntslOeMCts36VNop3aUrMnKGv/D87JHFQ0C/biLNOiTJ2JDn 4QT/TNP4P4+D9bxaUIJS0HjmjSDe3tVnfkp6eISUe45k7l5oYNxBoJ4GQ5BxTHiKs6EW FcGEKpe2LKOe6/QbT0KTkkL98O3zL6eRTLOYPLnedjtY5BTkLmaJSj3VS5F2wI8naD0t ZQXQ== X-Gm-Message-State: AGRZ1gLhjVb0jQdBmwebBBnLI3+fHZ2R4EZlkykAgLflENrhafkuq/mo 2q/epewMts+HSwqHVkt+yAUjuw== X-Google-Smtp-Source: AJdET5fDnVdaWmz81xdagLFJRbsuAd7pCHHy0WOMTm8Rg7EjpO7enudosf2BtTXCIuTn6Ok83Pm6Sw== X-Received: by 2002:a24:e4c8:: with SMTP id o191-v6mr6280803ith.24.1541418127219; Mon, 05 Nov 2018 03:42:07 -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 186-v6sm14880824itf.11.2018.11.05.03.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:06 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 3/7] lightnvm: pblk: stop writes gracefully when running out of lines Date: Mon, 5 Nov 2018 12:41:09 +0100 Message-Id: <20181105114113.30932-4-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 11:41: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: 10667929 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 D798C15A6 for ; Mon, 5 Nov 2018 11:42:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C64FF296F8 for ; Mon, 5 Nov 2018 11:42:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BACEE29712; Mon, 5 Nov 2018 11:42:49 +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 27407296F8 for ; Mon, 5 Nov 2018 11:42:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727332AbeKEVCA (ORCPT ); Mon, 5 Nov 2018 16:02:00 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:53991 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729272AbeKEVB2 (ORCPT ); Mon, 5 Nov 2018 16:01:28 -0500 Received: by mail-it1-f194.google.com with SMTP id r12-v6so9396368ita.3 for ; Mon, 05 Nov 2018 03:42:09 -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=4/SOEJeNpK4zMhDsDG4WztvjmNWqKUp83yV/qo+EqKE=; b=CdciSMe++rz0NZMC0OTbTweJD/Os/swtlSaFRz/HqfdkbPx2vHnY9gmyIkh78+OgXP iEtVbGYms36XVMhiNDtkrZsgw/K3+h3HuGEFuwBPQaexkbF7dK+LoZ5FheWlDQhkU7jM biM6m4ud8NT6ouJGY8GgQyeavANvARlJZTdZSAnVC4p+ovjM9C1/nBaM2PDKRVjXpW7J dx18ZRqOlWEGfw5D2gnwOZe2LGaPh2q4ysqPUCgEL9IwF1ebGP6Bs/aes9mfEqxlmfj5 lYD7bWYD0Q2p+YodsWoc4mMlCm5Y2/oIx9ygeTgCwVyDZzsLFKwm5uBEQUECR7AXr4CD 8cGw== 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=4/SOEJeNpK4zMhDsDG4WztvjmNWqKUp83yV/qo+EqKE=; b=HtkCi5MlRMUHvRCHSsOhe1S2yBMiTLQUZ8egREIhRJFmPM6Qqyk+s3hGGrYk55WbNA TCPP2fK+5/onaxidrsDjNUHtOCdYbjgdhIoW4RlAmKsJiP2zsjPYistY1mnOB0Zv7PI2 DbyHEYcgj9j39hkPerpOqDFHg1aPAKyvOk/mG2GN5IOge01nN3FxeVLof6v8OJykhNmN Vj88bpPEKkRim0HiVx0GuOJh+X/tkZ3AG7erJUi23U7ZCa9falNJTrJ8yttfEvaHVB9B Pskm7XxZcsvlPU4wES3tGXs5QhXw7sLRUZPRu7TgTl9sqrVeXaMm3I47BdQLYeMI6jlC OhBA== X-Gm-Message-State: AGRZ1gKttVONtPZTmR6T46zkeMGD5wv5HlUY292sjFwHy4+EB1wzMlqY p1gPVBsjSmJduB+bVkqxHMH7uQ== X-Google-Smtp-Source: AJdET5f6sfnTK2GqFNPsgVMuwtBLX7Ykky8IbNfLe5TssEc+flrnq4whKf0p7+6ctXIp/+AL1u/0+w== X-Received: by 2002:a24:c0c5:: with SMTP id u188-v6mr6323100itf.142.1541418128901; Mon, 05 Nov 2018 03:42:08 -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 186-v6sm14880824itf.11.2018.11.05.03.42.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:08 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 4/7] lightnvm: pblk: set conservative threshold for user writes Date: Mon, 5 Nov 2018 12:41:10 +0100 Message-Id: <20181105114113.30932-5-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 11:41:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10667917 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 B223E15A6 for ; Mon, 5 Nov 2018 11:42:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F38329712 for ; Mon, 5 Nov 2018 11:42:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 922782972C; Mon, 5 Nov 2018 11:42: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 422B2296F8 for ; Mon, 5 Nov 2018 11:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729449AbeKEVBa (ORCPT ); Mon, 5 Nov 2018 16:01:30 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:41856 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729004AbeKEVB3 (ORCPT ); Mon, 5 Nov 2018 16:01:29 -0500 Received: by mail-io1-f67.google.com with SMTP id a5-v6so6229518ioq.8 for ; Mon, 05 Nov 2018 03:42:11 -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=qmp5m3FdPiylEmUW8CNgXsb2BFd/kBJdIrvq/1re7hI=; b=LSTRXrj5POp177ymc+YCrU7HuNuRYD1E1hzkKDDAkIpXhr9DpRLmgzEDaJwFzE4SPo G/EyxzbR4DX0jmS4RdG4lN0CWpw2xoDvM26bhpaDM6ZJ4aw+1Mrn+PXluZp2VIRnWLhp 4T5NFjbKhbqcNTXs2pmDbQDAI+2TFTeUxUetTfrZAG9zNPEYr92P0hmg9jcplVURpuwO T6hlcWcHjx+NLTJLlXK8FZZGirjTKP4cvhvgJ19BoaHOs9K5XXcJFRcFg8O9Q9rAGtsI 5DBloKBh1EjqYGZueoEpKrwMsjE5ZYJxXFoxzieaZ9xgZF6kLQOk39rvZf1xYMTIuYMs WSaQ== 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=qmp5m3FdPiylEmUW8CNgXsb2BFd/kBJdIrvq/1re7hI=; b=GxMKF4vy8CMJeW7+zpeClwW0m3RoHK0jZjESOm+PC4nclAsPQPgQASYNzF7RSi1/EL uracfXx2aRMYBugpDkNvbXl6krJRAmR1EApJ9FzJZw491SSLY+5dKWG9MK1Rqcy7oGt4 P6g95I+zcXw+Zp0oPlaMVJbF6NERugunzUgWZME/QdOqU2uztLVe6DFI0kog7J167q9q 9+eGchu62eYwMMrCs7MkHtTLEZOzjQ3amVGOrESjrX/rRta3KKrGPJKHqiGV1Gm32/Th gi3wcJGMMM7PGVOnJoOul2vzHZ0gipPutvpgb19UUO96R1JMrLSZL0foBC9p0siRtTe7 Iblg== X-Gm-Message-State: AGRZ1gKWaig2KrjNe2O3KlJCXZrDZHLcRHZrfBpMC4yHOyTFjPXIOOJH Vw4/XQtMflT7AHV7uDpKgJYfNw== X-Google-Smtp-Source: AJdET5cE78AdGuslIrBDmhDhhOGchcCfDIcOnB4C9WiEo1MnnQ/9vLKSOT2B2HJPhDcVHP4ad884Aw== X-Received: by 2002:a6b:d50d:: with SMTP id m13-v6mr18515586iog.152.1541418130637; Mon, 05 Nov 2018 03:42:10 -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 186-v6sm14880824itf.11.2018.11.05.03.42.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:10 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 5/7] lightnvm: pblk: remove unused macro Date: Mon, 5 Nov 2018 12:41:11 +0100 Message-Id: <20181105114113.30932-6-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 11:41:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10667927 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 24874175A for ; Mon, 5 Nov 2018 11:42:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12502296F8 for ; Mon, 5 Nov 2018 11:42:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 066F229712; Mon, 5 Nov 2018 11:42:28 +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 AB2D8296F8 for ; Mon, 5 Nov 2018 11:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728874AbeKEVBp (ORCPT ); Mon, 5 Nov 2018 16:01:45 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:38430 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729004AbeKEVBb (ORCPT ); Mon, 5 Nov 2018 16:01:31 -0500 Received: by mail-it1-f194.google.com with SMTP id k141-v6so10272577itk.3 for ; Mon, 05 Nov 2018 03:42:12 -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=mq2pXsxBVKjyR6ETTb+oyHYfaQtkfPqHe/RfPr8ip58=; b=UgTp+ct+aU5PtwaUn6O3C8Sq3F5oN6oCcmhY9THHY5jVrBd3GYIq96ufAPzeal6VHd KZR4ZcRc9DYtRvajRD4zU+yDLPIOYON5bD9JYxRQ/DsixzE2UlPGxOlU91PzYAHhbOPN +TBJq7vlEYMASC3GV0WPvYkiXk2KxJRpVto3D9SW2vXTV8Jm81IdSiYZ8raMywmJmkhM cdy2ECWGRj6C+MwQRtBfeHUlVfm7h/i5U6RAkDOrJ8oatsjJaTxB7cqYzDb3/8BIbX5Z m+MYJhv1ssWET6hgqJnHMdTS4cs/eppFpij7y3MiG9VDYGRDVd/6SfQZtG3k6fep+4Tb BROQ== 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=mq2pXsxBVKjyR6ETTb+oyHYfaQtkfPqHe/RfPr8ip58=; b=oXrykqoN3jZyxchhwmI2cdqmu4x4QwXmZkR2QreiJdqE19uAAINDyqLEktuu2Y6shw 8rrl7d+dcUJwhnluor9T/yT0n1IzcbdoIohxGycwNYdhDQihwc21GiSty3GwQzY3ml/k Z9SicZ98SuaBHulRWF0riNb3V/IFetbqj+s/yu/vdG2HOmpOuUT0mXU2y6mxtzPOV1cm AI/A8Jjo62fOPHHB9u3EMpGIrVz2geLvf+JNB7G3HO47eGwV79UdmUHV+3W4M54A8FTS MVv5ve1HqmYzgsQJwVW7QbiW50KvMjls/k15afHpfJU4YgJeFe+pDuzISc5TM4e2MpMS Tzew== X-Gm-Message-State: AGRZ1gLkBXgOKdJsdMARkvAZ+UUtq/SD9qAcBQThAD8RciEDQkaL6G+2 7M11tVB8bu8K0gxOB3tRFBTxVA== X-Google-Smtp-Source: AJdET5cJ1rI+ft7/vUO3bvpx/k/ItUMtrMwHSZ+Go19X1/S9cXv/7cmklU8xDN77WdYuZXmDyaNj1w== X-Received: by 2002:a02:5f96:: with SMTP id x22-v6mr20275912jad.43.1541418132408; Mon, 05 Nov 2018 03:42:12 -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 186-v6sm14880824itf.11.2018.11.05.03.42.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:11 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 6/7] lightnvm: pblk: fix pblk_lines_init error handling path Date: Mon, 5 Nov 2018 12:41:12 +0100 Message-Id: <20181105114113.30932-7-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 11:41:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10667925 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 B3F6415A6 for ; Mon, 5 Nov 2018 11:42:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A165C296F8 for ; Mon, 5 Nov 2018 11:42:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9545D29712; Mon, 5 Nov 2018 11:42:25 +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 382A6296F8 for ; Mon, 5 Nov 2018 11:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728827AbeKEVBm (ORCPT ); Mon, 5 Nov 2018 16:01:42 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:33610 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729447AbeKEVBd (ORCPT ); Mon, 5 Nov 2018 16:01:33 -0500 Received: by mail-it1-f196.google.com with SMTP id p11-v6so7500018itf.0 for ; Mon, 05 Nov 2018 03:42:14 -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=I6VkKo/gA/7rVfoOYCcmwPUmucAY3X1LV11ImaJxs6o=; b=11jtr3QYUGJC75M6G9/yF2SxEoJkQYw0fygbIYrunsLG5UIwZPc+gRerMD+gQXbdTD Am+qjFjZipPuQyffjG23RotRgKgETqXOIvp0J3tAufz1E6uMseos+IC+pwo3VDbXqZGf B+GYhd+faNgv3oPs/7PTh9nJLjdzAKpH/Q2HRx8uDHCOTu/Re+KNpbZnaq+rhYh7X8jK SDc9cduLR7oBuUg3925BlzaR5c35/nrm6v0IE1emmaZskHKMcG+juyEJ7SkmjfJGr4kI xTz2DRYLrUD5KqYPcnfPk2e139oEKkTUQZscKWPOLhqZNfs0jtH8/Q6z3TxyvZWHvP9f PXHw== 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=I6VkKo/gA/7rVfoOYCcmwPUmucAY3X1LV11ImaJxs6o=; b=KDztkH15OuW3P4piub+D0vugyjVY+oW90ktFthvelRoi88eLHrMdx5d+XHBcdo9uUE FGSZCXRFVMRLMWl42OOl0AFlyT82jwI1f4aPK1umKjMm922shWxKR4FUa7GL8WRrVVc4 Mr3UH+4az4n4g2iKaWwvLHE1zX+jDpTBo+57YHT5/FqYJ2ykHv+CSp1DrCobjkTGnWWM OMZBBG8TCjt1hdKRobGGxiQEO41QlVCdXzSL9DlTa4OoikCtFSVzQv5zzABWm9u/j6Wv uytv+qNoqPOhZ87cIVHTd2ub1TDh+0/6SeF1npGWOomDINjaibUKm4B7zVeNVCpdFIO8 +qKw== X-Gm-Message-State: AGRZ1gLKvjOdft2/nBl/0GXjWF3SZY809PJMvVIZdAcfrZUGHR02QdDt l8FAPqKBHHuFywHUzwXcaR6stud07YEsdw== X-Google-Smtp-Source: AJdET5fARmOuOai4beCJqrcljzIAFavigSNdSetlSuDFLUjc9j8oND9BqbCzq3fe2E7aMePelUF2GQ== X-Received: by 2002:a24:2b43:: with SMTP id h64-v6mr3414946ita.115.1541418134196; Mon, 05 Nov 2018 03:42:14 -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 186-v6sm14880824itf.11.2018.11.05.03.42.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:13 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 7/7] lightnvm: pblk: remove dead code in pblk_recov_l2p Date: Mon, 5 Nov 2018 12:41:13 +0100 Message-Id: <20181105114113.30932-8-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.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 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 */