summaryrefslogtreecommitdiffstats
path: root/block/blk-integrity.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2015-10-21 19:19:38 +0200
committerJens Axboe <axboe@fb.com>2015-10-21 22:42:39 +0200
commita48f041d91bf1aee599fa2adb53b780ed20c2ee5 (patch)
treec1cb66965f987d782c5c6bc63826d2250caf8d18 /block/blk-integrity.c
parentblock: Consolidate static integrity profile properties (diff)
downloadlinux-a48f041d91bf1aee599fa2adb53b780ed20c2ee5.tar.xz
linux-a48f041d91bf1aee599fa2adb53b780ed20c2ee5.zip
block: Reduce the size of struct blk_integrity
The per-device properties in the blk_integrity structure were previously unsigned short. However, most of the values fit inside a char. The only exception is the data interval size and we can work around that by storing it as a power of two. This cuts the size of the dynamic portion of blk_integrity in half. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reported-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-integrity.c')
-rw-r--r--block/blk-integrity.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index daf590ab3b46..c7508654faff 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -155,10 +155,10 @@ int blk_integrity_compare(struct gendisk *gd1, struct gendisk *gd2)
if (!b1 || !b2)
return -1;
- if (b1->interval != b2->interval) {
+ if (b1->interval_exp != b2->interval_exp) {
pr_err("%s: %s/%s protection interval %u != %u\n",
__func__, gd1->disk_name, gd2->disk_name,
- b1->interval, b2->interval);
+ 1 << b1->interval_exp, 1 << b2->interval_exp);
return -1;
}
@@ -440,7 +440,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
kobject_uevent(&disk->integrity_kobj, KOBJ_ADD);
bi->flags |= BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE;
- bi->interval = queue_logical_block_size(disk->queue);
+ bi->interval_exp = ilog2(queue_logical_block_size(disk->queue));
disk->integrity = bi;
} else
bi = disk->integrity;