From patchwork Thu Jul 7 07:54:21 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: 9218039 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 B4E38607D9 for ; Thu, 7 Jul 2016 07:55:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA0ED2878E for ; Thu, 7 Jul 2016 07:55:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DBA128790; Thu, 7 Jul 2016 07:55:55 +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 49AE42878E for ; Thu, 7 Jul 2016 07:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756649AbcGGHzw (ORCPT ); Thu, 7 Jul 2016 03:55:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33516 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933206AbcGGHyv (ORCPT ); Thu, 7 Jul 2016 03:54:51 -0400 Received: by mail-wm0-f68.google.com with SMTP id n127so998056wme.0 for ; Thu, 07 Jul 2016 00:54:50 -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=F74pxPYWPCB4hPW6hg2ry4xHZjgDoZta9tunw/4UAozeEDnRal8yj78W6djNM51h++ JLAIIpafcRhy7DzKOgKk/nIrRUW3lS/nRuJkw0LEeGKCZLWkrgZ5buTsBu1tXNUVsfFI UJvULsydXZwGwfLQEfONk68u7EkReF6lOpgQU= 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=eLRvuAMg6rMG+H+wH2C82amMEQo1Mb2S1vDhAPEn6O5XNL5dWtjhOlwXXAncaHe8Kl ejAkewjQ/D//T1NkxvNag2siP7kVEqaNc6JIjP28mNHRbDXDmZerPUg2ETBVvusD1ONu ZKRPye34d5jCejeLx9KHyFbDNLY+k9WeOEyvDy/aKzjrB1j402yIXt/MfcvAPDGswwny JJEPghHbh8sDXD95LpjgNCu6u6ML3GZWk2brZi/JFyXUsZSrDVg29iP9R44A004iPwph tBlaBFAJ9WYdSc0CBo0KywAt15S963fxdnaCi85YX7huI4fcX3PUGIjRSM3AVp7EJLNX tISA== X-Gm-Message-State: ALyK8tKrnqj6Z378mENzmUxXxSgL+I0a6w1x7uONDfYI/VglM8i14SplWbtyftX5eEQwwA== X-Received: by 10.28.60.5 with SMTP id j5mr1471013wma.26.1467878089985; Thu, 07 Jul 2016 00:54:49 -0700 (PDT) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id i74sm1654796wmg.21.2016.07.07.00.54.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 00:54:49 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 15/17] lightnvm: fix lun offset calculation for mark blk Date: Thu, 7 Jul 2016 09:54:21 +0200 Message-Id: <1467878063-22919-16-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1467878063-22919-1-git-send-email-m@bjorling.me> References: <1467878063-22919-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 */