From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7D60C433EF for ; Mon, 24 Jan 2022 16:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C8yw8hXRZj6mdMWTsc0rPgbsW+igRcHJLL5nqS33jf0=; b=TyjF2x8/AqWXaOnIAtj2UpuTUT P8ou5Q2/4UftQeSlt3e5RvjFtFU7kAWgpIuS/b2veYyWOaWmOUMUDBhDMLQKYfV43ohY23DrBNPBN D+WcPaqWdd9Q5OISvsNMKGpMMg0URfShB2JlCtAB69ACnd7LwKBYmR6ApkvpPMLW6o9A+NeJrE+Tp 9wXsalLmW6h8p3i+256ihwlCjZSXCYb0X5zxkkz6ILqllMj6wiiqbnI+AEDVewqvVZvyl8mAieOwF l+/IA+O80bTrpGq82LECFab27NQ26yby7U60h218FNjprfVEdDJDedY9J9T4rDc9cR4asXMez+ecr xfhqCgXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1mN-003t1t-8H; Mon, 24 Jan 2022 16:01:15 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1mK-003szq-8h for linux-nvme@lists.infradead.org; Mon, 24 Jan 2022 16:01:13 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5B8F614CF; Mon, 24 Jan 2022 16:01:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A81A3C340E8; Mon, 24 Jan 2022 16:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643040071; bh=Z/Mj7XngyF9X2Wrz/JmIDkKpDKYizMMSNAPpmkgr9zQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WD7Bd5anbjPEer1IHHB/O4SE1/PyUmvY/vNzCB3R0JNLQfUzU4d0ea/9A6e9NN3Ux ByvHZMa6WE4cN7XkGQ444NbUT4gm3S4PRm946xTUscEBcNPLvsxLkp1tXPa8GggaI/ 879gNWWKoinfb4GP9Kf/QfMfqORZ27K/GY6Glsul1hmyMFYh3HEkSBtI5k7BRPU/LS r+ig3xRDH5qPWpNul7cH2OnbW17jAg/2Fy+xnQHIIXCV28GhXxdCGDHptrCsDqXKNO 1Ti3iJszcPRL6CAXAVa8IVt+Ovpj4R8C7BZGgqPHFZzpvvyrIwYC43ynvf27ifJsRZ jDQsXZfXk4hwA== From: Keith Busch To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, martin.petersen@oracle.com, colyli@suse.de, arnd@arndb.de, Keith Busch Subject: [RFC 1/7] block: support pi with extended metadata Date: Mon, 24 Jan 2022 08:01:01 -0800 Message-Id: <20220124160107.1683901-2-kbusch@kernel.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20220124160107.1683901-1-kbusch@kernel.org> References: <20220124160107.1683901-1-kbusch@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220124_080112_369931_1D68B711 X-CRM114-Status: GOOD ( 12.59 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org The nvme spec allows protection information formats with metadata extending beyond the pi field. Use the actual size of the metadata field for incrementing the protection buffer. Cc: "Martin K. Petersen" Signed-off-by: Keith Busch --- block/bio-integrity.c | 1 + block/t10-pi.c | 4 ++-- include/linux/blk-integrity.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index d25114715459..e40b1f965960 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -165,6 +165,7 @@ static blk_status_t bio_integrity_process(struct bio *bio, iter.disk_name = bio->bi_bdev->bd_disk->disk_name; iter.interval = 1 << bi->interval_exp; + iter.tuple_size = bi->tuple_size; iter.seed = proc_iter->bi_sector; iter.prot_buf = bvec_virt(bip->bip_vec); diff --git a/block/t10-pi.c b/block/t10-pi.c index 25a52a2a09a8..758a76518854 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -44,7 +44,7 @@ static blk_status_t t10_pi_generate(struct blk_integrity_iter *iter, pi->ref_tag = 0; iter->data_buf += iter->interval; - iter->prot_buf += sizeof(struct t10_pi_tuple); + iter->prot_buf += iter->tuple_size; iter->seed++; } @@ -93,7 +93,7 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter, next: iter->data_buf += iter->interval; - iter->prot_buf += sizeof(struct t10_pi_tuple); + iter->prot_buf += iter->tuple_size; iter->seed++; } diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index 8a038ea0717e..378b2459efe2 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -19,6 +19,7 @@ struct blk_integrity_iter { sector_t seed; unsigned int data_size; unsigned short interval; + unsigned char tuple_size; const char *disk_name; }; -- 2.25.4