Re: dm stripe: add DAX support
From: Mike Snitzer
Date: Fri Jun 24 2016 - 14:29:09 EST
On Fri, Jun 24 2016 at 2:23pm -0400,
Toshi Kani <toshi.kani@xxxxxxx> wrote:
> 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@xxxxxxx>
> Cc: Alasdair Kergon <agk@xxxxxxxxxx>
> Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> Cc: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
> ---
> 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)
Thanks, once jens queues the block changes I'll be able to pull this in
to linux-dm.git
BTW, if in your testing you could evaluate/quantify any extra overhead
from DM that'd be useful to share. It could be there are bottlenecks
that need to be fixed, etc.
Mike