diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2015-10-21 13:19:33 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-10-21 16:42:38 -0400 |
commit | 0f8087ecdeac921fc4920f1328f55c15080bc6aa (patch) | |
tree | 6027fd7061230f1488f74938b6bebf804be88376 /block/blk-integrity.c | |
parent | aff34e192e4eeacfb8b5ffc68e10a240f2c0c6d7 (diff) |
block: Consolidate static integrity profile properties
We previously made a complete copy of a device's data integrity profile
even though several of the fields inside the blk_integrity struct are
pointers to fixed template entries in t10-pi.c.
Split the static and per-device portions so that we can reference the
template directly.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reported-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-integrity.c')
-rw-r--r-- | block/blk-integrity.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 182bfd2383ea..daf590ab3b46 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c | |||
@@ -176,10 +176,10 @@ int blk_integrity_compare(struct gendisk *gd1, struct gendisk *gd2) | |||
176 | return -1; | 176 | return -1; |
177 | } | 177 | } |
178 | 178 | ||
179 | if (strcmp(b1->name, b2->name)) { | 179 | if (b1->profile != b2->profile) { |
180 | printk(KERN_ERR "%s: %s/%s type %s != %s\n", __func__, | 180 | printk(KERN_ERR "%s: %s/%s type %s != %s\n", __func__, |
181 | gd1->disk_name, gd2->disk_name, | 181 | gd1->disk_name, gd2->disk_name, |
182 | b1->name, b2->name); | 182 | b1->profile->name, b2->profile->name); |
183 | return -1; | 183 | return -1; |
184 | } | 184 | } |
185 | 185 | ||
@@ -275,8 +275,8 @@ static ssize_t integrity_attr_store(struct kobject *kobj, | |||
275 | 275 | ||
276 | static ssize_t integrity_format_show(struct blk_integrity *bi, char *page) | 276 | static ssize_t integrity_format_show(struct blk_integrity *bi, char *page) |
277 | { | 277 | { |
278 | if (bi != NULL && bi->name != NULL) | 278 | if (bi != NULL && bi->profile->name != NULL) |
279 | return sprintf(page, "%s\n", bi->name); | 279 | return sprintf(page, "%s\n", bi->profile->name); |
280 | else | 280 | else |
281 | return sprintf(page, "none\n"); | 281 | return sprintf(page, "none\n"); |
282 | } | 282 | } |
@@ -401,7 +401,8 @@ bool blk_integrity_is_initialized(struct gendisk *disk) | |||
401 | { | 401 | { |
402 | struct blk_integrity *bi = blk_get_integrity(disk); | 402 | struct blk_integrity *bi = blk_get_integrity(disk); |
403 | 403 | ||
404 | return (bi && bi->name && strcmp(bi->name, bi_unsupported_name) != 0); | 404 | return (bi && bi->profile->name && strcmp(bi->profile->name, |
405 | bi_unsupported_name) != 0); | ||
405 | } | 406 | } |
406 | EXPORT_SYMBOL(blk_integrity_is_initialized); | 407 | EXPORT_SYMBOL(blk_integrity_is_initialized); |
407 | 408 | ||
@@ -446,14 +447,12 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template) | |||
446 | 447 | ||
447 | /* Use the provided profile as template */ | 448 | /* Use the provided profile as template */ |
448 | if (template != NULL) { | 449 | if (template != NULL) { |
449 | bi->name = template->name; | 450 | bi->profile = template->profile; |
450 | bi->generate_fn = template->generate_fn; | ||
451 | bi->verify_fn = template->verify_fn; | ||
452 | bi->tuple_size = template->tuple_size; | 451 | bi->tuple_size = template->tuple_size; |
453 | bi->tag_size = template->tag_size; | 452 | bi->tag_size = template->tag_size; |
454 | bi->flags |= template->flags; | 453 | bi->flags |= template->flags; |
455 | } else | 454 | } else |
456 | bi->name = bi_unsupported_name; | 455 | bi->profile->name = bi_unsupported_name; |
457 | 456 | ||
458 | disk->queue->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES; | 457 | disk->queue->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES; |
459 | 458 | ||