From patchwork Mon Jun 13 22:21:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 9174557 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 A1E0A6075D for ; Mon, 13 Jun 2016 22:31:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 941B126861 for ; Mon, 13 Jun 2016 22:31:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8908B27C0C; Mon, 13 Jun 2016 22:31:56 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5330526861 for ; Mon, 13 Jun 2016 22:31:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 704C01A1E25; Mon, 13 Jun 2016 15:32:20 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6AD401A1E30 for ; Mon, 13 Jun 2016 15:32:19 -0700 (PDT) Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 959964D; Mon, 13 Jun 2016 22:31:54 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.78.168.61]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id BCCA271; Mon, 13 Jun 2016 22:31:53 +0000 (UTC) From: Toshi Kani To: agk@redhat.com, snitzer@redhat.com, dan.j.williams@intel.com Subject: [PATCH 4/6] dm-linear: Add linear_direct_access() Date: Mon, 13 Jun 2016 16:21:35 -0600 Message-Id: <1465856497-19698-5-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465856497-19698-1-git-send-email-toshi.kani@hpe.com> References: <1465856497-19698-1-git-send-email-toshi.kani@hpe.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: axboe@kernel.dk, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, dm-devel@redhat.com, viro@zeniv.linux.org.uk MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Change dm-linear to implement direct_access function, linear_direct_access(), which maps sector and calls direct_access function of its target device. Signed-off-by: Toshi Kani Cc: Alasdair Kergon Cc: Mike Snitzer Cc: Dan Williams Cc: Ross Zwisler --- drivers/md/dm-linear.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 05c35aa..49bd7d2 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c @@ -141,6 +141,22 @@ static int linear_iterate_devices(struct dm_target *ti, return fn(ti, lc->dev, lc->start, ti->len, data); } +static long linear_direct_access(struct dm_target *ti, sector_t sector, + void __pmem **kaddr, pfn_t *pfn, long size) +{ + struct linear_c *lc; + struct block_device *tbdev; + const struct block_device_operations *tops; + sector_t tsector; + + lc = ti->private; + tbdev = lc->dev->bdev; + tops = tbdev->bd_disk->fops; + tsector = linear_map_sector(ti, sector); + + return tops->direct_access(tbdev, tsector, kaddr, pfn, size); +} + static struct target_type linear_target = { .name = "linear", .version = {1, 2, 1}, @@ -151,6 +167,7 @@ static struct target_type linear_target = { .status = linear_status, .prepare_ioctl = linear_prepare_ioctl, .iterate_devices = linear_iterate_devices, + .direct_access = linear_direct_access, }; int __init dm_linear_init(void)