linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm stripe: add DAX support
@ 2016-06-24 18:23 Toshi Kani
  2016-06-24 18:29 ` Mike Snitzer
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Toshi Kani @ 2016-06-24 18:23 UTC (permalink / raw)
  To: snitzer
  Cc: linux-nvdimm, dm-devel, linux-raid, linux-kernel, Toshi Kani,
	Alasdair Kergon, Dan Williams, Ross Zwisler

Change dm-stripe to implement direct_access function,
stripe_direct_access(), which maps bdev and sector and
calls direct_access function of its physical target device.

Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 drivers/md/dm-stripe.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index 48f1c01..8925f6a 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -308,6 +308,30 @@ static int stripe_map(struct dm_target *ti, struct bio *bio)
 	return DM_MAPIO_REMAPPED;
 }
 
+static long stripe_direct_access(struct dm_target *ti, sector_t sector,
+		void __pmem **kaddr, pfn_t *pfn, long size)
+{
+	struct stripe_c *sc;
+	struct block_device *bdev;
+	uint32_t stripe;
+	struct blk_dax_ctl dax = {
+		.size = size,
+	};
+	long ret;
+
+	sc = ti->private;
+	stripe_map_sector(sc, sector, &stripe, &dax.sector);
+
+	dax.sector += sc->stripe[stripe].physical_start;
+	bdev = sc->stripe[stripe].dev->bdev;
+
+	ret = bdev_direct_access(bdev, &dax);
+	*kaddr = dax.addr;
+	*pfn = dax.pfn;
+
+	return ret;
+}
+
 /*
  * Stripe status:
  *
@@ -425,6 +449,7 @@ static struct target_type stripe_target = {
 	.status = stripe_status,
 	.iterate_devices = stripe_iterate_devices,
 	.io_hints = stripe_io_hints,
+	.direct_access = stripe_direct_access,
 };
 
 int __init dm_stripe_init(void)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-07-21  3:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 18:23 [PATCH] dm stripe: add DAX support Toshi Kani
2016-06-24 18:29 ` Mike Snitzer
2016-06-24 18:42   ` Kani, Toshimitsu
2016-07-12 22:22   ` Kani, Toshimitsu
2016-07-13  2:01     ` Mike Snitzer
2016-07-13 15:03       ` Kani, Toshimitsu
2016-07-21  0:01         ` Mike Snitzer
2016-07-21  3:03           ` Jens Axboe
2016-06-24 19:58 ` [PATCH] " kbuild test robot
2016-06-24 20:02   ` Mike Snitzer
2016-06-24 20:46     ` Kani, Toshimitsu
2016-06-24 19:59 ` [PATCH] " kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).