From patchwork Thu Oct 15 19:59:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7409451 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6F5E1BEEA4 for ; Thu, 15 Oct 2015 20:10:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84D862044B for ; Thu, 15 Oct 2015 20:10:40 +0000 (UTC) Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82B7D2060B for ; Thu, 15 Oct 2015 20:10:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9FK80ZD034724; Thu, 15 Oct 2015 16:08:00 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t9FK5fJG001900 for ; Thu, 15 Oct 2015 16:05:41 -0400 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9FK5e8S021137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 15 Oct 2015 16:05:40 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx1.redhat.com (Postfix) with ESMTP id C0E338E697 for ; Thu, 15 Oct 2015 20:05:39 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 15 Oct 2015 13:05:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,687,1437462000"; d="scan'208";a="812011160" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by fmsmga001.fm.intel.com with ESMTP; 15 Oct 2015 13:05:39 -0700 From: Dan Williams To: martin.petersen@oracle.com Date: Thu, 15 Oct 2015 15:59:56 -0400 Message-ID: <20151015195956.20721.41442.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151015195939.20721.23101.stgit@dwillia2-desk3.jf.intel.com> References: <20151015195939.20721.23101.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-RedHat-Spam-Score: -4.63 (BAYES_50, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_PASS, T_RP_MATCHES_RCVD, URIBL_BLOCKED) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.75 on 10.5.110.25 X-loop: dm-devel@redhat.com Cc: linux-raid@vger.kernel.org, linux-nvdimm@ml01.01.org, Sagi Grimberg , axboe@fb.com, dm-devel@redhat.com, linux-nvme@lists.infradead.org, Ross Zwisler , hch@lst.de Subject: [dm-devel] [PATCH v2 03/12] block: Reduce the size of struct blk_integrity X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin K. Petersen 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 Reported-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Tested-by: Ross Zwisler Signed-off-by: Dan Williams --- block/bio-integrity.c | 4 ++-- block/blk-integrity.c | 6 +++--- include/linux/blkdev.h | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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 *);