From: martin.petersen@oracle.com (Martin K. Petersen)
Subject: [PATCH 3/5] block: Reduce the size of struct blk_integrity
Date: Mon, 19 Oct 2015 22:45:30 -0400 [thread overview]
Message-ID: <1445309132-31824-4-git-send-email-martin.petersen@oracle.com> (raw)
In-Reply-To: <1445309132-31824-1-git-send-email-martin.petersen@oracle.com>
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 at oracle.com>
Reported-by: Christoph Hellwig <hch at lst.de>
Reviewed-by: Sagi Grimberg <sagig at mellanox.com>
---
block/bio-integrity.c | 4 ++--
block/blk-integrity.c | 6 +++---
include/linux/blkdev.h | 8 ++++----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index a10ffe19a8dd..6a90eca9cea1 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -202,7 +202,7 @@ EXPORT_SYMBOL(bio_integrity_enabled);
static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi,
unsigned int sectors)
{
- return sectors >> (ilog2(bi->interval) - 9);
+ return sectors >> (bi->interval_exp - 9);
}
static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
@@ -229,7 +229,7 @@ static int bio_integrity_process(struct bio *bio,
bip->bip_vec->bv_offset;
iter.disk_name = bio->bi_bdev->bd_disk->disk_name;
- iter.interval = bi->interval;
+ iter.interval = 1 << bi->interval_exp;
iter.seed = bip_get_seed(bip);
iter.prot_buf = prot_buf;
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;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f36c6476f1c7..4f1968f15e30 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1470,10 +1470,10 @@ struct blk_integrity_profile {
struct blk_integrity {
struct blk_integrity_profile *profile;
- unsigned short flags;
- unsigned short tuple_size;
- unsigned short interval;
- unsigned short tag_size;
+ unsigned char flags;
+ unsigned char tuple_size;
+ unsigned char interval_exp;
+ unsigned char tag_size;
};
extern bool blk_integrity_is_initialized(struct gendisk *);
--
2.4.3
next prev parent reply other threads:[~2015-10-20 2:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 19:59 [PATCH v2 00/12] blk-integrity lifetime fixes Dan Williams
2015-10-15 19:59 ` [PATCH v2 01/12] block: Move integrity kobject to struct gendisk Dan Williams
2015-10-23 20:21 ` Jeff Moyer
2015-10-15 19:59 ` [PATCH v2 02/12] block: Consolidate static integrity profile properties Dan Williams
2015-10-15 19:59 ` [PATCH v2 03/12] block: Reduce the size of struct blk_integrity Dan Williams
2015-10-15 20:00 ` [PATCH v2 04/12] block: Export integrity data interval size in sysfs Dan Williams
2015-10-15 20:00 ` [PATCH v2 05/12] block: Inline blk_integrity in struct gendisk Dan Williams
2015-10-15 20:00 ` [PATCH v2 06/12] md, dm, scsi, nvme, libnvdimm: drop blk_integrity_unregister() at shutdown Dan Williams
2015-10-15 20:00 ` [PATCH v2 07/12] md: suspend i/o during runtime blk_integrity_unregister Dan Williams
2015-10-15 20:00 ` [PATCH v2 08/12] nvme: " Dan Williams
2015-10-15 20:00 ` [PATCH v2 09/12] block: generic request_queue reference counting Dan Williams
2015-10-15 20:00 ` [PATCH v2 10/12] block: move blk_integrity to request_queue Dan Williams
2015-10-16 0:42 ` Williams, Dan J
2015-10-20 2:24 ` Martin K. Petersen
2015-10-20 2:45 ` Simplify block integrity registration v2 Martin K. Petersen
2015-10-20 2:45 ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-10-20 2:45 ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-10-20 18:20 ` Dan Williams
2015-10-20 2:45 ` Martin K. Petersen [this message]
2015-10-20 2:45 ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-10-20 2:45 ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-10-21 7:22 ` Simplify block integrity registration v2 Christoph Hellwig
2015-10-21 15:45 ` Dan Williams
2015-10-21 16:35 ` Martin K. Petersen
2015-10-15 20:00 ` [PATCH v2 11/12] block: blk_flush_integrity() for bio-based drivers Dan Williams
2015-10-15 20:00 ` [PATCH v2 12/12] block, libnvdimm, nvme: provide a built-in blk_integrity nop profile Dan Williams
2015-10-15 23:53 ` [PATCH v2 00/12] blk-integrity lifetime fixes Martin K. Petersen
2015-10-16 0:06 ` Dan Williams
-- strict thread matches above, loose matches on Subject: below --
2015-08-21 23:47 [PATCH 5/5] block: Inline blk_integrity in struct gendisk Busch, Keith
2015-10-12 21:05 ` Block integrity registration update Martin K. Petersen
2015-10-12 21:05 ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-07-21 12:01 [PATCH 5/5] block: Inline blk_integrity in struct gendisk Christoph Hellwig
2015-08-20 20:41 ` Simplify block integrity registration Martin K. Petersen
2015-08-20 20:41 ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-07-16 9:19 [PATCH] NVMe: Reread partitions on metadata formats Christoph Hellwig
2015-07-21 6:02 ` Data integrity tweaks Martin K. Petersen
2015-07-21 6:02 ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-07-21 11:53 ` Christoph Hellwig
2015-07-24 15:14 ` Martin K. Petersen
2015-07-22 11:35 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445309132-31824-4-git-send-email-martin.petersen@oracle.com \
--to=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).