From patchwork Wed Aug 29 12:23: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: 10580135 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 3D4031709 for ; Wed, 29 Aug 2018 12:24:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CF112A6CF for ; Wed, 29 Aug 2018 12:24:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20C512A76E; Wed, 29 Aug 2018 12:24:35 +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 B52C52A6CF for ; Wed, 29 Aug 2018 12:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727859AbeH2QUf (ORCPT ); Wed, 29 Aug 2018 12:20:35 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:35120 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727428AbeH2QUf (ORCPT ); Wed, 29 Aug 2018 12:20:35 -0400 Received: by mail-ed1-f66.google.com with SMTP id y20-v6so3779912edq.2 for ; Wed, 29 Aug 2018 05:23:54 -0700 (PDT) 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=UQkDiPooqhwWS1BzntFMujGan16736ogBbBumqTDCUA=; b=uj14UinMVay5ZkiWviYTdI+pTG4xbCVOnBBgOKyHEuByq4aDPd6zu8ET9xtNACGtvZ Qib4Ajq4vl23c7ywIGB61Oxgde9xo/q6ueEjbwFEi2GCp+iGn11/Ads6ZgDHTWp36OgZ H1OSUxtqzIqDjr26ZMyBHe8uTi9EQ/m+zTRr9OcqRJjmddoltDMs3N4Ki3dH1zMoInqv 7Jm/VUSZm+MvNcaIfmp7gqHLbstOOlAP1TX2TkPdITL22Ng0IV0pcAhL271yREljpU0/ 7mkTRlsHGIz8cz7+ZnIEuAsgPc1WD+PdMsDhPL5gA19umgkHRije+x/auHRIA/mOSzR9 QgmA== 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=UQkDiPooqhwWS1BzntFMujGan16736ogBbBumqTDCUA=; b=ue2RjKa1GDdYkp73L1dyNMN3cA/KlynDCwHkfNQ2B/YITdjGVCZbF9rtL9srMHo4Bk q4kPtNapVFU4qnLyv6yX4ATyZ40G9TucMGu4SZEEWRGQ8D4m5C9S1wEZDtO/M2rENbZN PzlYIJvRYyCgtB8bdH/+GN7dXVjX7dcF38YgrxPQZYVRdgxhEaBu8DrkZocfnyzGZ4Ze GcO6A1fUM3fxgpR38xFY6tOmEr5fKufyVhCXUC5VEQe3eLKzoEjvouA75awHlOjWmEEO FnV/SQoQsDKBVHUffHvfK5y5BnhJN9S/7gNwY5oe3DJAvQ/IqVFGNsqdJsQcarYFrgjB Y99w== X-Gm-Message-State: APzg51C5LnIfWdw3jl6TmGo0vx6ZVjlpb69qlDZGXB2k2mERQZJW6d/h 0Z10VAsYcsX7nafYbFPKVd9rQA== X-Google-Smtp-Source: ANB0VdbmFoXZYiJkhlK15N2JZfPiVCuEudCTsMRA/aKm8KcSrbBICal50+bFN6jR+RFrduz9RX4ASQ== X-Received: by 2002:a05:6402:1348:: with SMTP id y8mr7430321edw.222.1535545433868; Wed, 29 Aug 2018 05:23:53 -0700 (PDT) Received: from titan.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id f26-v6sm1752068edb.28.2018.08.29.05.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 05:23:53 -0700 (PDT) From: Hans Holmberg To: Matias Bjorling Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Gonzales , Hans Holmberg Subject: [PATCH 2/7] lightnvm: pblk: fix mapping issue on failed writes Date: Wed, 29 Aug 2018 14:23:29 +0200 Message-Id: <1535545414-550-3-git-send-email-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535545414-550-1-git-send-email-hans.ml.holmberg@owltronix.com> References: <1535545414-550-1-git-send-email-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 On 1.2-devices, the mapping-out of remaning sectors in the failed-write's block can result in an infinite loop, stalling the write pipeline, fix this. Fixes: 6a3abf5beef6 ("lightnvm: pblk: rework write error recovery path") Signed-off-by: Hans Holmberg --- drivers/lightnvm/pblk-write.c | 45 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index 1bc879ab679d..fd67325f6e54 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -103,6 +103,41 @@ static void pblk_complete_write(struct pblk *pblk, struct nvm_rq *rqd, pblk_rb_sync_end(&pblk->rwb, &flags); } +static int pblk_next_ppa_in_blk(struct nvm_geo *geo, struct ppa_addr *ppa) +{ + int done = 0; + + if (geo->version == NVM_OCSSD_SPEC_12) { + int sec = ppa->g.sec; + + sec++; + if (sec == geo->ws_min) { + int pg = ppa->g.pg; + + sec = 0; + pg++; + if (pg == geo->num_pg) { + int pl = ppa->g.pl; + + pg = 0; + pl++; + if (pl == geo->num_pln) + done = 1; + + ppa->g.pl = pl; + } + ppa->g.pg = pg; + } + ppa->g.sec = sec; + } else { + ppa->m.sec++; + if (ppa->m.sec == geo->clba) + done = 1; + } + + return done; +} + /* Map remaining sectors in chunk, starting from ppa */ static void pblk_map_remaining(struct pblk *pblk, struct ppa_addr *ppa) { @@ -125,15 +160,7 @@ static void pblk_map_remaining(struct pblk *pblk, struct ppa_addr *ppa) if (!test_and_set_bit(paddr, line->invalid_bitmap)) le32_add_cpu(line->vsc, -1); - if (geo->version == NVM_OCSSD_SPEC_12) { - map_ppa.ppa++; - if (map_ppa.g.pg == geo->num_pg) - done = 1; - } else { - map_ppa.m.sec++; - if (map_ppa.m.sec == geo->clba) - done = 1; - } + done = pblk_next_ppa_in_blk(geo, &map_ppa); } line->w_err_gc->has_write_err = 1;