diff options
author | Mike Snitzer <snitzer@redhat.com> | 2017-04-22 17:22:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-20 08:28:36 -0400 |
commit | 9b2fb8ad5ba1b528e2f2927898403b0df40fd09b (patch) | |
tree | 88963dbafe4f8abc1dba43db81d5a370d1aa5a10 | |
parent | 884ba252f3f16c577d7e5f6996c3e73a834b19fe (diff) |
block: fix blk_integrity_register to use template's interval_exp if not 0
commit 2859323e35ab5fc42f351fbda23ab544eaa85945 upstream.
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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | block/blk-integrity.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 319f2e4f4a8b..478f572cb1e7 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 | |||
412 | 412 | ||
413 | bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE | | 413 | bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE | |
414 | template->flags; | 414 | template->flags; |
415 | bi->interval_exp = ilog2(queue_logical_block_size(disk->queue)); | 415 | bi->interval_exp = template->interval_exp ? : |
416 | ilog2(queue_logical_block_size(disk->queue)); | ||
416 | bi->profile = template->profile ? template->profile : &nop_profile; | 417 | bi->profile = template->profile ? template->profile : &nop_profile; |
417 | bi->tuple_size = template->tuple_size; | 418 | bi->tuple_size = template->tuple_size; |
418 | bi->tag_size = template->tag_size; | 419 | bi->tag_size = template->tag_size; |