summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2017-04-23 00:22:09 +0300
committerJens Axboe <axboe@fb.com>2017-04-23 21:59:56 +0300
commit2859323e35ab5fc42f351fbda23ab544eaa85945 (patch)
tree40e05f23fc5a9bbae5d1a44e5935eaa30cbf0243 /block
parent659226eb630ff522b30d8b8a82c9e722756e6bd4 (diff)
downloadlinux-2859323e35ab5fc42f351fbda23ab544eaa85945.tar.xz
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. Cc: stable@vger.kernel.org Reported-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-integrity.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index ce43a8214d3e..0f891a9aff4d 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -412,7 +412,8 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template
bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE |
template->flags;
- bi->interval_exp = ilog2(queue_logical_block_size(disk->queue));
+ bi->interval_exp = template->interval_exp ? :
+ ilog2(queue_logical_block_size(disk->queue));
bi->profile = template->profile ? template->profile : &nop_profile;
bi->tuple_size = template->tuple_size;
bi->tag_size = template->tag_size;