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

@ -399,19 +399,22 @@ static int nd_pi_nop_generate_verify(struct blk_integrity_iter *iter)
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
{
struct blk_integrity integrity = {
struct blk_integrity bi;
static struct blk_integrity_profile profile = {
.name = "ND-PI-NOP",
.generate_fn = nd_pi_nop_generate_verify,
.verify_fn = nd_pi_nop_generate_verify,
.tuple_size = meta_size,
.tag_size = meta_size,
};
int ret;
if (meta_size == 0)
return 0;
ret = blk_integrity_register(disk, &integrity);
bi.profile = &profile;
bi.tuple_size = meta_size;
bi.tag_size = meta_size;
ret = blk_integrity_register(disk, &bi);
if (ret)
return ret;