summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2017-04-12 13:37:44 -0700
committerDan Williams <dan.j.williams@intel.com>2017-04-25 13:20:36 -0700
commit817bf40265459578abc36c6bd53e27775b5c7ec4 (patch)
tree7f77cc1bb97457d10d92df83a640d8d90023a653 /drivers/md/dm.c
parentf26c5719b2d7b00de69eb83eb1c1c831759fdc9b (diff)
downloadlinux-817bf40265459578abc36c6bd53e27775b5c7ec4.tar.bz2
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.c16
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);