Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp379667imm; Fri, 3 Aug 2018 05:08:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfRfkIJWkL7gH4FuK0GRDCZV2J2XXXoNEso36JfNMfWlckxKTZmX/iIswP15RuB1/vSWgjn X-Received: by 2002:a63:64c2:: with SMTP id y185-v6mr3515420pgb.126.1533298115324; Fri, 03 Aug 2018 05:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533298115; cv=none; d=google.com; s=arc-20160816; b=tUl48QPp3tO4FUMHxcKfYkFzztLBcyo/Kt9MaNglKs/8b+uIZS9GghZlSaGhI4Iege PuVcmd9j3yQmBnfgkJWJTUo+8NeDr+hPyaYEkksmS4evi9Jtg7qAQgXlcBHo43Yl1feH bUTZccrmWN3TYyRLTKkrxHZRRkpZhowbJ33YhpI7XC5arPvDRP+2hPA+B58BtNrbGjqV stf2ZHWXKJ445h9ix5AxwMnCjNS4jGqJDNwbJ0S0rLjsWrY5ZKwzsdLIs9sQy9uvn0FH ksgvhG0vi9lVeA1G2utRNG1xq4igqCO5qE0+GJuWYQyJ9UdXEhhEPJTWrh9Xsj27+gfz 5psw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=5ix6nN8TY/pRUSNAN0CYMr9/tFfwo6qzD/vcFrFHOGU=; b=KxtKSDq7+LDCjNnxMs+4bCkhcwodyG4BnNMy/qiDK9u8pjB4GJkZ3ogRQPcFPLckCd m13nt9PhUPxykt96bO55YxxPRxiJ7Mc4VyGiLYJnACXnWTdAwuHp+R4JF61vwQ5T7vrO xBRLCf44pssOa7xeAr1624vOi0LZkfBF4Hc6bOweGckF7NlMzExED9XiOmhm+oDIYVtJ rFUdyfSY5KFEiUo5NLlpOJly5TM/Xwa1G4Gm3yYq882xy38lPB1r/6EEZi7Ve+Sh+0tV +Epe6libApRB/Xz6k4Wsgn3iiGvzYEOmVfoPmOCBCfrZYh36O+PvmN1OfIaVjX0wPwZJ Oe/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cnexlabs.onmicrosoft.com header.s=selector1-cnexlabs-com header.b=DK4X8A3n; 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 q11-v6si3487476pll.10.2018.08.03.05.08.20; Fri, 03 Aug 2018 05:08:35 -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=@cnexlabs.onmicrosoft.com header.s=selector1-cnexlabs-com header.b=DK4X8A3n; 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 S1727566AbeHCOCi (ORCPT + 99 others); Fri, 3 Aug 2018 10:02:38 -0400 Received: from mail-sn1nam02on0070.outbound.protection.outlook.com ([104.47.36.70]:27360 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727328AbeHCOCi (ORCPT ); Fri, 3 Aug 2018 10:02:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5ix6nN8TY/pRUSNAN0CYMr9/tFfwo6qzD/vcFrFHOGU=; b=DK4X8A3nohTE0kMB3u54zSsU2bR/Zl8hvosnYVq1h1OLUae3aLRhXVvJu3/L4JcVRfsrtMp2/SmBHOvp+l6RSMvUdJlJkOQsRIO0zOJqi33aP1wS76Crox2folNB0iGTRo/Yec6QIca29o51eU4/IBj5JAnVnvPGtbaaMXKb4ps= Received: from CO2PR06MB538.namprd06.prod.outlook.com (10.141.199.23) by CO2PR06MB570.namprd06.prod.outlook.com (10.141.230.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Fri, 3 Aug 2018 12:02:40 +0000 Received: from CO2PR06MB538.namprd06.prod.outlook.com ([fe80::311c:7e3f:3043:5287]) by CO2PR06MB538.namprd06.prod.outlook.com ([fe80::311c:7e3f:3043:5287%8]) with mapi id 15.20.1017.010; Fri, 3 Aug 2018 12:02:37 +0000 From: Javier Gonzalez To: =?utf-8?B?TWF0aWFzIEJqw7hybGluZw==?= CC: Hans Holmberg , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] lightnvm: pblk: recover chunk state on 1.2 devices Thread-Topic: [PATCH] lightnvm: pblk: recover chunk state on 1.2 devices Thread-Index: AQHUDsAqECp4D0lQUUKx9mO19FFp2KR1YqSAgAG0kwCAAAIjgIAAAc0AgCcOdICAD/s1gIAAAWiA Date: Fri, 3 Aug 2018 12:02:37 +0000 Message-ID: <88659F4F-8105-41CA-B0B8-849E707F18CD@cnexlabs.com> References: <1530177121-24908-1-git-send-email-javier@cnexlabs.com> <1530177121-24908-2-git-send-email-javier@cnexlabs.com> <43D7E3C4-765F-46AB-9B84-27E37FCAE016@cnexlabs.com> <19b2f125-d373-cf2b-43c7-140b3872cd64@lightnvm.io> <8c2fc1ff-e2ea-499e-3699-39622d00be9e@lightnvm.io> In-Reply-To: <8c2fc1ff-e2ea-499e-3699-39622d00be9e@lightnvm.io> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=javier@cnexlabs.com; x-originating-ip: [193.106.164.211] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CO2PR06MB570;6:DjPsEEXgjPSk0mgq1vXtciOb2ajVQtgXL5k1VSMN7mzGDvoCvQjaSbCGHb0Eki5j48UvaoWXKUcFXXkIugtBV3Gx5jeA/xkxnGoe0+KWzMgMSo4o2zBbWmK9BrVnP6gZtwc9S9wbunRcEy6B7C2UCfsJgkMXv+h2ggeSDMBygxtLAF+4wvU/3bBK0xpMzfY8FTlAy9qUix8NB6i0R4+bYBHopzCUcWq62S12v2/jK/b/8l6hWIBzqAxW9npKJHCt5Lx9h/T9uqTiaqeybeJegaPMfHMsEDfBr8kwLhSSWq5ZB/b9NUroMBirGvtGN4Xe/9+mKFBFerpvxdTiW294tjXwl/RnvtJWYPifLD0Vb8tdaImYDu/dOMYxMpgrkvb1kjRI6xVbYIRNKt7DQgVrj6nrtf0pc4cDn1Pw9zqLG8SLmxu4QPlxMJNDsd/MgwW+dWGxxcghpe1rYWsANjVQzg==;5:disZPeyYrHWWVpkhOWPIsBZy6JJyXRtT0MJcOS2KbWrZmxGSrPqxmcxEKoRhRIrYcy6hMFKoOfMtSDr9XIf4erRlWhPYp3Q87p2qpi5PMqNSUj+l+amrTaXK6ALIiboO9UTkxVBnsWEfpXHg+pR44yWICT3c/sr6ZjLRTmdHapc=;7:mpAaQ0YhkPmq7YtYWICmWuN/kyyMrhw4uX8NxvEQD8VGskfoYipB4ZJobYrr1KyTlkdPabLoTaJfC8BnEiLk2F6KdD3ue+Qkex6mWIb9uDObFhZstzMmN3LJFfcdsMEQd5cj1hWdR1dUHZjSBYgKBUz5CNQcPGDXwvO2VSMA6BLnUfe4lsF8A/hvBkH/DeZH10cv5IF0Xql16jOp1DaP25wD4LjX+s3FNwowi1U8FJlHNBmL2G3s1MqHJphwHraT x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(376002)(346002)(136003)(39840400004)(366004)(396003)(189003)(199004)(53936002)(68736007)(54906003)(97736004)(99936001)(7736002)(93886005)(14454004)(3846002)(25786009)(6246003)(6116002)(476003)(82746002)(305945005)(486006)(2616005)(6486002)(2906002)(6436002)(316002)(229853002)(5660300001)(106356001)(36756003)(11346002)(6512007)(5250100002)(105586002)(66066001)(81166006)(446003)(99286004)(33656002)(2900100001)(83716003)(478600001)(26005)(76176011)(4326008)(186003)(6916009)(8936002)(14444005)(81156014)(6506007)(86362001)(256004)(53546011)(102836004)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR06MB570;H:CO2PR06MB538.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-office365-filtering-correlation-id: e61ff58b-8d36-4f7c-c7d3-08d5f939016b x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(49563074)(7193020);SRVR:CO2PR06MB570; x-ms-traffictypediagnostic: CO2PR06MB570: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(102415395)(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:CO2PR06MB570;BCL:0;PCL:0;RULEID:;SRVR:CO2PR06MB570; x-forefront-prvs: 0753EA505A received-spf: None (protection.outlook.com: cnexlabs.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 8Jd/er8ATNeQnobdwSBR0xfOyrYuShGzFbbzl5bPmRMi/X79ItcxU0VWkB3CI1NBKY2Jligx5SGsaq1jTtmIKkjwkBtdcnmFktj2JIVxgo1XLGEK5NBOeCed5zZdpJMbpznpCcTFOx3UraAoBGXDlrfxYjb0hB7lmh4eQqS6xBdhr95aBrquwc5vRFKrAFnTmJIhXS5oJM3hWw7KpFT1wGuR1F6YvaPhrYqL8+B9mapxSnpsxpa00qE8/J9J/QghyLZIlOXB6CQA+YMRogfRHDnISSiqdhijQCTS2+Ah55msVjXU+NwEKleSl9LbUI9AQSNyTqr0ChSnUHB5dwE+alBIBaf5qUkZi6giz/tdfks= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/signed; boundary="Apple-Mail=_3BC33749-B9D9-42B0-9EC1-E5F7699E401E"; protocol="application/pgp-signature"; micalg=pgp-sha512 MIME-Version: 1.0 X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e61ff58b-8d36-4f7c-c7d3-08d5f939016b X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2018 12:02:37.0722 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: e40dfc2e-c6c1-463a-a598-38602b2c3cff X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR06MB570 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_3BC33749-B9D9-42B0-9EC1-E5F7699E401E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 3 Aug 2018, at 13.57, Matias Bj=C3=B8rling wrote: >=20 > On 07/24/2018 09:54 AM, Javier Gonzalez wrote: >>> On 29 Jun 2018, at 13.28, Matias Bj=C3=B8rling = wrote: >>>=20 >>> On 06/29/2018 01:22 PM, Javier Gonzalez wrote: >>>>> On 29 Jun 2018, at 13.14, Matias Bj=C3=B8rling = wrote: >>>>>=20 >>>>> On 06/28/2018 11:12 AM, Javier Gonz=C3=A1lez wrote: >>>>>> The Open-Channel 1.2 spec does not define a mechanism for the = host to >>>>>> recover the block (chunk) state. As a consequence, a newly format = device >>>>>> will need to reconstruct the state. Currently, pblk assumes that = blocks >>>>>> are not erased, which might cause double-erases in case that the = device >>>>>> does not protect itself against them (which is not specified in = the spec >>>>>> either). >>>>>=20 >>>>> It should not be specified in the spec. It is up to the device to = handle >>>>> double erases and not do it. >>>>>=20 >>>>>> This patch, reconstructs the state based on read errors. If the = first >>>>>> sector of a block returns and empty page (NVM_RSP_ERR_EMPTYPAGE), = then >>>>>> the block s marked free, i.e., erased and ready to be used >>>>>> (NVM_CHK_ST_FREE). Otherwise, the block is marked as closed >>>>>> (NVM_CHK_ST_CLOSED). Note that even if a block is open and not = fully >>>>>> written, it has to be erased in order to be used again. >>>>>=20 >>>>> Should we extend it to do the scan, and update the write pointer = as >>>>> well? I think this kind of feature already is baked into pblk? >>>> This is already in place: we scan until empty page and take it from >>>> there. This patch is only for the case in which we start a pblk = instance >>>> form scratch. On a device already owned by pblk, we would not have = the >>>> problem we are trying to solve here because we know the state. >>>=20 >>> Agree. What I meant was that when we anyway are recovering the = state, >>> we could just as well update ->wp and set to NVM_CHK_ST_OPEN and so >>> forth for the initialization phase. >> In 1.2 the use of chunk metadata is purely fictional. We respect the >> chunk state machine as we transition lines, but all the write = pointers >> are ignored. Instead, we use the line bitmap to point to the next >> writable entry. This is BTW the same way we it in open lines on 2.0 = too. >=20 > Now I understand where you are coming from. I had the understanding > that we where using the write pointer now that we moved to 2.0, > looking through the code, that wasn't the case. :) Which means that > pblk doesn't work with a devices that implements 2.0. Yikes... I knew > I had forgot a detail when support was added into pblk. >=20 I think you misunderstood; pblk does support 2.0 devices. What happens is that we transform the per chunk WP in 2.0 into the line bitmap to simplify the lookup. The point being that we do not need to create a fictional chunk for 1.2 devices since we do the translation to the bitmap directly. Does this make sense? > There are no empty sector marker in the 2.0 spec, since it uses the > write pointer to know where it is in the chunk. So there is a bit of > work to do there. >=20 Yes. And for 2.0 devices we go and look at the WP, but for 1.2 devices = we need to scan. > Since this properly is a bit more work to do, I'll look into it after = FMS. >=20 Look the comments above. All we need for 2.0 support is in place. We can talk about it f2f. > I'm also moving the explicit coding of 1.2/2.0 chunk / bad block > fixing into core, so pblk can be simplfied, and doesn't have to think > to manage each version separately. >=20 Good. I have a patch I was expecting to send after FMS for moving chunk / bad block out of pblk for the same reason. If you're doing the same thing I can stop looking into it... >=20 >> Chunk metadata is only used to setup the bitmaps on init/recovery. = From >> here on, we use the bitmap to find the next writable sector, without >> worrying about the specific per-chunk write pointer. Thus, updating >> chunk metadata here has no effect. >> Does this make sense to you? >> Javier --Apple-Mail=_3BC33749-B9D9-42B0-9EC1-E5F7699E401E Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE+ws7Qq+qZPG1bJoyIX4xUKFRnnQFAltkRFkACgkQIX4xUKFR nnRIDhAAwqZZEOQQOgUyROwIpb9kJXaHNnQuaXTwRIL96qNoWYEONdKD+E4fRaht ZwxMgU0kGetcgWW/8UY3xQdSA4vEt+X5Mqjc8mgBu3HOB/AxngrJQiw9molf2uSU VIR9+ZWX3lC61ESZs8bC9r+v9dg5Z/l7+oF6Q3+fieK3Fy03tvcB+0STyEf8I+WO FSJ78G3qJIzbHULJvVwksUxOcjUUKLfR7wHL1dJclqRdmJdaixLS8NykK/bjxamD +txxmvGlaSFQh/uGHfO/A9CwXj7sunWugnsrmkGrbNQJf4j+0WBcTEgqipkxj59d z+SF13SpODuy8sBCjiPM/NoTlyPaf4pbHkMhwTxbDP/s647VNnFnZuV70+B4Jo6t DgfzZ2mCtx9cOwk47gmPwHj5qysL8PjjtC1ACerLkn6RFw0Lo8jPILQVyFbTIK5S T6Lloa7POMAEhs5hQnA7+E8Jfx8RbsiJe3zSX8SctL1b03ZFKFHjGtv76XXCLus4 xm3mZrqJuSsf2TxrYGgFTX91RgzFLRc/mqJ45vN2eifvTvuHKvWXFOg35LeRNdUp dM/N9iPOiZ8oX9yOvQpbacPYmWfwmh12vJcyH3vdGHOEM8bUHwvAdfVJ9N3GoozF IEJvXrfM9QIKacsP1yz8ke+IxETckclu9xSkVmAGb/lNFfM1gUg= =QP8u -----END PGP SIGNATURE----- --Apple-Mail=_3BC33749-B9D9-42B0-9EC1-E5F7699E401E--