diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2016-06-24 14:23:30 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-07-20 23:49:51 -0400 |
commit | beec25b4573bc310f5a12cf33207b20ecc30945c (patch) | |
tree | 849ccb24756e46b0d37a3cacc65331698e725732 /drivers/md | |
parent | f8df1fdf18839cb4ef2035310bb9b6ec02025598 (diff) |
dm stripe: add DAX support
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>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-stripe.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 48f1c01d7b9f..01bb9cf2a8c2 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -308,6 +308,29 @@ static int stripe_map(struct dm_target *ti, struct bio *bio) | |||
308 | return DM_MAPIO_REMAPPED; | 308 | return DM_MAPIO_REMAPPED; |
309 | } | 309 | } |
310 | 310 | ||
311 | static long stripe_direct_access(struct dm_target *ti, sector_t sector, | ||
312 | void __pmem **kaddr, pfn_t *pfn, long size) | ||
313 | { | ||
314 | struct stripe_c *sc = ti->private; | ||
315 | uint32_t stripe; | ||
316 | struct block_device *bdev; | ||
317 | struct blk_dax_ctl dax = { | ||
318 | .size = size, | ||
319 | }; | ||
320 | long ret; | ||
321 | |||
322 | stripe_map_sector(sc, sector, &stripe, &dax.sector); | ||
323 | |||
324 | dax.sector += sc->stripe[stripe].physical_start; | ||
325 | bdev = sc->stripe[stripe].dev->bdev; | ||
326 | |||
327 | ret = bdev_direct_access(bdev, &dax); | ||
328 | *kaddr = dax.addr; | ||
329 | *pfn = dax.pfn; | ||
330 | |||
331 | return ret; | ||
332 | } | ||
333 | |||
311 | /* | 334 | /* |
312 | * Stripe status: | 335 | * Stripe status: |
313 | * | 336 | * |
@@ -416,7 +439,7 @@ static void stripe_io_hints(struct dm_target *ti, | |||
416 | 439 | ||
417 | static struct target_type stripe_target = { | 440 | static struct target_type stripe_target = { |
418 | .name = "striped", | 441 | .name = "striped", |
419 | .version = {1, 5, 1}, | 442 | .version = {1, 6, 0}, |
420 | .module = THIS_MODULE, | 443 | .module = THIS_MODULE, |
421 | .ctr = stripe_ctr, | 444 | .ctr = stripe_ctr, |
422 | .dtr = stripe_dtr, | 445 | .dtr = stripe_dtr, |
@@ -425,6 +448,7 @@ static struct target_type stripe_target = { | |||
425 | .status = stripe_status, | 448 | .status = stripe_status, |
426 | .iterate_devices = stripe_iterate_devices, | 449 | .iterate_devices = stripe_iterate_devices, |
427 | .io_hints = stripe_io_hints, | 450 | .io_hints = stripe_io_hints, |
451 | .direct_access = stripe_direct_access, | ||
428 | }; | 452 | }; |
429 | 453 | ||
430 | int __init dm_stripe_init(void) | 454 | int __init dm_stripe_init(void) |