Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5009894imm; Tue, 26 Jun 2018 04:32:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd48v0O/ToVLKMRJRT+Q3uVVTc0tTyLvg4c+4IKJQcIAmzsI29eZ7e/xaAAD3vFVsmqdIJr X-Received: by 2002:a62:1c43:: with SMTP id c64-v6mr1166344pfc.176.1530012736129; Tue, 26 Jun 2018 04:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530012736; cv=none; d=google.com; s=arc-20160816; b=tkC1EeYuMrgh4QNmF+kb38IiRl3GNAg0Yr1jB3wq6QA6dX5ovusv+QIA4eOBa0IsvE MGBrvKYaMnk9EXHAjVh6ZhH+wh+Kg6ZpF1KPr1eg6RWYbKs/HIH+u6l8wlHY0VuDUIAL I1yeQENAOX5922dHKIwrk9mOLribolrtTzBAaYeYuHxc9oH48J2QA66SpBD2/8ZESRLa hxGaq9Y3SUGcCdziUSbPPlZfslyEQ41qyTD53f3vXOTgm5ucldXja7H776YZfgy1LlRo 0GgcpehVZXw3InJDuqA/W260B2+9rmJvWT5ydGViFNXQMg/A7KguDVLIPuvO0/YOgufC zsnA== 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:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=EpCY7o91CIWQoAQ4iqPLPVYvthNz4Xg9v7H35qFspcI=; b=pF7sSDKrsb50+VcQYG7tLhC49cVfAEQMgn8bw5qjv14OQyHvxjn/XUYqw/oQ4cePhN MT4w49acLx2Pr+yEqQalFbi/UPfoDxwVY9kN7Zy0AesVgBOHA2Vh5wAmtvJvGZrK4nTB Q/WwdC8xe0IOCqxyURadGClAYF85VfrMpyyHtHqo36spyY5hWNUx/eJ+wTFDtIWk9TKg Ayo9FltVc/QPQZE+qz+wtYgHc+5meGdA1J8pHQ0edQxyds9nCqcR5TAaQSF5N1VccOyF gtlhLWpb7WNO7vXU4olDv5/1KvFEXqwuUiM4qpZN0EGtlngFigH55pGc9nTiKxstMjN7 3p3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=elMnYwpg; 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 v73-v6si1453180pfi.22.2018.06.26.04.32.02; Tue, 26 Jun 2018 04:32:16 -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=elMnYwpg; 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 S934710AbeFZLbX (ORCPT + 99 others); Tue, 26 Jun 2018 07:31:23 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:41123 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934597AbeFZLbU (ORCPT ); Tue, 26 Jun 2018 07:31:20 -0400 Received: by mail-vk0-f67.google.com with SMTP id j11-v6so4507615vke.8 for ; Tue, 26 Jun 2018 04:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=EpCY7o91CIWQoAQ4iqPLPVYvthNz4Xg9v7H35qFspcI=; b=elMnYwpguh+LN8drN8QZmvEEa7BE1s0lrAviS/VTm6HvLbNQVzWwlXZVt36gY2iQEe I6VrM6LDGxcYfP+EoSUScuG7thdyd4+5yerJnOLGKKL/wlfrmUbFR+LgUOyy9/VaRk+d 7XI8dkXOneBYdqOuoYTFTkeyoJsl/7GbMLhhbqV0Y7GhIIkBfsK3GGMhkWJaTPZfvrSP BVSTM6Dzv+DwZzRFGYsRQV60HiAkdoJADF7QlFXkcpF83wfKpkp4awiMexEpkq7D+GZB /eS4l3AfPEepq5uMmi6+bQ1RthBC/wQpXQvPXjFGVjP/vSL+xFuJlq3XNxDimSzsKGW8 luwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=EpCY7o91CIWQoAQ4iqPLPVYvthNz4Xg9v7H35qFspcI=; b=GdPFR3iiDHrH10BiOWyezbm80p19lYL3ejcYh9f7dKICq/jE9uNeCL6G4kgBfCpDzu vEcxm4so4cu3n4w+EkuUtRJxOuvkooCZ++ZK2zlaxVr1A63NbCulAW6uzeK12rQJksDd mjfEgDNC7o5sWIxqKfLBSbrjk0X0pc7+5FvzSaPtQY9qOj2JjxcKxITO030g+yXf/0Gs gHaReKRIfndlhIy3mn9WHY+APrJCbsrn+IndzdZzpoW4nhv/gR3a31Z1RYMvYrqo9eku n3nlKEASJie0XdHPOxoBXB66WE2XEXu12sq7cHkVh283q9V2AcNJQFC7o9xNwXoPEt9f 5cLA== X-Gm-Message-State: APt69E0TFsfigFf0pN8YBnkl6IAXHYFUlaJWQzRdIOLP4P4cEs1eA2xz 7Tzz/xCViFXm6F2H0p4yAFyYzE8SQCFkP6cVp2PR7loN X-Received: by 2002:a1f:c204:: with SMTP id s4-v6mr643132vkf.86.1530012679061; Tue, 26 Jun 2018 04:31:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:981b:0:0:0:0:0 with HTTP; Tue, 26 Jun 2018 04:31:18 -0700 (PDT) In-Reply-To: References: <1529399189-3239-1-git-send-email-hans.ml.holmberg@owltronix.com> <1612C143-24C3-4B6F-B745-945EAF684DFC@cnexlabs.com> From: Hans Holmberg Date: Tue, 26 Jun 2018 14:31:18 +0300 Message-ID: Subject: Re: [PATCH] lightnvm: pblk: assume that chunks are closed on 1.2 devices To: =?UTF-8?Q?Matias_Bj=C3=B8rling?= Cc: Javier Gonzalez , linux-block@vger.kernel.org, Linux Kernel Mailing List , 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 Tue, Jun 26, 2018 at 1:38 PM, Matias Bj=C3=B8rling wrot= e: > On 06/26/2018 11:37 AM, Javier Gonzalez wrote: >> >> >> >>> On 26 Jun 2018, at 10.41, Matias Bj=C3=B8rling wrote: >>> >>> On 06/19/2018 11:06 AM, Hans Holmberg wrote: >>>> >>>> From: Hans Holmberg >>>> We can't know if a block is closed or not on 1.2 devices, so assume >>>> closed state to make sure that blocks are erased before writing. >>>> Fixes: 32ef9412c114 ("lightnvm: pblk: implement get log report chunk") >>>> Signed-off-by: Hans Holmberg >>>> --- >>>> This patch applies on: >>>> ssh://github.com/OpenChannelSSD/linux branch for-4.19/core >>>> drivers/lightnvm/pblk-init.c | 5 +++-- >>>> 1 file changed, 3 insertions(+), 2 deletions(-) >>>> diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init= .c >>>> index aa24264..3b8aa4a 100644 >>>> --- a/drivers/lightnvm/pblk-init.c >>>> +++ b/drivers/lightnvm/pblk-init.c >>>> @@ -717,10 +717,11 @@ static int pblk_setup_line_meta_12(struct pblk >>>> *pblk, struct pblk_line *line, >>>> /* >>>> * In 1.2 spec. chunk state is not persisted by the >>>> device. Thus >>>> - * some of the values are reset each time pblk is >>>> instantiated. >>>> + * some of the values are reset each time pblk is >>>> instantiated, >>>> + * so we have to assume that the block is closed. >>>> */ >>>> if (lun_bb_meta[line->id] =3D=3D NVM_BLK_T_FREE) >>>> - chunk->state =3D NVM_CHK_ST_FREE; >>>> + chunk->state =3D NVM_CHK_ST_CLOSED; >>>> else >>>> chunk->state =3D NVM_CHK_ST_OFFLINE; >>>> >>> >>> pblk should scan (or the lightnvm subsystem) the blocks for their >>> state, such that it doesn't have to reinitialize a full drive if it is >>> already in a closed state. If marking closed, it does a full erase >>> cycle on initialization, which should be avoided since it is a limited >>> resource. >> >> >> In 1.2 there is no such state unfortunately. However, pblk will never >> attempt to reinitialize the whole drive - metadata for closed blocks >> will be recovered and only those going to GC will be erased before >> usage. In fact, a full close drive is the state pblk expects. >> >> This patch only affects "unknown blocks", thus the only case in which >> pblk would attempt to double erase is when blocks have been pre-erased >> (e.g., factory or through liblightnvm). After an erase round though, >> pblk will only erase pre-usage. One thing we could do is attempting to >> read the first page of these unknown blocks and mark them as free if >> "empty page" is returned. Is this what you mean? > > > Yes, that is what I mean. > > Note that this can be >> >> costly on large drives; this is the reason we returned to the pre-2.0 >> behaviour with this patch. We are implementing a log that, among other >> things, keeps the state so that pblk can have an accurate state for the >> cases this can be a problem. > > > Yep, it will take some time. Good to hear with the log. Until we have a log in place, this patch unbreaks 1.2 support and has no negative impact on performance (as compared to pre 2.0 support), so please consider it for the next window. The current state is that if a pblk instance is created on a 1.2 disk with written blocks, writes will fail. / Hans