From patchwork Wed Jun 29 14:41:54 2016 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: 9205487 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 87C946089F for ; Wed, 29 Jun 2016 14:44:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79FA528667 for ; Wed, 29 Jun 2016 14:44:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F09B2866C; Wed, 29 Jun 2016 14:44:31 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 EC3612866A for ; Wed, 29 Jun 2016 14:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753018AbcF2OnO (ORCPT ); Wed, 29 Jun 2016 10:43:14 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35394 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbcF2OmX (ORCPT ); Wed, 29 Jun 2016 10:42:23 -0400 Received: by mail-wm0-f67.google.com with SMTP id a66so14847123wme.2 for ; Wed, 29 Jun 2016 07:42:17 -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=9FozYQ4wXAk8ynhsWXK8goQGzKKFXsJqDpMRAMqit7M=; b=SDi/aZrRb5ZXVKaCL3nljzZT+3Ul2LKM5e5+HDslXw+dhSV/4s4KdN1INLKLuLHvVY Nkrq2vMcuQ6rD+2HeRz7ficyEL47RXsei3JNWHC8mueTuHP9Tj/8gHocoVa1tsDGDdcZ z7auaHsDCOAxPXe+wR5HS2jiv0/NvXGqH8pZw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9FozYQ4wXAk8ynhsWXK8goQGzKKFXsJqDpMRAMqit7M=; b=KlVU39tiD2hwCOVec3n1e3waHJxFXfKLHoGHc6CNa1NroXae2B3LkN/RDglAtizLCE 70vm9ONZeyB/AW7agJE7Rx9y3LGsFgjhRSlCvSs3k5ljWqfG2rTBb002gKPAwGwyEJRS yt3pVpxIbGGlzF2DFhP7pfZRuqTjYw5XHwMYKOo/bMBNb+3vfhDHVHKng/wClJPdxXlU ry1fg8vxIAiZl3UKb+62q5RIEvV5NiY84AcNNBLBj59cBIaEQ2TfxcHTkpsWdQGwlU6F Dtw0PC27ekT6kqlnOFz0DK2X8sZc7/DUiBUdl/yEwQVUNZvJhaqTtmN6Iqn9i2EnvAmy kdCw== X-Gm-Message-State: ALyK8tLLkAqcWhL0aJUWLsuwNFsR/H5z1NTlL/jYqrlFOCDBFO/B2jegQcRUZ6FmVzZWdw== X-Received: by 10.28.167.69 with SMTP id q66mr9804563wme.100.1467211336335; Wed, 29 Jun 2016 07:42:16 -0700 (PDT) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id t190sm5472766wmt.24.2016.06.29.07.42.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jun 2016 07:42:15 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [RFC PATCH 09/11] lightnvm: fix lun offset calculation for mark blk Date: Wed, 29 Jun 2016 16:41:54 +0200 Message-Id: <1467211316-22373-10-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1467211316-22373-1-git-send-email-m@bjorling.me> References: <1467211316-22373-1-git-send-email-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 The gen_mark_blk_bad function marks the wrong block when a block is on a different channel. Fix the index calculation, so that it updates the correct block. Reported-by: Javier Gonzalez Signed-off-by: Matias Bjørling --- drivers/lightnvm/gennvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c index c65fb67..b74174c 100644 --- a/drivers/lightnvm/gennvm.c +++ b/drivers/lightnvm/gennvm.c @@ -542,7 +542,7 @@ static void gen_mark_blk(struct nvm_dev *dev, struct ppa_addr ppa, int type) return; } - lun = &gn->luns[ppa.g.lun * ppa.g.ch]; + lun = &gn->luns[(dev->luns_per_chnl * ppa.g.ch) + ppa.g.lun]; blk = &lun->vlun.blocks[ppa.g.blk]; /* will be moved to bb list on put_blk from target */