diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2016-06-28 15:37:16 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-07-20 23:49:51 -0400 |
commit | f6e629bd2379dceb547be93915314307871a7f6c (patch) | |
tree | 3a2ef8ed074e273c081eca2ca0adfd4bce6f561d | |
parent | beec25b4573bc310f5a12cf33207b20ecc30945c (diff) |
dm snap: add fake origin_direct_access
dax-capable mapped-device is marked as DM_TYPE_DAX_BIO_BASED,
which supports both dax and bio-based operations. dm-snap
needs to work with dax-capable device when bio-based operation
is used.
Add fake origin_direct_access() to origin device so that its
origin device is also marked as DM_TYPE_DAX_BIO_BASED for
dax-capable device. This allows to extend target's DM table.
dm-snap works normally when bio-based operation is used.
dm-snap does not support dax operation, and mount with dax
option to a target device or snapshot device fails.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-snap.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 69ab1ff5f5c9..c472f0465f0e 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -2301,6 +2301,13 @@ static int origin_map(struct dm_target *ti, struct bio *bio) | |||
2301 | return do_origin(o->dev, bio); | 2301 | return do_origin(o->dev, bio); |
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | static long origin_direct_access(struct dm_target *ti, sector_t sector, | ||
2305 | void __pmem **kaddr, pfn_t *pfn, long size) | ||
2306 | { | ||
2307 | DMWARN("device does not support dax."); | ||
2308 | return -EIO; | ||
2309 | } | ||
2310 | |||
2304 | /* | 2311 | /* |
2305 | * Set the target "max_io_len" field to the minimum of all the snapshots' | 2312 | * Set the target "max_io_len" field to the minimum of all the snapshots' |
2306 | * chunk sizes. | 2313 | * chunk sizes. |
@@ -2360,6 +2367,7 @@ static struct target_type origin_target = { | |||
2360 | .postsuspend = origin_postsuspend, | 2367 | .postsuspend = origin_postsuspend, |
2361 | .status = origin_status, | 2368 | .status = origin_status, |
2362 | .iterate_devices = origin_iterate_devices, | 2369 | .iterate_devices = origin_iterate_devices, |
2370 | .direct_access = origin_direct_access, | ||
2363 | }; | 2371 | }; |
2364 | 2372 | ||
2365 | static struct target_type snapshot_target = { | 2373 | static struct target_type snapshot_target = { |