From patchwork Fri Oct 13 12:46:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10004531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92BEF60216 for ; Fri, 13 Oct 2017 12:53:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 854B629002 for ; Fri, 13 Oct 2017 12:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A5062905C; Fri, 13 Oct 2017 12:53:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A97229002 for ; Fri, 13 Oct 2017 12:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758497AbdJMMw6 (ORCPT ); Fri, 13 Oct 2017 08:52:58 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:47443 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758302AbdJMMrv (ORCPT ); Fri, 13 Oct 2017 08:47:51 -0400 Received: by mail-wm0-f67.google.com with SMTP id t69so21255871wmt.2 for ; Fri, 13 Oct 2017 05:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GJ904MqxORfdXswJgoT0RRhQxOb6z6weDKn+DiYI4IU=; b=Z+iQnlyHHCvkMgGr4udRZLtw7blWzzIfW4Hl8pfMS8/VVW/n7jXhXbI73P1wi2wAqL hfBXSp2KjU0qQtfRs4Ni53KLgBUzpP1qeIFl3rmnpnMczCxkUFd92AIDDjSf7mL9mYJ/ /qKFUNJL4RSLa2WNH8Uml4v4Xfn+zuyHt4ZNA= 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=GJ904MqxORfdXswJgoT0RRhQxOb6z6weDKn+DiYI4IU=; b=MjVAAe8y4JGWy/d0yE0i2ZRTosBz5xvuYxX6LQjHTGqCfW+H2AamZtkHfsGbkBTZW9 SIpDYgSAwHqvR8lZf1BIxiXMD0ATHRlafcRse3m+o+WZzjlyi4RkFTrV4eUc5+N8BU4/ qnPRzQXtg8puJrOg/BmAukxgc49vTvQDUwSk2vyrvqU3UyeQVSTOPyAHaXWigLAKvqFo +nrkGnH8WMnGQeXeD2G1zCCWJrD1SBH2rGZqgDgZQZF7tL/AAPHDtWCIVSYaPki1T2ai b81RF6J7nPBZol9o8GmZa1jd0zUAdy1Ih/JQO+6tw5JbyFPyLUfu4WYVFEKDt0LHokj8 O+7A== X-Gm-Message-State: AMCzsaWLr3mWyHRWgznIoXOSpbIWtmvOXrfG6OrcThEiFO96maF0q7ZZ PaNsCKy8aU7p1xmrbu/tpq8xYQ== X-Google-Smtp-Source: AOwi7QBzZvgRxl+o8gnLx1v3324NX2T8aWPJ5CoOVQSamsWUPc1TWn9xOfFaFU6K7bwi6xHr54YRmQ== X-Received: by 10.80.179.185 with SMTP id s54mr2051103edd.164.1507898870716; Fri, 13 Oct 2017 05:47:50 -0700 (PDT) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p91sm735012edp.69.2017.10.13.05.47.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 05:47:50 -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, Hans Holmberg , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 46/58] lightnvm: pblk: recover partially written lines correctly Date: Fri, 13 Oct 2017 14:46:35 +0200 Message-Id: <20171013124647.32668-47-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171013124647.32668-1-m@bjorling.me> References: <20171013124647.32668-1-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Holmberg When recovering partially written lines, the valid sector count must be decreased by the number of padded sectors in the line. Update line recovery to take all ADDR_EMPTY(padded) sectors into account. Signed-off-by: Hans Holmberg Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-recovery.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 686bc17..a080cf8 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -133,8 +133,8 @@ static int pblk_recov_l2p_from_emeta(struct pblk *pblk, struct pblk_line *line) struct pblk_emeta *emeta = line->emeta; struct line_emeta *emeta_buf = emeta->buf; __le64 *lba_list; - int data_start; - int nr_data_lbas, nr_valid_lbas, nr_lbas = 0; + int data_start, data_end; + int nr_valid_lbas, nr_lbas = 0; int i; lba_list = pblk_recov_get_lba_list(pblk, emeta_buf); @@ -142,10 +142,10 @@ static int pblk_recov_l2p_from_emeta(struct pblk *pblk, struct pblk_line *line) return 1; data_start = pblk_line_smeta_start(pblk, line) + lm->smeta_sec; - nr_data_lbas = lm->sec_per_line - lm->emeta_sec[0]; + data_end = lm->sec_per_line - lm->emeta_sec[0]; nr_valid_lbas = le64_to_cpu(emeta_buf->nr_valid_lbas); - for (i = data_start; i < nr_data_lbas && nr_lbas < nr_valid_lbas; i++) { + for (i = data_start; i < data_end; i++) { struct ppa_addr ppa; int pos;