Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp739261yba; Sat, 4 May 2019 11:41:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhG84T2WMbsjZs+wl7rCoIVR9WpQdDSnsPwiRqKqPvFSJ+cIXvQ7UoxJzV7mWoSiL87AnT X-Received: by 2002:a17:902:822:: with SMTP id 31mr20291595plk.41.1556995266851; Sat, 04 May 2019 11:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556995266; cv=none; d=google.com; s=arc-20160816; b=XUQxXVDZ2+J8+tpg3Z6BvBeOoclOPncKaNHB/pksTMx+yVLSzC+TgKYdXlERUvEV33 EPEKkPIF2BQTwNOUxg2/1oyuPZa1xsglHwfyu2L3IRawvgfjZZsACq0iwOk61x8oOoeG dwjvBb5S1viu+OFLC+BkCK3p/IleLMWwBJLU78fTB2oX5fOPc6XR6iVeSt1eKo4zVGD8 6dlk8a3dqHudOBEDCDbhOTyDS9stp1jHsuAKGByglkXEahVeSyczYWrj4eQ6J6vXeUIY tM+ZrkWqKQjJRFHVb6kvjJV9T38IEQYrkUnBPXLSY+Y9lHYgA+cs3uAZQYaQ6Q1CtKGG Fsug== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o0cDU1BXv5VFQHPh2ti7WsJqqFC+QgZJXmk2RElz7/4=; b=gtcmz1JMvI7ZegMScD8TnLLJcDs+ke2F8yByvfi6oUCTT2D0yQ5r6bQBH0l4vMrckN M+9Q92xGkY7F3gtWHu067k3GOEdMzZ+XSKqaLApOfrAEQlbi1NtYaVFz3KWOKG+OC0wy X42X+wGZd9ckWVarTcMhb8jNg5CSFBa9SRITrsc3yi97v9kY1Vsr40sMptkKfb41Oliz RKTphgI7ziFQXLgikQoBK8jQAbu1jQxHwXYcoVHOf6YKtAvkTPF13m/x3Rw7xEATjhJg YFxHyEfLxY0ZAlp3tbsbpeqGjmNNCklpHTnNeGq/w4y/GE5O/ctBDkY5BkpAhbSAlJ76 HdLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=Yw9Rt846; 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 e8si1257326pgs.308.2019.05.04.11.40.51; Sat, 04 May 2019 11:41:06 -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=Yw9Rt846; 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 S1727723AbfEDSj2 (ORCPT + 99 others); Sat, 4 May 2019 14:39:28 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37978 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727533AbfEDSiu (ORCPT ); Sat, 4 May 2019 14:38:50 -0400 Received: by mail-lj1-f195.google.com with SMTP id e18so7863704lja.5 for ; Sat, 04 May 2019 11:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o0cDU1BXv5VFQHPh2ti7WsJqqFC+QgZJXmk2RElz7/4=; b=Yw9Rt8462pgPGQNH5YoTD4gO1SUCsji/TdAx5aRzo7lSmutgUdv2tjzEGTH14UPQQ+ gT3Ll8Dbn68+2Ny7OHrxKZsq0pyqitPsTDhH7E9ouZTmeo4av1g4/x0fCDpO6PcMUUPN nofLR2t8f8fhZVZbTt2CV3v1CQ/2F0MGk8AqEjGeyfBw7X+/Dx/yi+OcRdPH0uV381Sy wro9yA675OjNMI6P4WPNQsPDeBd5dL4lg5ZkxkOth2rjhmYFXFX6LKecTR6sHZ+yXO8t HwN0TKLoBpwbcN4ksZf3AbHd+cDte4pU6rmu/Q0/qpynkRHJ3TSHeWEdXHuayWLYssn3 ZTwg== 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:mime-version:content-transfer-encoding; bh=o0cDU1BXv5VFQHPh2ti7WsJqqFC+QgZJXmk2RElz7/4=; b=f5MpuMdnqUJqRci5n+rYUt9OG/HFmn7A/DF0+lBwWRgJ5bH8PZJvQWb32xFrRD6cdi /iY5QgF2JjpEJ0ZFqi1/5+20FqYjbc+hiw7x2/YO63Yh/fAL8ZfmhudRYvirCsn9768O bGb9KK/qH0nWK2WNnmVX7XJvZ7xjFX8yH1lq+Vm/hY4MQnS5d80oThbmHpi4dz9kV0Hm nKrmF8+EtXQQohdUxhMJ+gbfxHcJZOaeEro1bhvBhADLGQN8w5JB7LT/qPzL7NUc+tUi NqH0/j3BWFHaTglv9DjFaCxkA6EdF6BtADt1BTTj4pkq6IoNLsoR3V+sJ2F47zyd79E9 ztkg== X-Gm-Message-State: APjAAAUaMqLgCkzyT9hX+nX5QLKxR3BCZ3c7jbBguthsLbKKYKpdtrhi 1bHyCJKdAZPHyo/YTBEQHX0Avg== X-Received: by 2002:a2e:c41:: with SMTP id o1mr4742110ljd.23.1556995128468; Sat, 04 May 2019 11:38:48 -0700 (PDT) Received: from skyninja.webspeed.dk (2-111-91-225-cable.dk.customer.tdc.net. [2.111.91.225]) by smtp.gmail.com with ESMTPSA id q21sm1050260lfa.84.2019.05.04.11.38.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 May 2019 11:38:47 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Konopko , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 22/26] lightnvm: pblk: recover only written metadata Date: Sat, 4 May 2019 20:38:07 +0200 Message-Id: <20190504183811.18725-23-mb@lightnvm.io> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190504183811.18725-1-mb@lightnvm.io> References: <20190504183811.18725-1-mb@lightnvm.io> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Igor Konopko This patch ensures that smeta was fully written before even trying to read it based on chunk table state and write pointer. Signed-off-by: Igor Konopko Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-recovery.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 865fe310cab4..a9085b0e6611 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -655,10 +655,12 @@ static int pblk_line_was_written(struct pblk_line *line, bppa = pblk->luns[smeta_blk].bppa; chunk = &line->chks[pblk_ppa_to_pos(geo, bppa)]; - if (chunk->state & NVM_CHK_ST_FREE) - return 0; + if (chunk->state & NVM_CHK_ST_CLOSED || + (chunk->state & NVM_CHK_ST_OPEN + && chunk->wp >= lm->smeta_sec)) + return 1; - return 1; + return 0; } static bool pblk_line_is_open(struct pblk *pblk, struct pblk_line *line) -- 2.19.1