dm error: add DAX support
authorMike Snitzer <snitzer@redhat.com>
Fri, 24 Jun 2016 21:09:35 +0000 (17:09 -0400)
committerMike Snitzer <snitzer@redhat.com>
Thu, 21 Jul 2016 03:49:50 +0000 (23:49 -0400)
Allow the error target to replace an existing DAX-enabled target.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-table.c
drivers/md/dm-target.c

index ee6f37eafbc36506c48f3c2477eb6256353c1c4b..3e407a9cde1f190baade6d22e78c30ae5b27b438 100644 (file)
@@ -922,7 +922,8 @@ static int dm_table_determine_type(struct dm_table *t)
        if (bio_based) {
                /* We must use this table as bio-based */
                t->type = DM_TYPE_BIO_BASED;
-               if (dm_table_supports_dax(t))
+               if (dm_table_supports_dax(t) ||
+                   (list_empty(devices) && live_md_type == DM_TYPE_DAX_BIO_BASED))
                        t->type = DM_TYPE_DAX_BIO_BASED;
                return 0;
        }
index 5c826b450aadc4233224b59f80a3b66136fe5bb0..6eecd6b36f768fb0ea4e056b5742afce02089e28 100644 (file)
@@ -148,9 +148,15 @@ static void io_err_release_clone_rq(struct request *clone)
 {
 }
 
+static long io_err_direct_access(struct dm_target *ti, sector_t sector,
+                                void __pmem **kaddr, pfn_t *pfn, long size)
+{
+       return -EIO;
+}
+
 static struct target_type error_target = {
        .name = "error",
-       .version = {1, 4, 0},
+       .version = {1, 5, 0},
        .features = DM_TARGET_WILDCARD,
        .ctr  = io_err_ctr,
        .dtr  = io_err_dtr,
@@ -158,6 +164,7 @@ static struct target_type error_target = {
        .map_rq = io_err_map_rq,
        .clone_and_map_rq = io_err_clone_and_map_rq,
        .release_clone_rq = io_err_release_clone_rq,
+       .direct_access = io_err_direct_access,
 };
 
 int __init dm_target_init(void)