From patchwork Tue Oct 3 10:05:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 9982117 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 4259560365 for ; Tue, 3 Oct 2017 10:08:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E966201B1 for ; Tue, 3 Oct 2017 10:08:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3339A28885; Tue, 3 Oct 2017 10:08:53 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham 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 ACBEC28772 for ; Tue, 3 Oct 2017 10:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751801AbdJCKIu (ORCPT ); Tue, 3 Oct 2017 06:08:50 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:48256 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbdJCKGv (ORCPT ); Tue, 3 Oct 2017 06:06:51 -0400 Received: by mail-wm0-f47.google.com with SMTP id i82so13415369wmd.3 for ; Tue, 03 Oct 2017 03:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cRhFf+w6BqeM8G6QUIbdGrwU2EdG74kCpk7jbVLUyAU=; b=sKIcbHcZkOeUMfU15zIcZDOz5+MnQ3dBiSMup9deUWINCSrHuCJAdc2qalg7YcCXVC P/Fx51veYR0kFBqRUZODxR0IQOmlDwUKqCOGJUegWQL1Jm5Lm9XQFxlaAG1DI9LykNT+ HoFzTNwz1U9+lRb+qwsZt9QDRyzF1ASWzEzIyTjUtMbP2lMa2GJrLVfK1YbKtTO4F03c nRN8kTGPtyTZv0U0XWUaLvCPiC2L7nadqPfKbDp1dbktOO5i6m4o2mKmIqC2OHcMEUB+ DW+hQeaoOlNG1GM/dUnADmhMRj97mpF4djWHHamY+HJr9d4gqmvmUdECuF3I6Id4NOYu Xvkg== 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; bh=cRhFf+w6BqeM8G6QUIbdGrwU2EdG74kCpk7jbVLUyAU=; b=ff87UW2T5ndf9TLBQa+pXF1P2OAqrLmwSxpjA/BRYasKsrzctUsIG+Vtetl4TbZ4Gc 2n0Av6TLix4Lj6dMjIodtoYANSdMaWRCctblCRBh1umAuuhv7EtwEF2SkmSxWObPrqqN JYrcjnq7IKBmlTco3GxBTXAu2NfJ1W6L1XdnUWkva/1WhW19eVHE2hJDps4NXVZJqwTW gkWVPEypjEmX29+KG3cbQwG7/eJ5ebnjcl+nuCoTut2aPWBprgOPjGeo5xTSclwJw1g1 KWwnrZWS7Rj0nJZFUK5feSK5iwaNl+EQx02LLJe6XyobFrD5Qqfxuvif+kUJ22vvyxAu vYAA== X-Gm-Message-State: AHPjjUgseKn5etY606+CVMkY2mK+MzlC/hXmpqMEsqEeqwgfNTv67nhR X4VwshPA80zBzPEhEfvJ2+wEOt2BSLY= X-Google-Smtp-Source: AOwi7QCmu7FrKOSlSHsfBtZB8o8Ab1Ue7NUP6LBY62pt8SXBBTReXZkW7GuJaq3sK53YsON1x5nuSQ== X-Received: by 10.80.135.157 with SMTP id a29mr23338686eda.112.1507025210789; Tue, 03 Oct 2017 03:06:50 -0700 (PDT) Received: from titan.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id e50sm10594908ede.18.2017.10.03.03.06.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Oct 2017 03:06:50 -0700 (PDT) From: Hans Holmberg To: Matias Bjorling Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Gonzales , Hans Holmberg , Hans Holmberg Subject: [PATCH 2/9] lightnvm: pblk: recover partially written lines correctly Date: Tue, 3 Oct 2017 12:05:06 +0200 Message-Id: <1507025113-13351-3-git-send-email-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507025113-13351-1-git-send-email-hans.ml.holmberg@owltronix.com> References: <1507025113-13351-1-git-send-email-hans.ml.holmberg@owltronix.com> 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 Reviewed-by: Javier González --- 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 1869eef..74b3b86 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;