Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1469059imm; Mon, 3 Sep 2018 00:58:54 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbrijl6+VQ5WT4ZwevcOdoZLfVPcGkv9r9H6Cs0U3/z4fnYGb7ti0Fo6HyOS45Nadc4PV8R X-Received: by 2002:a17:902:8d8c:: with SMTP id v12-v6mr26635011plo.94.1535961534373; Mon, 03 Sep 2018 00:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535961534; cv=none; d=google.com; s=arc-20160816; b=wsZ+UY94NJzgBif72fr9M4gS80HQ9lsitr/ORtgEYLgROBh1dAVlFKnIWInF/T1Art WqgMwG42WbND4h5w/XbbfftcdzJGKgHgim7jF/8Pzts4q1WUs4dUhvK5jwjz0j9rJ0Ym 4YHMECfc75hSAW3SDqAbY2LeuyrlGWPQIsemTa+7XIC67VOGAKDxloDPDer9NUytOTE3 /bmNqnTxftl7Ez6LCCzSAUTKuBVpQjKy5A0uSgmvo4vklsdIXAjTJhlYkR2lkks4/ZpZ UNUSPflSkRDyM/XHvqUY1WbUEBw3blIHkmD1nEsEJEdUxCyTncXdqleInvjGvhn5A5RB 6JmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=0DbDQ8diAdf5m14wtXI6ouf+Nu0hhGcTfRfaAxBUjAE=; b=sJTxrAlKJ7e8wkUHF6cYmvxLCF+68P7kCX/ZhVBqDC4EWO4qDzAPlRG1updwUiTgl7 N2gtFtxhc77P6789T5JuP8Sl+1PTK2jxu2doexEDg8b50mkODBnyAVCVKb7RAdPPIIhw DGfRX3Ltu7VXTez1uyuDf19hnWwjslBwe5O4iMVYJxCfbQPgOLJmTyWmy1LpEHbbALGr WTm5En06jfJLvVVptcAMioglv5o4cykEQLDz6pemdLnEMCjr8ZObOokOB4Tr0tNxkLLX Hy84vk6Zd66rXUn3Sb9N4g6iUdhpIU8nzaEZEUtQ+Rp0S079+F42WoDA+kKwbJHXaGOC B8aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=OJlz6rto; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18-v6si16947842pgl.171.2018.09.03.00.58.37; Mon, 03 Sep 2018 00:58:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=OJlz6rto; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726046AbeICMQB (ORCPT + 99 others); Mon, 3 Sep 2018 08:16:01 -0400 Received: from mail-ua1-f65.google.com ([209.85.222.65]:44213 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbeICMQB (ORCPT ); Mon, 3 Sep 2018 08:16:01 -0400 Received: by mail-ua1-f65.google.com with SMTP id m11-v6so12484161uao.11 for ; Mon, 03 Sep 2018 00:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=0DbDQ8diAdf5m14wtXI6ouf+Nu0hhGcTfRfaAxBUjAE=; b=OJlz6rtol+He5Klu6x1odKIPlD60az22a8vqGsvqpNPArL3Jr0IOeSHpsvlV92hCIb nqexNLTb+8O82PXEoIpxN3hGISmA0jPnoXZ9tXk4r4izeQh9c48hQbGjpEhBQsUQd3Wo hiOth03RcZp4AkIzh8d4lWJHMVjQyzBBFtqN/A3m9jKnATQUV7lPMltvXpz/eB24hXf1 E6VsangSsh1ehw6pwWg1A56KCuWXbQJNr8ASHrH0YPqiBY05uygSUErvz0g9RfILJaew s04SsqION6iTZAzYLC4qyIf6QIPgldklUzlKxBu1prAzIRanDT/7M8iqu2r/25LxlvwA wnbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=0DbDQ8diAdf5m14wtXI6ouf+Nu0hhGcTfRfaAxBUjAE=; b=DiuObwB7YXN3aSpYkue0D9CYJDEgdUdkxaqT2M1ELsKfj+nVKeF6soE160AgwqDuAo j2X2ZWOWExb2SnQW08cAa5HL37yHY5QBLCHZp4A6ZZ87BK4X+JRFkGGwghkTd1imYtBN v71PoNAvwndsNuvaRkeaOETwJkJYcqGx55T1Ik4NtHlnz6U5HNCidCLjFnMQzf01ai+l CPX9m8TUoe3lTLaFZfZQMCYZ4biDK3bbtT2YXRXAZwTHKFifthESEUKfi+it0L6j5437 BlZ9r147QzZ7q2tJE7rg0hH0S77/VSH/APZgFuS4W0beMFjGIjBUiZRbyvhrvQrbR6fT sTWw== X-Gm-Message-State: APzg51ABW+cu3EtAwjupWVTddcOfkpYyWh9xWbSuEa2mcDReT8vIsRVn NCOLAiXfxg55uiiRnUbzN4NJrBVr+HUYW9RONyPw0M3Pzpg= X-Received: by 2002:a67:8dc6:: with SMTP id p189-v6mr8043334vsd.15.1535961422486; Mon, 03 Sep 2018 00:57:02 -0700 (PDT) MIME-Version: 1.0 References: <1535709570-8923-1-git-send-email-hans.ml.holmberg@owltronix.com> <70ce6061-61f0-9a14-7b70-59d0ad2bfa43@lightnvm.io> In-Reply-To: <70ce6061-61f0-9a14-7b70-59d0ad2bfa43@lightnvm.io> From: Hans Holmberg Date: Mon, 3 Sep 2018 09:56:51 +0200 Message-ID: Subject: Re: [PATCH V2] lightnvm: pblk: fix mapping issue on failed writes To: Matias Bjorling Cc: linux-block@vger.kernel.org, Linux Kernel Mailing List , Javier Gonzalez , Hans Holmberg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 31, 2018 at 4:18 PM Matias Bj=C3=B8rling wrote= : > > On 08/31/2018 11:59 AM, Hans Holmberg wrote: > > 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 > > --- > > > > Changes in V2: > > Moved the helper function pblk_next_ppa_in_blk to lightnvm core > > Renamed variable done->last in the helper function > > > > > > drivers/lightnvm/pblk-write.c | 10 +--------- > > include/linux/lightnvm.h | 34 ++++++++++++++++++++++++++++++++++ > > 2 files changed, 35 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-writ= e.c > > index 5e6df65d392c..922506d2d0a6 100644 > > --- a/drivers/lightnvm/pblk-write.c > > +++ b/drivers/lightnvm/pblk-write.c > > @@ -125,15 +125,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 =3D=3D NVM_OCSSD_SPEC_12) { > > - map_ppa.ppa++; > > - if (map_ppa.g.pg =3D=3D geo->num_pg) > > - done =3D 1; > > - } else { > > - map_ppa.m.sec++; > > - if (map_ppa.m.sec =3D=3D geo->clba) > > - done =3D 1; > > - } > > + done =3D nvm_next_ppa_in_blk(geo, &map_ppa); > > } > > > > line->w_err_gc->has_write_err =3D 1; > > diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h > > index 09f65c6c6676..2a6cbfe1d1b4 100644 > > --- a/include/linux/lightnvm.h > > +++ b/include/linux/lightnvm.h > > @@ -593,6 +593,40 @@ static inline u32 nvm_ppa64_to_ppa32(struct nvm_de= v *dev, > > return ppa32; > > } > > > > +static inline int nvm_next_ppa_in_blk(struct nvm_geo *geo, struct ppa_= addr *ppa) > > You can pass nvm_tgt_dev here. Then the two unfoldings in > pblk_map_remaining are not needed. Yeah. thats better. fixed. > > The naming sounds very 1.2ish, how about nvm_get_next_lba_in_chk? I used blk because in the generic ppa format (ppa_addr.a), the name is blk. Chunk is more abstract concept so i think it's better using that going forw= ard. Fixed. > > > +{ > > + int last =3D 0; > > + > > + if (geo->version =3D=3D NVM_OCSSD_SPEC_12) { > > + int sec =3D ppa->g.sec; > > + > > + sec++; > > + if (sec =3D=3D geo->ws_min) { > > + int pg =3D ppa->g.pg; > > + > > + sec =3D 0; > > + pg++; > > + if (pg =3D=3D geo->num_pg) { > > + int pl =3D ppa->g.pl; > > + > > + pg =3D 0; > > + pl++; > > + if (pl =3D=3D geo->num_pln) > > + last =3D 1; > > + > > + ppa->g.pl =3D pl; > > + } > > + ppa->g.pg =3D pg; > > + } > > + ppa->g.sec =3D sec; > > + } else { > > + ppa->m.sec++; > > + if (ppa->m.sec =3D=3D geo->clba) > > + last =3D 1; > > + } > > + > > + return last; > > +} > > > > typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct = bio *); > > typedef sector_t (nvm_tgt_capacity_fn)(void *); > > >