Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Milan Broz and committed by
Mike Snitzer
9b4b5a79 b29d4986

+17
+11
drivers/md/dm-table.c
··· 47 47 bool integrity_supported:1; 48 48 bool singleton:1; 49 49 bool all_blk_mq:1; 50 + unsigned integrity_added:1; 50 51 51 52 /* 52 53 * Indicates the rw permissions for the new logical ··· 726 725 t->immutable_target_type = tgt->type; 727 726 } 728 727 728 + if (dm_target_has_integrity(tgt->type)) 729 + t->integrity_added = 1; 730 + 729 731 tgt->table = t; 730 732 tgt->begin = start; 731 733 tgt->len = len; ··· 1172 1168 struct mapped_device *md = t->md; 1173 1169 struct gendisk *template_disk = NULL; 1174 1170 1171 + /* If target handles integrity itself do not register it here. */ 1172 + if (t->integrity_added) 1173 + return 0; 1174 + 1175 1175 template_disk = dm_table_get_integrity_disk(t); 1176 1176 if (!template_disk) 1177 1177 return 0; ··· 1401 1393 static void dm_table_verify_integrity(struct dm_table *t) 1402 1394 { 1403 1395 struct gendisk *template_disk = NULL; 1396 + 1397 + if (t->integrity_added) 1398 + return; 1404 1399 1405 1400 if (t->integrity_supported) { 1406 1401 /*
+6
include/linux/device-mapper.h
··· 221 221 */ 222 222 typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio); 223 223 224 + /* 225 + * A target implements own bio data integrity. 226 + */ 227 + #define DM_TARGET_INTEGRITY 0x00000010 228 + #define dm_target_has_integrity(type) ((type)->features & DM_TARGET_INTEGRITY) 229 + 224 230 struct dm_target { 225 231 struct dm_table *table; 226 232 struct target_type *type;