From patchwork Thu Mar 29 22:05:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10316527 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 724DB60383 for ; Thu, 29 Mar 2018 22:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CA042A53A for ; Thu, 29 Mar 2018 22:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5197F2A543; Thu, 29 Mar 2018 22:11:03 +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 D11A82A547 for ; Thu, 29 Mar 2018 22:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751868AbeC2WKr (ORCPT ); Thu, 29 Mar 2018 18:10:47 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34973 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752675AbeC2WHb (ORCPT ); Thu, 29 Mar 2018 18:07:31 -0400 Received: by mail-lf0-f66.google.com with SMTP id t132-v6so10362462lfe.2 for ; Thu, 29 Mar 2018 15:07:30 -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=EtZl2VgEknpn3QOAB5pg/Yn4yWcz42Jpx4iaN+3E3cE=; b=XmfWq65bhvAM8U+ysPnoNAPXizCi7v4pCNOY6Kv/hiyyVYsm2/N+PfhYetV/237OwT ZCjKl9RtPYCsClnP4EovL7OpRNIvTHTfq89MnwgcIOJ3i++6JyZCC1hV+dhGnqzG6dG8 lUk5Mwht6REgNL8aSVvHTpS90JeExNl/ldsuEHckz95SMFTyTKKKcGiUC1AYwJYm3m1M 7roTJYLnvxWCVfzg1QhcCVldkjrQq01JKukXLKoUGrLMOZosI7uu0zco/2V8Vy9R1ff0 v0pmNMRQlHhsXQ6vNBjLVTmzOA7pHcEfiRLwEuF3rfFA1Weyk+4gLgNfcq7/0hT24iCo cleg== 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=EtZl2VgEknpn3QOAB5pg/Yn4yWcz42Jpx4iaN+3E3cE=; b=WwiJ9nfcvY02nexQT1eimU8kUyqx/xsr6GUExlgGbvhrPfoCQ5Zs42Bf8YdLWVh13z M03DLyPwyD2nrHSCRShLLKB0HJYTIQy5WpLAwOyuuKCK+jyzwdHms6MJaQsChzNF7uck ZsEhD8Ge8TNIFBBu/61/TMs6I3bDRDwiJUQdC3JdbXyiW89ThjwTt1KFVQpvrRX1Swk5 gDS15oUD+8jkYSGwdIEIqYAf3tRps5RlsMHz8DTzfbtvdizy9DyFgA0oWO2rPFODIxz2 FWJUB8QfoZJYXRLvpNKrfi0I7aJtqUy3g6icKN+W0HUpsX1IJkLq93X6RK59vI1qRYsm VaVA== X-Gm-Message-State: AElRT7Fwsv/w4EkIoBG3Uhqg1PUSemMtTqOc1FsNlYhTF0Xi6OfdiLMa 5tVIhcfCnB8OJUIuigRM2rsU0g== X-Google-Smtp-Source: AIpwx4+UDLhokWYKAB8SfhTXOYRzxhwEre0ekYWDoXVV7yIdCz3PbZNwNPlg1c0ghiAf4TQXs3zcaA== X-Received: by 10.46.134.141 with SMTP id l13mr6314436lji.5.1522361250163; Thu, 29 Mar 2018 15:07:30 -0700 (PDT) Received: from Macroninja.cnexlabs.com (x1-6-a4-08-f5-18-3c-3a.cpe.webspeed.dk. [188.176.29.198]) by smtp.gmail.com with ESMTPSA id i89-v6sm1365508lfk.12.2018.03.29.15.07.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 15:07:29 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, keith.busch@intel.com, javier@cnexlabs.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 29/37] lightnvm: make address conversions depend on generic device Date: Fri, 30 Mar 2018 00:05:16 +0200 Message-Id: <20180329220524.30363-30-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180329220524.30363-1-mb@lightnvm.io> References: <20180329220524.30363-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 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 Signed-off-by: Matias Bjørling --- 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 63d948cc6dec..77901bf17416 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 f2549b4b8626..f3b273e543c3 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -397,10 +397,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) { @@ -424,10 +424,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;