On Thu, Jan 19, 2017 at 7:50 PM, Dan Williams <dan.j.willi...@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-de...@redhat.com> > Cc: Jan Kara <j...@suse.cz> > Cc: Jens Axboe <ax...@fb.com> > Cc: Jeff Moyer <jmo...@redhat.com> > Cc: Christoph Hellwig <h...@lst.de> > Cc: Toshi Kani <toshi.k...@hpe.com> > Cc: Mike Snitzer <snit...@redhat.com> > Cc: Matthew Wilcox <mawil...@microsoft.com> > Cc: Ross Zwisler <ross.zwis...@linux.intel.com> > Signed-off-by: Dan Williams <dan.j.willi...@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.