diff options
author | Milan Broz | 2017-01-04 20:23:51 +0100 |
---|---|---|
committer | Mike Snitzer | 2017-03-07 19:28:32 +0100 |
commit | 9b4b5a797cf8a8d904df979891a8de53f2cb9694 (patch) | |
tree | d6d677b0fdb95886d7155d3f58978b4ee8249eec | |
parent | dm cache: significant rework to leverage dm-bio-prison-v2 (diff) | |
download | kernel-qcow2-linux-9b4b5a797cf8a8d904df979891a8de53f2cb9694.tar.gz kernel-qcow2-linux-9b4b5a797cf8a8d904df979891a8de53f2cb9694.tar.xz kernel-qcow2-linux-9b4b5a797cf8a8d904df979891a8de53f2cb9694.zip |
dm table: add flag to allow target to handle its own integrity metadata
Add DM_TARGET_INTEGRITY flag that specifies bio integrity metadata is
not inherited but implemented in the target itself.
Signed-off-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-table.c | 11 | ||||
-rw-r--r-- | include/linux/device-mapper.h | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 3ad16d9c9d5a..b0600840e734 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -47,6 +47,7 @@ struct dm_table { bool integrity_supported:1; bool singleton:1; bool all_blk_mq:1; + unsigned integrity_added:1; /* * Indicates the rw permissions for the new logical @@ -725,6 +726,9 @@ int dm_table_add_target(struct dm_table *t, const char *type, t->immutable_target_type = tgt->type; } + if (dm_target_has_integrity(tgt->type)) + t->integrity_added = 1; + tgt->table = t; tgt->begin = start; tgt->len = len; @@ -1168,6 +1172,10 @@ static int dm_table_register_integrity(struct dm_table *t) struct mapped_device *md = t->md; struct gendisk *template_disk = NULL; + /* If target handles integrity itself do not register it here. */ + if (t->integrity_added) + return 0; + template_disk = dm_table_get_integrity_disk(t); if (!template_disk) return 0; @@ -1394,6 +1402,9 @@ static void dm_table_verify_integrity(struct dm_table *t) { struct gendisk *template_disk = NULL; + if (t->integrity_added) + return; + if (t->integrity_supported) { /* * Verify that the original integrity profile diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index a7e6903866fd..874462153f14 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -221,6 +221,12 @@ struct target_type { */ typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio); +/* + * A target implements own bio data integrity. + */ +#define DM_TARGET_INTEGRITY 0x00000010 +#define dm_target_has_integrity(type) ((type)->features & DM_TARGET_INTEGRITY) + struct dm_target { struct dm_table *table; struct target_type *type; |