From patchwork Mon Nov 28 21:39:12 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: 9450589 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 9FBF26071C for ; Mon, 28 Nov 2016 21:45:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9052B27BFC for ; Mon, 28 Nov 2016 21:45:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8505E27EE9; Mon, 28 Nov 2016 21:45:46 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 078C827BFC for ; Mon, 28 Nov 2016 21:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755559AbcK1Vn6 (ORCPT ); Mon, 28 Nov 2016 16:43:58 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:34157 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755646AbcK1Vj5 (ORCPT ); Mon, 28 Nov 2016 16:39:57 -0500 Received: by mail-wj0-f194.google.com with SMTP id xy5so15802796wjc.1 for ; Mon, 28 Nov 2016 13:39:56 -0800 (PST) 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=5CapKaKSBP/0kf7SgoUlmOiTX6cSe+QWucKLh9+N47A=; b=iaBaqmo2Tapr0ANoQHhtFeZn8r94n9RoI0Kd7VzXJH2uJYvWaB11XFeTbnmAKKnnNs pOUrVCCZbTBKu/pV95zMWFTNu3b9xJYv8W9hkB52G91+f1zXcJr0cjymYbDd1wrf3/9U Gqv8ptLGpS3iV2opNBxLDrpPwOqMIdcodl0Ew= 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=5CapKaKSBP/0kf7SgoUlmOiTX6cSe+QWucKLh9+N47A=; b=eXpLXjEb+2+o+kO7YTGYzOy3ILvOyrdIZ0XMw3e32MsJDJsqHl5l8nJKlcRg8wjBqA JRYGt2srXpmuRIfUqrsi60JyvFy0NDJZhJNjT0v6YRExGtJqCVHXRweAbW5fJ05dDonS eWEsaivVhBxNSFGH7j1hKDTyF0lFwnEBKrWUliQQwYO84pEkckHG9IIrBngUJHQyEFdQ 3JDRNffQ50FGInjpiNx+SAXoOXrdrD/ZiAKi1LSbZ1AyzP27CwczGo8VIXoAaWAizye4 Ce+szJb9UhDFidkrvTbSW73Wqq/KUl8GZHm75xOpOHPSdcnd1jlaeG4dCaVMIMG7mCOn 8bcw== X-Gm-Message-State: AKaTC00OCdexxNZeO4DTylSeh4NkCxqzgN0VA3Mm9kb4oPIrHPqpoa/136cTxrv67oDqag== X-Received: by 10.194.149.143 with SMTP id ua15mr24660249wjb.48.1480369195838; Mon, 28 Nov 2016 13:39:55 -0800 (PST) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id w79sm30825843wmw.0.2016.11.28.13.39.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 13:39:55 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: axboe@fb.com, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 21/23] lightnvm: introduce max_phys_sects helper function Date: Mon, 28 Nov 2016 22:39:12 +0100 Message-Id: <20161128213914.12516-22-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161128213914.12516-1-m@bjorling.me> References: <20161128213914.12516-1-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 From: Javier González Target devices do not have access to the device driver operations. Introduce a helper function that exposes the max. number of physical sectors supported by the underlying device. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 8 ++++++++ include/linux/lightnvm.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 69f261e..3d8eaac 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -203,6 +203,14 @@ int nvm_set_bb_tbl(struct nvm_dev *dev, struct ppa_addr *ppas, int nr_ppas, } EXPORT_SYMBOL(nvm_set_bb_tbl); +int nvm_max_phys_sects(struct nvm_tgt_dev *tgt_dev) +{ + struct nvm_dev *dev = tgt_dev->parent; + + return dev->ops->max_phys_sect; +} +EXPORT_SYMBOL(nvm_max_phys_sects); + int nvm_submit_io(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd) { struct nvm_dev *dev = tgt_dev->parent; diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 99cd1e7..9637531 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -529,6 +529,7 @@ extern void nvm_unregister(struct nvm_dev *); extern int nvm_set_bb_tbl(struct nvm_dev *dev, struct ppa_addr *ppas, int nr_ppas, int type); +extern int nvm_max_phys_sects(struct nvm_tgt_dev *); extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *); extern void nvm_generic_to_addr_mode(struct nvm_dev *, struct nvm_rq *); extern void nvm_addr_to_generic_mode(struct nvm_dev *, struct nvm_rq *);