From patchwork Tue Oct 9 11:11:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96BEB112B for ; Tue, 9 Oct 2018 11:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75B2A28A45 for ; Tue, 9 Oct 2018 11:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A3A428A6F; Tue, 9 Oct 2018 11:16:41 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 2527B28A69 for ; Tue, 9 Oct 2018 11:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726582AbeJISbM (ORCPT ); Tue, 9 Oct 2018 14:31:12 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39023 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727714AbeJISbL (ORCPT ); Tue, 9 Oct 2018 14:31:11 -0400 Received: by mail-pg1-f194.google.com with SMTP id r9-v6so652537pgv.6 for ; Tue, 09 Oct 2018 04:14:45 -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=4gU25pj7KCGrk1A426M+00ETc+HESZlocWN9LctXo8U=; b=LkipdUf/i8NztQo9WFikm4b5nrXqX1Xgl+sK8rWKgZWCXQYYTJ/Gt6MdoDEcCMqnRm GqQiRiyeJR5HAQyPmHr9LxBKVdqv942gNWg7M4d2C2e4YB4h1cPJJw6hhALuZRtbMUNV JTqjPgv+sYgtJ/2fZUYnkLjwHydy0oPYy8AGNDaAK0PENzfi2IItc9tu+zzrPchisK17 OVsSaq2KieYlaU0rgnBfC/BxnHdBAKTcErAfKiRQ3LBJQYuJorn+LQ7CA6RZMbut0ett V5lY4+la9Mg4/UEPkFys9OxvGdkedWLi4r2yBEBzG9acR36a352JNDA4fID6ltH9owdg Ha/A== 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=4gU25pj7KCGrk1A426M+00ETc+HESZlocWN9LctXo8U=; b=XLgDqRX4clybIvhJKQNvH5S+3mGbk7PMLmL1TNURlpC1OAEp0mJKJDW/6X0YGchSZ5 hkYKsRDXXGTkoEIUBf7JpiUGzkS5FYpa4l4E8HRQxdmjXg1Aymn4NzqfRfcZRQv0tzRM n2T5/mTwf+irpnaDJNx7TODzs0Bthu7iyu045Vjlipi60dS8rShVgoYrM5UPzUrPgz3r HnAzLTXjGIs2Ak2huTzhJumFIpMQr40vLZuViyiJr4R3XzEG7mZWOogLYB6Q4eexW6GH 0dnXKSxnAp4+dlOhogCcHPjs1ASX/8yX1LOvgeVqu0iajKeLrro/qXikZ/E0qqZWrfcV anZQ== X-Gm-Message-State: ABuFfohoBmjRFuqb8YIqaIBnpTghakrzO3hE0t3Nw5pbZrZaE1n6MqXr 5aA/kU1CCiSImt3RQPyCyQ5Gvw== X-Google-Smtp-Source: ACcGV63VFTYuOJ4Q3T5v/m58AZXSetIHAjysrkM6s8ecwpa6XRuP8jnj2CbvzOrNjV3aQsyM2HQlKQ== X-Received: by 2002:a63:a012:: with SMTP id r18-v6mr25670687pge.282.1539083684593; Tue, 09 Oct 2018 04:14:44 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:14:43 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Jav?= =?utf-8?q?ier_Gonz=C3=A1lez?= , =?utf-8?q?Javier_Gonz?= =?utf-8?q?=C3=A1lez?= , =?utf-8?q?Matias_Bj=C3=B8rling?= Subject: [GIT PULL 27/45] lightnvm: pblk: calculate line pad distance in helper Date: Tue, 9 Oct 2018 13:11:57 +0200 Message-Id: <20181009111215.7653-28-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-1-mb@lightnvm.io> 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: Javier González If a line is padded, calculate the pad distance directly on the helper being used for this purpose. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-recovery.c | 13 ++++++++++--- drivers/lightnvm/pblk.h | 8 -------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 0322ab915ddc..8036c3eb6372 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -380,6 +380,15 @@ static int pblk_recov_pad_oob(struct pblk *pblk, struct pblk_line *line, return ret; } +static int pblk_pad_distance(struct pblk *pblk, struct pblk_line *line) +{ + struct nvm_tgt_dev *dev = pblk->dev; + struct nvm_geo *geo = &dev->geo; + int distance = geo->mw_cunits * geo->all_luns * geo->ws_opt; + + return (distance > line->left_msecs) ? line->left_msecs : distance; +} + /* When this function is called, it means that not all upper pages have been * written in a page that contains valid data. In order to recover this data, we * first find the write pointer on the device, then we pad all necessary @@ -495,9 +504,7 @@ static int pblk_recov_scan_all_oob(struct pblk *pblk, struct pblk_line *line, line->left_msecs += nr_error_bits; bitmap_clear(line->map_bitmap, line->cur_sec, nr_error_bits); - pad_secs = pblk_pad_distance(pblk); - if (pad_secs > line->left_msecs) - pad_secs = line->left_msecs; + pad_secs = pblk_pad_distance(pblk, line); ret = pblk_recov_pad_oob(pblk, line, pad_secs); if (ret) diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index a2cc581951ef..d123cff82589 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -986,14 +986,6 @@ static inline int pblk_line_vsc(struct pblk_line *line) return le32_to_cpu(*line->vsc); } -static inline int pblk_pad_distance(struct pblk *pblk) -{ - struct nvm_tgt_dev *dev = pblk->dev; - struct nvm_geo *geo = &dev->geo; - - return geo->mw_cunits * geo->all_luns * geo->ws_opt; -} - static inline int pblk_ppa_to_line_id(struct ppa_addr p) { return p.a.blk;