diff mbox

[2/2] dm snap: add fake origin_direct_access

Message ID 1467142636-21094-3-git-send-email-toshi.kani@hpe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kani, Toshi June 28, 2016, 7:37 p.m. UTC
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>
---
 drivers/md/dm-snap.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

kernel test robot June 28, 2016, 8:27 p.m. UTC | #1
Hi,

[auto build test WARNING on dm/for-next]
[also build test WARNING on v4.7-rc5 next-20160628]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Toshi-Kani/Support-DAX-for-device-mapper-dm-linear-devices/20160629-034110
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
config: x86_64-lkp (attached as .config)
compiler: gcc-4.9 (Debian 4.9.3-14) 4.9.3
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/md/dm-snap.c:2370:2: error: unknown field 'direct_access' specified in initializer
     .direct_access = origin_direct_access,
     ^
>> drivers/md/dm-snap.c:2370:2: warning: initialization from incompatible pointer type
   drivers/md/dm-snap.c:2370:2: warning: (near initialization for 'origin_target.io_hints')

vim +2370 drivers/md/dm-snap.c

  2354		struct dm_origin *o = ti->private;
  2355	
  2356		return fn(ti, o->dev, 0, ti->len, data);
  2357	}
  2358	
  2359	static struct target_type origin_target = {
  2360		.name    = "snapshot-origin",
  2361		.version = {1, 9, 0},
  2362		.module  = THIS_MODULE,
  2363		.ctr     = origin_ctr,
  2364		.dtr     = origin_dtr,
  2365		.map     = origin_map,
  2366		.resume  = origin_resume,
  2367		.postsuspend = origin_postsuspend,
  2368		.status  = origin_status,
  2369		.iterate_devices = origin_iterate_devices,
> 2370		.direct_access = origin_direct_access,
  2371	};
  2372	
  2373	static struct target_type snapshot_target = {
  2374		.name    = "snapshot",
  2375		.version = {1, 15, 0},
  2376		.module  = THIS_MODULE,
  2377		.ctr     = snapshot_ctr,
  2378		.dtr     = snapshot_dtr,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 69ab1ff..c472f04 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)
 	return do_origin(o->dev, bio);
 }
 
+static long origin_direct_access(struct dm_target *ti, sector_t sector,
+		void __pmem **kaddr, pfn_t *pfn, long size)
+{
+	DMWARN("device does not support dax.");
+	return -EIO;
+}
+
 /*
  * Set the target "max_io_len" field to the minimum of all the snapshots'
  * chunk sizes.
@@ -2360,6 +2367,7 @@  static struct target_type origin_target = {
 	.postsuspend = origin_postsuspend,
 	.status  = origin_status,
 	.iterate_devices = origin_iterate_devices,
+	.direct_access = origin_direct_access,
 };
 
 static struct target_type snapshot_target = {