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 <[email protected]>
Reported-by: Christoph Hellwig <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Cc: Dan Williams <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Martin K. Petersen 2015-10-21 13:19:33 -04:00 • committed by Jens Axboe
commit 0f8087ecde
9 changed files with 65 additions and 64 deletions

View file

@ -155,17 +155,17 @@ static int iblock_configure_device(struct se_device *dev)
if (bi) {
struct bio_set *bs = ib_dev->ibd_bio_set;
if (!strcmp(bi->name, "T10-DIF-TYPE3-IP") ||
!strcmp(bi->name, "T10-DIF-TYPE1-IP")) {
if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-IP") ||
!strcmp(bi->profile->name, "T10-DIF-TYPE1-IP")) {
pr_err("IBLOCK export of blk_integrity: %s not"
" supported\n", bi->name);
" supported\n", bi->profile->name);
ret = -ENOSYS;
goto out_blkdev_put;
}
if (!strcmp(bi->name, "T10-DIF-TYPE3-CRC")) {
if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-CRC")) {
dev->dev_attrib.pi_prot_type = TARGET_DIF_TYPE3_PROT;
} else if (!strcmp(bi->name, "T10-DIF-TYPE1-CRC")) {
} else if (!strcmp(bi->profile->name, "T10-DIF-TYPE1-CRC")) {
dev->dev_attrib.pi_prot_type = TARGET_DIF_TYPE1_PROT;
}