[PATCH] dm flakey: add DAX support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/md/dm-flakey.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

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)

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux