diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-04-12 22:37:44 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-04-25 22:20:36 +0200 |
commit | 817bf40265459578abc36c6bd53e27775b5c7ec4 (patch) | |
tree | 7f77cc1bb97457d10d92df83a640d8d90023a653 /drivers/md/dm.c | |
parent | dm: add dax_device and dax_operations support (diff) | |
download | linux-817bf40265459578abc36c6bd53e27775b5c7ec4.tar.xz linux-817bf40265459578abc36c6bd53e27775b5c7ec4.zip |
dm: teach dm-targets to use a dax_device + dax_operations
Arrange for dm to lookup the dax services available from member devices.
Update the dax-capable targets, linear and stripe, to route dax
operations to the underlying device. Changes the target-internal
->direct_access() method to more closely align with the dax_operations
->direct_access() calling convention.
Cc: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index bd56dfe43a99..ef4c6f8cad47 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -630,6 +630,7 @@ static int open_table_device(struct table_device *td, dev_t dev, } td->dm_dev.bdev = bdev; + td->dm_dev.dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); return 0; } @@ -643,7 +644,9 @@ static void close_table_device(struct table_device *td, struct mapped_device *md bd_unlink_disk_holder(td->dm_dev.bdev, dm_disk(md)); blkdev_put(td->dm_dev.bdev, td->dm_dev.mode | FMODE_EXCL); + put_dax(td->dm_dev.dax_dev); td->dm_dev.bdev = NULL; + td->dm_dev.dax_dev = NULL; } static struct table_device *find_table_device(struct list_head *l, dev_t dev, @@ -945,16 +948,9 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, if (len < 1) goto out; nr_pages = min(len, nr_pages); - if (ti->type->direct_access) { - ret = ti->type->direct_access(ti, sector, kaddr, pfn, - nr_pages * PAGE_SIZE); - /* - * FIXME: convert ti->type->direct_access to return - * nr_pages directly. - */ - if (ret >= 0) - ret /= PAGE_SIZE; - } + if (ti->type->direct_access) + ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn); + out: dm_put_live_table(md, srcu_idx); |