dm: allow targets to request flushes regardless of underlying device support
authorJoe Thornber <ejt@redhat.com>
Fri, 27 Jul 2012 14:08:07 +0000 (15:08 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 27 Jul 2012 14:08:07 +0000 (15:08 +0100)
Allow targets to override the 'supports flush' calculation.

Set 'flush_supported' if a target needs to receive flushes regardless of
whether or not its underlying devices have support.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-table.c
include/linux/device-mapper.h

index 2e227fbf1622c075c6fc543f5b2d30fb2bf7dbd7..f90069029aaeed02ab6f4f61814afc92d13db2f0 100644 (file)
@@ -1319,6 +1319,9 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
                if (!ti->num_flush_requests)
                        continue;
 
+               if (ti->flush_supported)
+                       return 1;
+
                if (ti->type->iterate_devices &&
                    ti->type->iterate_devices(ti, device_flush_capable, &flush))
                        return 1;
index 8bdbbfce759aff0f38ad77c32c6ef20f0ae09463..bdd65e97a1290501df5240dcd8bcb5e79af35972 100644 (file)
@@ -211,6 +211,12 @@ struct dm_target {
        /* Used to provide an error string from the ctr */
        char *error;
 
+       /*
+        * Set if this target needs to receive flushes regardless of
+        * whether or not its underlying devices have support.
+        */
+       bool flush_supported:1;
+
        /*
         * Set if this target needs to receive discards regardless of
         * whether or not its underlying devices have support.