Commit 2859323e authored by Mike Snitzer's avatar Mike Snitzer Committed by Jens Axboe

block: fix blk_integrity_register to use template's interval_exp if not 0

When registering an integrity profile: if the template's interval_exp is
not 0 use it, otherwise use the ilog2() of logical block size of the
provided gendisk.

This fixes a long-standing DM linear target bug where it cannot pass
integrity data to the underlying device if its logical block size
conflicts with the underlying device's logical block size.

Reported-by: default avatarMikulas Patocka <>
Signed-off-by: default avatarMike Snitzer <>
Acked-by: default avatarMartin K. Petersen <>
Signed-off-by: default avatarJens Axboe <>
parent 659226eb
......@@ -412,7 +412,8 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template
bi->interval_exp = ilog2(queue_logical_block_size(disk->queue));
bi->interval_exp = template->interval_exp ? :
bi->profile = template->profile ? template->profile : &nop_profile;
bi->tuple_size = template->tuple_size;
bi->tag_size = template->tag_size;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment