Received: by 10.223.185.116 with SMTP id b49csp6425987wrg; Wed, 28 Feb 2018 09:11:57 -0800 (PST) X-Google-Smtp-Source: AH8x226003ool/zcHmNJnbuX4YHvUiz+eY5AiiHqZFIQrw3LNxgIv8Z8yydSZJfP0d5hNT7R0ItS X-Received: by 10.99.110.133 with SMTP id j127mr14927443pgc.79.1519837917257; Wed, 28 Feb 2018 09:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837917; cv=none; d=google.com; s=arc-20160816; b=ElI6mxuid3ZgVtrw1ClTOOBsy33NDAbdaBB1SMUPG78tXLWEufnTj3tb2zL6ykUVjb FypBnKwyKtmRDjWmhJN1hbsjX8kG/QAeunqt/Gev4BGFfISgQTy0v9mBp7f2bwju24LX 0IN708hfJeNCi8kZG/c/nRha9ufTR28BzMbPV4tKEUpdtsUv8upDz97yWS8+IJYF0Xq0 Oa3y8Nx33hiMAaqMRgN48N6gMYsZoHd39ScH5IwAaTm1IZUmnSNEx5AjlhyFqR2fenYs c9rLE/QynF1ZE6m1kIlntVLWkG3FxQFsoxpKMQ0ZGI4VE5GKcxIsm2MxoN1rccaxv5iv ggrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=04of3wiwVMzi8ArQxwCIximdo12l72ziKDYoW3n3uWc=; b=0QWTKHKHQtYefQglaTTz9ToYdhETWMVfU/tYyilRD0GlAMVBpxpMEcrcrfKjJcB5Ho hUkUAObKjMW8t7puox5oIp0nhsl+5FrOmlhDDRINPHS49qAgHEJxWrpw5JZzaYO/qx0P roHDNdT0+bS7aNOFO6GWXTTGDjq09IHDVp8SFwXRXQqqehcw8SP/L92x7PUdDShYsWGC HlmiJaeHBlf59oT1Lea2qJHHBS7+Hj4AdGPdV0OQv2/p5V8fzNbW0+4+C+h9FCEDtqge 3U5Ppdy7Ji02RyPzWC1ldiOMemINzGQcRC+GZPEg1TP0q8CDg1NsX8+4UOaxaOxpMBIf GtVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=UGK+b/rG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si1526780plr.57.2018.02.28.09.11.42; Wed, 28 Feb 2018 09:11:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=UGK+b/rG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933736AbeB1RKu (ORCPT + 99 others); Wed, 28 Feb 2018 12:10:50 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35312 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933289AbeB1Pt5 (ORCPT ); Wed, 28 Feb 2018 10:49:57 -0500 Received: by mail-wm0-f67.google.com with SMTP id x7so5967709wmc.0 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=SvceAVgaOJR5z5m1N+2gM6IteLiLwKtV/SI69OOKdfUq9aJ1aqQzn/GtKHk0X/xFK/ 9ctc/qFtkdyBZ9BLxp/6dc3jVJ3gwBWCpUja85sL1sCc6P5CORLopomlkE4Vb5AWJebG cjVNCKCAkF5Hz9UIKNBeHWtaNA2WKmCfWTgvAQGPtl0DxK+NGbH+WxTWsEOJrizBtjSz ZOsfmScoBHC8jzZmIDuxbQ4MlI8wDmDDQIE45qlz37wTjClYnBJBlUoHLOdbw3iJ3RYA ygH+so7uMKwUIgSIjNS7QXV5XogW+KybWIMDogVgoGazTZfjJmCnGwasOi8slaByPmo0 VCYg== X-Gm-Message-State: APf1xPC7vxUjJrJLrzdosTSg4mpHXyFohCyhfkOCxiwgvvRddKkpea3u /izWhLT/DHPtO+/AJlPzEKu8cQ== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4