diff mbox

dm flakey: add DAX support

Message ID 147440445480.62486.9559239844115396323.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Jiang Sept. 20, 2016, 8:47 p.m. UTC
Change dm-flakey to implement direct_access function,
flakey_direct_access(), which maps sector and calls direct_access
function of its physical target device. This pretty much is a copy
from DM Linear.

This allows fs with DAX to pass in xfstests. It does not actually introduce
data corruption and dropping writes unlike the non-DAX path. The main
reason is due to the I/O path being out of dmflakey's control once
direct_access() has been called. The the existing implementation cannot
be adapted to DAX I/O path. The error injection will be introduced at a
later date with more thought.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/md/dm-flakey.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Comments

Dave Chinner Sept. 20, 2016, 9:42 p.m. UTC | #1
On Tue, Sep 20, 2016 at 01:47:34PM -0700, Dave Jiang wrote:
> Change dm-flakey to implement direct_access function,
> flakey_direct_access(), which maps sector and calls direct_access
> function of its physical target device. This pretty much is a copy
> from DM Linear.
> 
> This allows fs with DAX to pass in xfstests.

They don't fail. They simply don't run like this:

generic/321 1s ... [not run] Cannot run tests with DAX on dmflakey devices
generic/322 0s ... [not run] Cannot run tests with DAX on dmflakey devices

> It does not actually introduce
> data corruption and dropping writes unlike the non-DAX path. The main
> reason is due to the I/O path being out of dmflakey's control once
> direct_access() has been called. The the existing implementation cannot
> be adapted to DAX I/O path. The error injection will be introduced at a
> later date with more thought.

Then introduce dmflakey DAX support at that time. Running tests that
are supposed to exercise failure paths when those failure paths
cannot be triggered is fundamentally useless. It leads a false
indication that we are actually testing failures, when in fact we
are doing nothing of the sort.

Right now the test harness execution clearly documents that there is
no failure testing being run on DAX devices, and that's the way it
should remain until dmflakey, dmerror, etc can inject the required
errors into the DAX paths....

Cheers,

Dave.
diff mbox

Patch

diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index 6a2e8dd..cf182a7 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -408,9 +408,27 @@  static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_
 	return fn(ti, fc->dev, fc->start, ti->len, data);
 }
 
+static long flakey_direct_access(struct dm_target *ti, sector_t sector,
+				 void **kaddr, pfn_t *pfn, long size)
+{
+	struct flakey_c *fc = ti->private;
+	struct block_device *bdev = fc->dev->bdev;
+	struct blk_dax_ctl dax = {
+		.sector = flakey_map_sector(ti, sector),
+		.size = size,
+	};
+	long ret;
+
+	ret = bdev_direct_access(bdev, &dax);
+	*kaddr = dax.addr;
+	*pfn = dax.pfn;
+
+	return ret;
+}
+
 static struct target_type flakey_target = {
 	.name   = "flakey",
-	.version = {1, 3, 1},
+	.version = {1, 4, 0},
 	.module = THIS_MODULE,
 	.ctr    = flakey_ctr,
 	.dtr    = flakey_dtr,
@@ -419,6 +437,7 @@  static struct target_type flakey_target = {
 	.status = flakey_status,
 	.prepare_ioctl = flakey_prepare_ioctl,
 	.iterate_devices = flakey_iterate_devices,
+	.direct_access = flakey_direct_access,
 };
 
 static int __init dm_flakey_init(void)