From patchwork Wed Feb 28 15:49:28 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: 10248815 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 8BF0B60365 for ; Wed, 28 Feb 2018 17:11:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AEAA28DFA for ; Wed, 28 Feb 2018 17:11:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F9B128DFC; Wed, 28 Feb 2018 17:11:45 +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 CA6AF28DFA for ; Wed, 28 Feb 2018 17:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933639AbeB1RKs (ORCPT ); Wed, 28 Feb 2018 12:10:48 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37746 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933283AbeB1Pt5 (ORCPT ); Wed, 28 Feb 2018 10:49:57 -0500 Received: by mail-wm0-f65.google.com with SMTP id 139so5992084wmn.2 for ; Wed, 28 Feb 2018 07:49:57 -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=04of3wiwVMzi8ArQxwCIximdo12l72ziKDYoW3n3uWc=; b=UGK+b/rG+p/YD3AKMH5ZnGx2AGtjbDHa6ab9j8DoJBTKPn7yOpsZYd+DU/gUCTBoXw 01zaMEo29P9WmvyzW6MkmMuD6fYeI7Zbq18IH3qhUVEwqCa1xTAD1l9lCBqW56+vpxDP ayYd7oS5TjtN8yW0tXWx99qOVsFqwdZrUkei31AuhT8YScZMLjIhjPb6ygRWDg1xmfQD 5OJfoFyhOrSSaWJpIKqeQcOLaHIddWmkr9Qoh+Sp+gqbVq8mseR9yq1+2z/n5Urfh6CT 3n66jfn3oUC/Vq2l6TytLkOQdyIi009tJ49UK4nDzgxa+pDWtXlVJG2/wIfg0zm7xioV 5ArA== 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=04of3wiwVMzi8ArQxwCIximdo12l72ziKDYoW3n3uWc=; b=ukQYKcRfCBEBkgPoykwMnZiyulJ0oxwkhZhUeeZRGuLE44ZsCvMNdEWpH2MueMPB/3 /01TZBDBq54cKziM3aGg/SkpD13x9k8mk4u07WeTiNOgUqUtKLiVJg+GohysJWFOAWqd sVFVlas01rLefoH2ORP76pHRNpTVQ6wBQon6VBYWw3tvZL95aT0laslgFUB7TN8Y0Jc9 ojK3u1N/FLerJ3oazAYRoINzPFa6fZ17ibMxso0EWLSG3WOGacyeUs70Wm5Mv3yK6ZdM bm4jrkuGaUqBDn2i8SyrGiTNENER2vDRhtx3NQY4TKSIzE7xmbsAAn09E2vUisTNdEbM zYvA== X-Gm-Message-State: APf1xPCHUgyxO/20HT65YBBgOHja0HDXgm7mIfQFHKwMtteXIZjCa+GX SXgjTOJe9awtCSA1kRsUo0Bt8w== X-Google-Smtp-Source: AH8x224GVvOwculpPe5U9VYaBE/U4Jc/NvTbF4fuLq20ktwL9Lx/yCKpAvxk2eT5R1UWSOokBEwAhg== X-Received: by 10.80.204.3 with SMTP id m3mr23769783edi.69.1519832996689; Wed, 28 Feb 2018 07:49:56 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id n2sm1953056edb.62.2018.02.28.07.49.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 07:49:55 -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 08/15] lightnvm: make address conversions depend on generic device Date: Wed, 28 Feb 2018 16:49:28 +0100 Message-Id: <1519832975-25432-9-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519832975-25432-1-git-send-email-javier@cnexlabs.com> References: <1519832975-25432-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 36d76de22dfc..ed33e0b11788 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -581,7 +581,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]); } } @@ -591,7 +591,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 73110adf27ad..e878b95aeec4 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -399,10 +399,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_geo *geo = &dev->geo; struct ppa_addr l; if (geo->version == NVM_OCSSD_SPEC_12) { @@ -427,10 +427,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_geo *geo = &dev->geo; struct ppa_addr l; l.ppa = 0;