[dm-devel] [PATCH 02/13] block, dax: introduce dax_operations

Dan Williams dan.j.williams at intel.com
Fri Jan 20 17:28:26 UTC 2017


On Thu, Jan 19, 2017 at 7:50 PM, Dan Williams <dan.j.williams at intel.com> wrote:
> Prepare for the removal of memcpy_to_pmem() and copy_from_iter_pmem() by
> introducing dax_ops. This allows for driver specific overrides for the
> routines that transfer data to a dax capable block device.
>
> Cc: <dm-devel at redhat.com>
> Cc: Jan Kara <jack at suse.cz>
> Cc: Jens Axboe <axboe at fb.com>
> Cc: Jeff Moyer <jmoyer at redhat.com>
> Cc: Christoph Hellwig <hch at lst.de>
> Cc: Toshi Kani <toshi.kani at hpe.com>
> Cc: Mike Snitzer <snitzer at redhat.com>
> Cc: Matthew Wilcox <mawilcox at microsoft.com>
> Cc: Ross Zwisler <ross.zwisler at linux.intel.com>
> Signed-off-by: Dan Williams <dan.j.williams at intel.com>
> ---
>  arch/powerpc/sysdev/axonram.c |    6 +++++-
>  drivers/block/brd.c           |    6 +++++-
>  drivers/md/dm.c               |    6 +++++-
>  drivers/nvdimm/pmem.c         |    6 +++++-
>  drivers/s390/block/dcssblk.c  |    6 +++++-
>  fs/block_dev.c                |    6 ++++--
>  include/linux/blkdev.h        |    8 ++++++--
>  7 files changed, 35 insertions(+), 9 deletions(-)
>
[..]
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 3086da5664f3..87920a379d20 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -2725,13 +2725,17 @@ static const struct pr_ops dm_pr_ops = {
>         .pr_clear       = dm_pr_clear,
>  };
>
> +static const struct dax_operations dm_dax_ops = {
> +       .direct_access = dm_blk_direct_access,
> +};
> +
>  static const struct block_device_operations dm_blk_dops = {
>         .open = dm_blk_open,
>         .release = dm_blk_close,
>         .ioctl = dm_blk_ioctl,
> -       .direct_access = dm_blk_direct_access,
>         .getgeo = dm_blk_getgeo,
>         .pr_ops = &dm_pr_ops,
> +       .dax_ops = &dm_dax_ops,
>         .owner = THIS_MODULE
>  };

I just realized we need to do a bit more plumbing to support the
device-mapper case. We need to implement all the dax_operations at the
dm_dax_ops level and pass in the physical sector so that device-mapper
can look up the backing block-device to call the real dax_operation if
it is implemented.




More information about the dm-devel mailing list