Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp420799imm; Fri, 3 Aug 2018 05:48:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc0KIwiH7Zxi+UmNPHAYqz+ocpSKMzi2a/3vplEGDWHzYf0XJvXje9QzAontokEw9JTTr2u X-Received: by 2002:a63:f953:: with SMTP id q19-v6mr3585499pgk.292.1533300517324; Fri, 03 Aug 2018 05:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533300517; cv=none; d=google.com; s=arc-20160816; b=G5pLFqM0tuXGbtdHsLbkO2Yuo13o+3q01J2FxaL+XNKj4zAnkKNzC/XL0vTP3jAS7a 03u45Y8RZxIN6xG+vm3/WPvnGg3mG+qRTxEcZRqp6zVkowMHmOuv/iiCNKQNaeXj12Qb elBKWwGWpIWPI8j+r5xNoeQo2toMaTEJNXvMT6NZFU7chw7kIEJh8uKume62mD7ynvmy 6A8EbQ8bhYkAq4C5/PMZSLp640FHL5kDDGRu5F2VFoZTsA7akFySDkxLY6OopauTTFZ6 b5V84m0OB6TyupvSW26OxSQSpRjGpwidKNeRi5ZAVmsJqRP11pydjFnEvI9V3pQ7BTX3 vSLA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=7XoBpSKfk0FWyKVWnOq156u0R/Z9IeD0Z+KrRVA7WLg=; b=AdUfIHWu2EXYEkDgbo1FELxZjd6K1drhbg742rTOdRomspv0pRxGWF7fZiLhQdqKUn x8SfxJDcUMDVc2Ev0/HYzzr4wOM2T7Ms8CDY521UT+bM/JODwScByg/fOT9S8towj+/S nDn1yz+Qi5ZVoueTeGPYZD/bG7ldRbrZdg9rpMbtAkKUiB6XWRTFPV3/oDJEr1eVFAh2 PN01ALTnA4ePgNi/EEH7A/kvpXX6ut/tR/e5zDfl9Onw/3TaR3YCwNH8OevMtS+0k1AJ wJorOzGyUlcuulk1qT2eHESO0pH539U5C8u9FS2iM6X3BbX5aWUkzEiMmqIUH0kGiVDC zYaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=rFaqybJW; 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 t16-v6si5026296pgj.234.2018.08.03.05.48.22; Fri, 03 Aug 2018 05:48:37 -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=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=rFaqybJW; 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 S1731689AbeHCOmz (ORCPT + 99 others); Fri, 3 Aug 2018 10:42:55 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35722 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728647AbeHCOmz (ORCPT ); Fri, 3 Aug 2018 10:42:55 -0400 Received: by mail-lj1-f196.google.com with SMTP id p10-v6so4862874ljg.2 for ; Fri, 03 Aug 2018 05:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7XoBpSKfk0FWyKVWnOq156u0R/Z9IeD0Z+KrRVA7WLg=; b=rFaqybJWDwYwckAStY2kljT4cnLOjNoYP6P6Pg7i2MQimQK7wSByAbWcaO0GzYZntA n+raBWVXXZSayjLMYmt1bHlUYdA0nWxeyeLnV6DwUO3+tYOWTeyNLCxL1VLcVb9UPiq3 fuZdLxrKeUGE0vu8Q/90cApLUf02mw6JlJ8dQaOP6ZsdJhQWW50lH9EAfMR6J5VPxEAs uftqMz2A20XdomBwLKXYjtL1GzLed7RKudkHsBnkoFibWNM7fnfu3IINeOda4gFDfVPD +V4KKv47MGbzaAd8+E0cFetZ6SMoZ7Pp8WNxS0vfMcuOiH2lbQwXkZLGPX3VWVlMnSe5 LnNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7XoBpSKfk0FWyKVWnOq156u0R/Z9IeD0Z+KrRVA7WLg=; b=USKGKi+1lbn2yYA6YRQmDKfa0qF4eiuNN86ilPyELfFS3U6c0pfl1s3Ug/gDBkDs/r DRPWB9JQ7uIo9khE8NtJHt2yenR5SJj9YNwAb1kJZLgj1aB0ebbefSHpOna6GM8ZfgWl g73fhU+toNTI11hoy8Hi5XwkFY8ZcPg31pZK7TJCVv/jXGL0Qkb3ZLq3Gm/ZTKKKzifw q++yJzjGGD8iH1un157Dg3LZK5rS5A0E3xJERu13ElI6NArg06InlomkZqL3yBTyQKKw cOcm2bHD9247HKae+Mqx5YWAo9W7o7WlUJhLncSwMUXfWT7QldN/tNxIqq8CYOcsD9Zj H9CA== X-Gm-Message-State: AOUpUlHtvEN44QzTPf21amr/IMUllH1g2PnaoWu8r3LKeum9lGwWrvcQ rDpjciUJy2uG6ikOy3Kmg8YYAv5oYacNhA== X-Received: by 2002:a2e:6505:: with SMTP id z5-v6mr5222402ljb.62.1533300401692; Fri, 03 Aug 2018 05:46:41 -0700 (PDT) Received: from [192.168.0.10] (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.googlemail.com with ESMTPSA id n7-v6sm703195lfe.87.2018.08.03.05.46.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 05:46:40 -0700 (PDT) Subject: Re: [PATCH] lightnvm: pblk: recover chunk state on 1.2 devices To: javier@cnexlabs.com Cc: hans.holmberg@cnexlabs.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org 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> <88659F4F-8105-41CA-B0B8-849E707F18CD@cnexlabs.com> <423c5d4b-6d9a-d233-d3da-f2cb8b10f880@lightnvm.io> From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: Date: Fri, 3 Aug 2018 14:46:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/03/2018 02:37 PM, Javier Gonzalez wrote: >> On 3 Aug 2018, at 14.30, Matias Bjørling wrote: >> >> On 08/03/2018 02:02 PM, Javier Gonzalez wrote: >>>> On 3 Aug 2018, at 13.57, Matias Bjørling wrote: >>>> >>>> On 07/24/2018 09:54 AM, Javier Gonzalez wrote: >>>>>> On 29 Jun 2018, at 13.28, Matias Bjørling wrote: >>>>>> >>>>>> On 06/29/2018 01:22 PM, Javier Gonzalez wrote: >>>>>>>> On 29 Jun 2018, at 13.14, Matias Bjørling wrote: >>>>>>>> >>>>>>>> On 06/28/2018 11:12 AM, Javier González 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). >>>>>>>> >>>>>>>> It should not be specified in the spec. It is up to the device to handle >>>>>>>> double erases and not do it. >>>>>>>> >>>>>>>>> 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. >>>>>>>> >>>>>>>> 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. >>>>>> >>>>>> 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. >>>> >>>> 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. >>> 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? >> >> The chunk->wp isn't used anywhere. So it can't take wp into account. >> It uses the EMPTYPAGE marker from 1.2 instead. See pblk-core and >> pblk-recovery. >> > > I see that the patches for this are still internal. Will post for 4.20 > Thanks. Please also put a Fixes: on, so it gets backported appropriately.