From patchwork Wed Feb 21 09:26:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 10231641 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 A4BD360392 for ; Wed, 21 Feb 2018 09:30:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB76528AA6 for ; Wed, 21 Feb 2018 09:30:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E6DC28AAA; Wed, 21 Feb 2018 09:30:08 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 1A3F128AA6 for ; Wed, 21 Feb 2018 09:30:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753123AbeBUJ3y (ORCPT ); Wed, 21 Feb 2018 04:29:54 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44651 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753344AbeBUJ1Z (ORCPT ); Wed, 21 Feb 2018 04:27:25 -0500 Received: by mail-wr0-f194.google.com with SMTP id v65so2422313wrc.11 for ; Wed, 21 Feb 2018 01:27:24 -0800 (PST) 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=6m0Va0x6DGhLKIt0V3e+kvSa4KlHg+FWcnyTNXQcRV4=; b=S6bJUq42mOt03iZmzbfYz/52zsLxuJrPwTQgGck4KfJ+BVpYpgKlWN+ueqI0dz3hyv yyOmCukViCHucoQPM8Yu+M9pMTMSQTdREyoWhWyurqMkEqpygCeTZ9CmQSQbFXIUuKjY aVi1foOBrAbEiY1Pixjgt7iAHjf9yuRY0PX8mLkQy8/40shx7x6A3/wHFQn7mMlbJ4a/ 8/G33vvV2esERWa9sn43jXHkDqj821fxZCEJHzBjqSyS5KcYLmwSryscE9FZ+IXgXWCP kBOA8Efq2n9rnjpOL12mrNG30AaaR4Uhr/fvPLVD665vxzmaEJHHg34Du5iV8HZRLtcs xWqw== 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=6m0Va0x6DGhLKIt0V3e+kvSa4KlHg+FWcnyTNXQcRV4=; b=bDD3eQTz1vf6bsKiG/VUbVbLESG44AueBB/jnFNIm/wv5LmOn4TZpObdUS4cE2phNY WDR4UzLZPOnk8rNvCvHKV2UoOifTRcUDzMpSZB0mRLwuGGzP8gA610yLbqCq+W6v743f apaSIaB/O31mDpmWkqXh9mCyCcicaW/hcBKQLgQOuiGzxV+k+/KRw2x+CdlzaEEFqvlN f4fk8fFj59IO487FMNBIj8xiuIAVGr09f2/bSF9VFslusVz9yHLCjXEb6/39znN/SYlZ WdCmTjYfGP8Z8/shQx/+yIpg6Rc1Q1E0hXbJ8wurX9tmTq1OqvtmGOEcWYv3l3t7KQQ5 xgsw== X-Gm-Message-State: APf1xPD3zs2shQtXVdgk1kZ+SUqEfxbA6xRt2Q+aCW8wIg+hYEM8cnZN Keh3rA3A/g1myL9YR59q9+zLpQ== X-Google-Smtp-Source: AH8x227i0AepBxUWuVEwhs7sFdsevbi+xpkg8b4nMb9mHseIw+yPz6L4GSCSk4vYqwX9US+YU+hqSg== X-Received: by 10.80.244.161 with SMTP id s30mr4074292edm.262.1519205244209; Wed, 21 Feb 2018 01:27:24 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id a17sm3389955eda.42.2018.02.21.01.27.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 01:27:23 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 14/20] lightnvm: make address conversions depend on generic device Date: Wed, 21 Feb 2018 10:26:52 +0100 Message-Id: <1519205218-26994-15-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> References: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> 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 On address conversions, use the generic device, instead of the target device. This allows to use conversions outside of the target's realm. Signed-off-by: Javier González --- drivers/lightnvm/core.c | 4 ++-- include/linux/lightnvm.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index baec963b2c96..59b62ca65596 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -588,7 +588,7 @@ static void nvm_ppa_tgt_to_dev(struct nvm_tgt_dev *tgt_dev, for (i = 0; i < nr_ppas; i++) { nvm_map_to_dev(tgt_dev, &ppa_list[i]); - ppa_list[i] = generic_to_dev_addr(tgt_dev, ppa_list[i]); + ppa_list[i] = generic_to_dev_addr(tgt_dev->parent, ppa_list[i]); } } @@ -598,7 +598,7 @@ static void nvm_ppa_dev_to_tgt(struct nvm_tgt_dev *tgt_dev, int i; for (i = 0; i < nr_ppas; i++) { - ppa_list[i] = dev_to_generic_addr(tgt_dev, ppa_list[i]); + ppa_list[i] = dev_to_generic_addr(tgt_dev->parent, ppa_list[i]); nvm_map_to_tgt(tgt_dev, &ppa_list[i]); } } diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index cd310bf06051..91340998f0c3 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -415,10 +415,10 @@ struct nvm_dev { struct list_head targets; }; -static inline struct ppa_addr generic_to_dev_addr(struct nvm_tgt_dev *tgt_dev, +static inline struct ppa_addr generic_to_dev_addr(struct nvm_dev *dev, struct ppa_addr r) { - struct nvm_geo *geo = &tgt_dev->geo; + struct nvm_dev_geo *geo = &dev->dev_geo; struct ppa_addr l; if (geo->c.version == NVM_OCSSD_SPEC_12) { @@ -443,10 +443,10 @@ static inline struct ppa_addr generic_to_dev_addr(struct nvm_tgt_dev *tgt_dev, return l; } -static inline struct ppa_addr dev_to_generic_addr(struct nvm_tgt_dev *tgt_dev, +static inline struct ppa_addr dev_to_generic_addr(struct nvm_dev *dev, struct ppa_addr r) { - struct nvm_geo *geo = &tgt_dev->geo; + struct nvm_dev_geo *geo = &dev->dev_geo; struct ppa_addr l; l.ppa = 0;