From nobody Sun Jun 21 13:59:04 2026 Received: from mail-dl1-f100.google.com (mail-dl1-f100.google.com [74.125.82.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 870D43D5235 for ; Fri, 3 Apr 2026 19:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245286; cv=none; b=LRIUhfnSFc0T722iCyfI1OyxASSk72JnEdkZOKPv7PuQEnE9Xgr6DevbjwJzdP2HOIqtngM0jfQE2rcmv0uHQnOXh3he3Qb6C3pztnl+oCB7YSTQXR+nWGdHc5/Zyu32iKVppqpq8TWQDXhbh6gAvRilwRW6fsQVeIK8qe2jyfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245286; c=relaxed/simple; bh=6guigZtakqC5pvuDbptKgaqm6++svhWNI/4P7FQdOpA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ise+5rVQYrmPebzVsyGT94BxgvMBjnza73Ht5dh9rSh8WK+WXiFmVzR3pjuhbiIetQ0ti4T68/VUglKEeSVsSWcqvJMRaYvmv2jFXQ7DpstaQtWi0z9U4j2jGyf8WdVqdKl21Xz/QL4sGhnBLlFZvOUMPifZlobeCnQ6aXtloeE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=W3GRVnJA; arc=none smtp.client-ip=74.125.82.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="W3GRVnJA" Received: by mail-dl1-f100.google.com with SMTP id a92af1059eb24-128bae6a35aso78276c88.1 for ; Fri, 03 Apr 2026 12:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1775245282; x=1775850082; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L5n7eMwAf8ARSdCe/bC94DhqCdtLVwx2F31J3F2H4e4=; b=W3GRVnJAV+88NGTdK1YaoDuXShp6cW/1gloZhDOSAJUahZ0CQw/tcrbUXrHuR+n4// VBo7wwIemJ9vuXs0lhr+pZxRDYk8iOsd3wBTk/Jrfs0nc5msQLeUrxlmNjr3N6Y65Rb/ ONqXfOtsCDm+22UfgtjyQIVrnnwOUHyeW/TLokpgSTsujHpkUQpgfjnSn1B+AiYWerm+ D8vaXTwvlHyzL5Sz+6VjF3PVP3hlrdj9PReH7KTuCuHQbq3BxyvbnYK2pJaZeab4FfpY RRM0ZCnedorRkquh7Y18SaZh3DqHfyy15c7H1dxrFa56GCntKjCmNheZ3Rh0LhUJTHoJ waqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775245282; x=1775850082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=L5n7eMwAf8ARSdCe/bC94DhqCdtLVwx2F31J3F2H4e4=; b=RtjEqe5K75ThemFeu86vgQxHhSWxlYQkYFXT1A89yjdDZFOhOeNowv76oYAk9MTVH5 KVJ83JzW0G6+NsgE/1NmzNqETgm1Q63+BoMFgI49lqbCKO/OeytskSjcFiFeWnKt54EF CFsirzUnqeu4Bor/IwTRzkYpRrGIbpx5+jLDYgbpsoo4zspqVqRlhrE1YlankjzMGKTc adGct/pqLvQGvqMxdNHspAzzUorqI0M7sbYPi3JjYVOOBw6HfqoOBlvJsPDAb09dnXnR 9i7DuuTLgt9K86CH8GiOzaIVNMJDQ9IpsTtTXkxS1/uZllSc8xmxYVUXxBCR3nUdaPaM IZRw== X-Forwarded-Encrypted: i=1; AJvYcCUyleyAfY/9lecPYYtOXgOpE4+zpIC1sXH1SaHqcxmAXc3B2///fCQLMxMCrrUsosO7alMwoOSciDlzCY4=@vger.kernel.org X-Gm-Message-State: AOJu0YwhnZV2vSl5EwzBTlDe2nbDZrgaAYUfwH6bUlwEwncOEhnVPbvM FiQQVHvvvFzKcJock9Zwcfvo4QDOUQqhI69uMJFOvOZvkCobtc9IqGcTKc79YiX+ztDwjkHTixV Oh1IQ2Xv2TNnVrO8J2i/RZIdpFWgOeE5cmn2v X-Gm-Gg: AeBDiet+VfzV+3L8FqoMi55e2mtTimoufZVfVxt9tsbG4LnRWjxYKqEtze8ulniUJoP ejE0ywoJHN0Z0RzRgMiUro8wnru4digl9iVhiBk1SliBBN1+S/6y4aOjOO5pHGiJUvXfnXtPkY5 gbYCrXMoc16WWo94BFGXOWVp3EPP3LQsQvle+YSJk4uK+8mmqGMj3/c9WBhB6tnbGgmVAwQut1L UGpKG6G1+mpMoEjnQDFU8gqSC+lvlaosRw0UxMYI7Uc35m4noWy2IoGmqCXmxHQMEA3IcviSQ4K CMZ4prWNSkqlNOLh9OGCWGdJq2zlvLc+23y03maqfzkLR9HaGP1BzbnXWgX/4LUMmHI2YbAXBVo /a6r7KYL/3sQZ6nEY+cPH7cng3p2X3H4BSr/rN6b3zxae1RNLVeePQA== X-Received: by 2002:a05:7300:4347:b0:2c0:c961:4b98 with SMTP id 5a478bee46e88-2cbfc85e0eemr888275eec.7.1775245281557; Fri, 03 Apr 2026 12:41:21 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 5a478bee46e88-2ca7b9037b5sm474222eec.17.2026.04.03.12.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 12:41:21 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id ABDFF34071E; Fri, 3 Apr 2026 13:41:20 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id A21A2E41AC2; Fri, 3 Apr 2026 13:41:20 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Date: Fri, 3 Apr 2026 13:41:04 -0600 Message-ID: <20260403194109.2255933-2-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260403194109.2255933-1-csander@purestorage.com> References: <20260403194109.2255933-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To allow bio_integrity_intervals() to convert an absolute sector_t to an absolute integrity interval, change its argument type to sector_t and its return type to u64. Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta --- include/linux/blk-integrity.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index b1b530613c34..2e366f03a3d8 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -64,21 +64,21 @@ queue_max_integrity_segments(const struct request_queue= *q) { return q->limits.max_integrity_segments; } =20 /** - * bio_integrity_intervals - Return number of integrity intervals for a bio + * bio_integrity_intervals - Convert sectors to integrity intervals * @bi: blk_integrity profile for device - * @sectors: Size of the bio in 512-byte sectors + * @sectors: Number of 512-byte sectors * * Description: The block layer calculates everything in 512 byte * sectors but integrity metadata is done in terms of the data integrity * interval size of the storage device. Convert the block layer sectors * to the appropriate number of integrity intervals. */ -static inline unsigned int bio_integrity_intervals(struct blk_integrity *b= i, - unsigned int sectors) +static inline u64 bio_integrity_intervals(struct blk_integrity *bi, + sector_t sectors) { return sectors >> (bi->interval_exp - 9); } =20 static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, @@ -151,12 +151,12 @@ static inline unsigned short queue_max_integrity_segments(const struct request_queue *q) { return 0; } =20 -static inline unsigned int bio_integrity_intervals(struct blk_integrity *b= i, - unsigned int sectors) +static inline u64 bio_integrity_intervals(struct blk_integrity *bi, + sector_t sectors) { return 0; } =20 static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, --=20 2.45.2 From nobody Sun Jun 21 13:59:04 2026 Received: from mail-pl1-f226.google.com (mail-pl1-f226.google.com [209.85.214.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63CE13CA4B2 for ; Fri, 3 Apr 2026 19:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245284; cv=none; b=C7SgG7CDQXRTZ/xYfORkwl9j4j71ZsRPpQxTW78mFiawRy84BoehWwC7T2SFoF2pjIxxKiEb6T1ctSvuX2eyb2oiQLr78ErlGvES8Z4LImma6upqsHF8awTK4mSEKUl+oGpG6VDgghEPhNuuC6pH86gWIYmcIzEusVUHoGCHK04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245284; c=relaxed/simple; bh=g5gsp0l2vOBOchC0OWlOg46KrJqq0NoVOVwDQTLaxVA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VR/gYKMNhJYmyibFJ1jaPI5Cw2DJDHQRDwREGeyQwWhVCfamaTaOUaOtycAP7EHc6n/8HVdU3tQumuJYdcuw+01sFqjoMgSPUFF0VfJb+PnxnrIoGNOgmAlZzKmdJr4/gzDkYuAs/ewQZRXbeRX7KHQ3MQYHzHzuDTv+68Lc2yg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=FZ+HHEZm; arc=none smtp.client-ip=209.85.214.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="FZ+HHEZm" Received: by mail-pl1-f226.google.com with SMTP id d9443c01a7336-2b25314f060so2859595ad.3 for ; Fri, 03 Apr 2026 12:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1775245282; x=1775850082; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YNpmXbw2grXDnIgg2ghLS/nTKNFvNfDaTGEvndg19+Q=; b=FZ+HHEZmKe39CxZXBdvhZjZZvmyhiwKr4sqy/hy2yNPxpJNrXZTtjEgbD8weSn/kQT +ba6GVCYxWJ0RCOtdKmm2TRnRxNJkyphLE6a2B5m1DANV/qrOV3jvIrLztgc3bN1BtS9 KvTICym7qTWCE3RejXMYS+LhUkx+P0hjXmPq4M8NVWVKVxiNzvxyY4GdAdme6TQ8lcGb Xso/qNWc6/bM1sOhgCDcc8ta/QplEHO47FBQerY1gE16afCMBpRhAA5Da6b0KX34Eb1z HFTakOBDa2SrW9vqEQUUzbKA9BMaqKY3IOSh57jUrvVLedaT8kTi+XGZve817e1lf+UX IOyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775245282; x=1775850082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YNpmXbw2grXDnIgg2ghLS/nTKNFvNfDaTGEvndg19+Q=; b=OpR5C50Z5p9ijEPsvTPVl9ez3ckzVFOrwdS6kF4vVkf6NEhvhHW5BtthLlWNcEaOfg RxP4ReRtvEK2WHp/yJUvMLpFPPCLJALdpkPMUlBPBRGX56+4pWhbgLWl+p1+X3Cxtari Eh/dqy0lvijJlRIvRAbIuw990xTsVTMOLUdRutVBlgGlLdSiL2fzRpVF9z0jEJAhwHGp esVNT/pWwhYpefCR/lFJgMH9IJ1zntlhb2jMr3tjIo1d6Yvl+oG8rpxKNwd1/s56yfJR b5rQ+3bbxjXhjFS+ozBEy16eu7I+7fLrOjBZz+VTbY+ykzvwfGFrdyPgtmggF34HEBll 6r+w== X-Forwarded-Encrypted: i=1; AJvYcCW3TMpH3Vll41UGcBpsnALCM3r2zjaWmCpzePyk0x2r2915L3/S1oIjW+mdyJvWaQt/LBoqMyy1wmzLcv8=@vger.kernel.org X-Gm-Message-State: AOJu0YwcbsmoH9hgpGSrwmIS9KljibMMyFjxgXC0mQNhhF53L13KdhNn 6VRVtdYOZZX20NvPQufLdwU5N8InZBIjzC9BEakxncyNbQxws01D7cREZmw+GtZ/biKEsN+Ne60 +nne3ktix7H9YjuHyQxw60nCrIVA104kqPlCotQx0DKdEV3gnOfWn X-Gm-Gg: AeBDievFebzYwGEK7qM2lyUvU1Q7u7x43jVvQhr2Ge+spna4DSQp8Fz2ED2+3Hpmtpd N/zv0kqjl49S5TxV7SHOTk7DPOSy4PlcFd3U2OsWLG4g/9pb/OI4BdjSkfDHWVc6Iy4JFT8qY+k ybkIMxvRStLjk1OcU73ZsncSyQNxIWlWcPCOg1iThgKOF+Kd0sLjaAz9rQ/+m+RlLSkM35C1X1Y 1hvhgs+kcj2eoJ5kwXtHx/gsKOu3Hdb3rqlT21UXFt2jPuuUBUY29M01b8O4hDr/KRuCRE0rb4y abYblFBr5vC3tYbR9kc28ncW14vZOvk240SRD8mPDfebu7Rhah1GBV4aVAFvpUNdgxj+jhMfiuv Hgxbm+VilI1/N2xhAaVyi4NiP/famPuYL1Npi9Ho= X-Received: by 2002:a17:902:f70e:b0:2b0:ba60:7210 with SMTP id d9443c01a7336-2b28173d1f4mr25910015ad.1.1775245281579; Fri, 03 Apr 2026 12:41:21 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-2b27493545fsm4944455ad.54.2026.04.03.12.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 12:41:21 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id D7FEE34084D; Fri, 3 Apr 2026 13:41:20 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id CE528E41AC2; Fri, 3 Apr 2026 13:41:20 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 2/6] block: use integrity interval instead of sector as seed Date: Fri, 3 Apr 2026 13:41:05 -0600 Message-ID: <20260403194109.2255933-3-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260403194109.2255933-1-csander@purestorage.com> References: <20260403194109.2255933-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bio_integrity_setup_default() and blk_integrity_iterate() set the integrity seed (initial reference tag) to the absolute address in the block device in units of 512-byte sectors. The seed is correctly incremented/decremented in units of integrity intervals in bio_integrity_map_iter(), bio_integrity_advance(), and blk_integrity_interval(). As a result, the ref tag written or read to a particular integrity interval on a block device with integrity interval size > 512 bytes varies with the starting offset of the read/write. Convert the initial seed to units of integrity intervals so a consistent ref tag is used for each integrity interval. Signed-off-by: Caleb Sander Mateos Fixes: 3be91c4a3d09 ("block: Deprecate the use of the term sector in the co= ntext of block integrity") Fixes: 63573e359d05 ("bio-integrity: Restore original iterator on verify st= age") Reviewed-by: Anuj Gupta --- block/bio-integrity.c | 2 +- block/t10-pi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index e79eaf047794..4be2cf649e54 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -104,11 +104,11 @@ void bio_integrity_free_buf(struct bio_integrity_payl= oad *bip) void bio_integrity_setup_default(struct bio *bio) { struct blk_integrity *bi =3D blk_get_integrity(bio->bi_bdev->bd_disk); struct bio_integrity_payload *bip =3D bio_integrity(bio); =20 - bip_set_seed(bip, bio->bi_iter.bi_sector); + bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector)); =20 if (bi->csum_type) { bip->bip_flags |=3D BIP_CHECK_GUARD; if (bi->csum_type =3D=3D BLK_INTEGRITY_CSUM_IP) bip->bip_flags |=3D BIP_IP_CHECKSUM; diff --git a/block/t10-pi.c b/block/t10-pi.c index a19b4e102a83..36475369cd16 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -315,11 +315,11 @@ static blk_status_t blk_integrity_iterate(struct bio = *bio, .bip =3D bip, .bi =3D bi, .data_iter =3D *data_iter, .prot_iter =3D bip->bip_iter, .interval_remaining =3D 1 << bi->interval_exp, - .seed =3D data_iter->bi_sector, + .seed =3D bio_integrity_intervals(bi, data_iter->bi_sector), .csum =3D 0, }; blk_status_t ret =3D BLK_STS_OK; =20 while (iter.data_iter.bi_size && ret =3D=3D BLK_STS_OK) { --=20 2.45.2 From nobody Sun Jun 21 13:59:04 2026 Received: from mail-dy1-f226.google.com (mail-dy1-f226.google.com [74.125.82.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E3DD3D6693 for ; Fri, 3 Apr 2026 19:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245287; cv=none; b=dNedntFJ+K83UNkAYcvpz68ZoHH0GQP92KpRBwGWBnkYh9BWC785yTqYvcppUX6UtbnFAflwe+9QP22B7CED1voUz30DoiDIWgHt9GY9wrNkn24FsA9CmUI06/9OtDV62VtWeQRfxkG+jaQ+BKRcs4KDdrhBG7I6pcaHMdR2DYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245287; c=relaxed/simple; bh=StQVmJOsIkuZMZaXOXrZ3Rg0RILGKQN07uYzkf41kBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qhvl7O/0i4yGAZhlOdcZPl65eGUn8uVr0QUJDlQd8ir7gsIWRUCGyVYexK0kMuQjMSZGM8MYXmM5tx6N+0zxChjyMBekqD3Md61KOXAVZNy/ptfkhbpM1Qc/lMNsHju6GwXf1u4xcwevhgS0cUdQLhYx7rimjTMyRqLM5h9yhI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=HaMdiZD+; arc=none smtp.client-ip=74.125.82.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="HaMdiZD+" Received: by mail-dy1-f226.google.com with SMTP id 5a478bee46e88-2c16286c496so82620eec.0 for ; Fri, 03 Apr 2026 12:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1775245282; x=1775850082; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5OR26UHwrmX/qKb/xGTxkRmRxVQZGF/pWpTgOpuYDGw=; b=HaMdiZD+T89llB9XbG9YMNXsvdolFfaoxG3De0eUfa47cWS3Ai5R+Q3br2EinrTQWA a09nDSTUHeBaq6OcBC7jUS7NVsPkkv7gI2VQwS3TP7zwfq3ua7oVGwXVIhv7fC1TFxbQ c1zs5RrO/Adc49vReJXjKqOyb4nKOSlL01JJlHXs8Ch/3OlHZ4f4BEFlDiMoGHWQtWMv RGIpa58Lg6/GXq3oXEa3Yzk2OTqCdBbr/Fr4X/ci14XxBymNT3i3InRP9ScSUAqUPV4L GF1IdAc8bdQGuLf7pJ2p55GsKdHsntoanloOxDX0FnduyiKQ3vlnHJA/FovFM9QxdqUX YiZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775245282; x=1775850082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5OR26UHwrmX/qKb/xGTxkRmRxVQZGF/pWpTgOpuYDGw=; b=eVDm5aawyQJu1EsKsF1aoIT43M37HCgwBoDecd4psxkkNTtTkljZ5ovjWT23XA0Vtg YO0wN/Aw10q5SM82mjZQRZS3cvJYdoTCAhAIDfFNQFeFuwaMrbnh5IxkvIdFalzfM3jS 4lqdr6gIjw7fzpuqjwaV6eVmLWHQW2+sQuw156ZtMY55OSpT0tc8D0LImGn2lZSRuTfN qikMGb6t9aVtPjCDyyMPN1yv+jr7kzUNxMgDB5IX7zM3fY6JcLrlC/ZMV1GxsEOcEUEg j1pdBlMnl3ynVMVvpFfbhofDweKiheVh0ZbV3ys56wZALHkONjDKQl0AvE8ToF4aElMK DnCw== X-Forwarded-Encrypted: i=1; AJvYcCXa9IleaAZ7IwTQFutPj5pfv91pHpNlDkzEqGpGcaFjp+4F/Q6Hy9w/TddNRr95xSq/6lV6dm+LnZwc0+s=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+gPaGSeschpBMjsRLtOAhIg7X5DW2fgoUBJlJdkwxO5KJfMTp kSoNOGNNV2/eUfUc91qKc3H+Bk/Me/EiR5iEkz+cakb5dEASAjaGKUHxFF3FPhQnKcDZJfvl/2U ilc7mwdGMyVk23k9VVEDvJXwzdt9GDyOqlARr X-Gm-Gg: AeBDieuvHa4SiyywMuxV8mMEC0HxJSFV13hTdCm6AOAZc+T8JOoSfl3f2cvxQOWcObl rXPIkxkM39wjafXkeUSjLsK1HGapzkHE9MIL9Y6B6pD4bhIW8P7ec7RQZcORp4qJHYTv575CSXr iY0NjILQruAnLqLU7dj2ZfHGba4coDjUB+VtNvlWMJq9PbXvvk8X3X0NnLCJzng4saXyEjZtFJf aujfR0H2zCCocE1VBWtpYRPaXjSBIPdt3NGa7GegDq2aurawimGVdbRVTL/3yaRpsil6i+FM8OL iDgGriPAIoZpPJSdOy9NmwpQkdw0S2bcMdzf2Fctq7NZvOPqlADEikMXllHdSrnLKKWZpMA8+3G Tk7oGzYoawcERnEF86u+NeynRVot5zD4/kMqNXO4gG4WuRuur9uIBxA== X-Received: by 2002:a05:7300:2315:b0:2c4:76a3:bdfc with SMTP id 5a478bee46e88-2cbf6897126mr861527eec.0.1775245281934; Fri, 03 Apr 2026 12:41:21 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id 5a478bee46e88-2ca7bf00671sm474049eec.22.2026.04.03.12.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 12:41:21 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 0C47D3422DF; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 029C7E41AC2; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Date: Fri, 3 Apr 2026 13:41:06 -0600 Message-ID: <20260403194109.2255933-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260403194109.2255933-1-csander@purestorage.com> References: <20260403194109.2255933-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bio_integrity_verify() expects the passed struct bvec_iter to be an iterator over bio data, not integrity. So construct a separate data bvec_iter without the bio_integrity_bytes() conversion and pass it to bio_integrity_verify() instead of bip_iter. Signed-off-by: Caleb Sander Mateos Fixes: 0bde8a12b554 ("block: add fs_bio_integrity helpers") Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- block/bio-integrity-fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/bio-integrity-fs.c b/block/bio-integrity-fs.c index acb1e5f270d2..389372803b38 100644 --- a/block/bio-integrity-fs.c +++ b/block/bio-integrity-fs.c @@ -53,21 +53,22 @@ EXPORT_SYMBOL_GPL(fs_bio_integrity_generate); =20 int fs_bio_integrity_verify(struct bio *bio, sector_t sector, unsigned int= size) { struct blk_integrity *bi =3D blk_get_integrity(bio->bi_bdev->bd_disk); struct bio_integrity_payload *bip =3D bio_integrity(bio); + struct bvec_iter data_iter =3D {.bi_sector =3D sector, .bi_size =3D size}; =20 /* * Reinitialize bip->bip_iter. * * This is for use in the submitter after the driver is done with the * bio. Requires the submitter to remember the sector and the size. */ memset(&bip->bip_iter, 0, sizeof(bip->bip_iter)); bip->bip_iter.bi_sector =3D sector; bip->bip_iter.bi_size =3D bio_integrity_bytes(bi, size >> SECTOR_SHIFT); - return blk_status_to_errno(bio_integrity_verify(bio, &bip->bip_iter)); + return blk_status_to_errno(bio_integrity_verify(bio, &data_iter)); } =20 static int __init fs_bio_integrity_init(void) { fs_bio_integrity_cache =3D kmem_cache_create("fs_bio_integrity", --=20 2.45.2 From nobody Sun Jun 21 13:59:04 2026 Received: from mail-oa1-f100.google.com (mail-oa1-f100.google.com [209.85.160.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF34F3D6477 for ; Fri, 3 Apr 2026 19:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245285; cv=none; b=NRL7tfJMasr+GCq1RXCA4XuBkmIceTJ+vgN4lahsmr96H3Y5t86TY+1+glt2HnzFzEcijUeM2Nj9xbhPQ2KB8yD1Z6HSGZ6/a+rnUFvUm7ahgU2xCUTV05PPoOHle6Bj34NYRV+QD6CXI3W57WKHZHcqK987FOrSIUYdlD8xyx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245285; c=relaxed/simple; bh=YYGrwQRz4CUpiS0HafIif2tS+tWh36dIqKCheejEgg4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TIRXbkF20GuyplWuRqs1+aB7hU97YWTyT382jLWwrLcBOVtwl2W2jiA2pvpj9S8uTlInBBvYeRIcb9JquQ0hMwh9rXOmXudylnmiWQ7wlvNwjwLuWAb/9GX3np02weApLmG4RWKKlLA0gFSeQhIL54QpswawjnEUzcf5QAajq/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=edYt1hND; arc=none smtp.client-ip=209.85.160.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="edYt1hND" Received: by mail-oa1-f100.google.com with SMTP id 586e51a60fabf-41c63f371bfso176316fac.0 for ; Fri, 03 Apr 2026 12:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1775245282; x=1775850082; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=otX1Hqc0T9DvgqLYhcqiRNaRpAdPxblh5+E7UixGoPQ=; b=edYt1hNDxW0OYL+t0VGIvgcz9lgtpWhSdGkrNqD6MAGIbJlLEV2Zkj96at8Pq8uzJS OGWTPrIO+MmuobdFI++4h7RrDnFKtAW20d++l1nyyGwywqipRDIkeektWcyC4PA+X69L TUHYXuqomlQWPDRYYgZ3XoOYG/cHQLxZ1WcLgTpMglKqI2raIdmHSMVptMWq8dH7WBoC ZrI+G/isek5bv0yB1pbwzgMMbNx2qdteumh9lnEYBouU/V5WdhH75JXJ06XHAeZD8GiL 5xeJwt/x0CbzM6xV60SrbfuhammflPrR2wU/TQDon4Dy1g5Ws9pBTSDZyTxtGTr7wRuK 8f/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775245282; x=1775850082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=otX1Hqc0T9DvgqLYhcqiRNaRpAdPxblh5+E7UixGoPQ=; b=nH886OThlPbFh+gRWxDMUjti2qtd5RmhqkENonXCTc2hzNpD2RXm9/jbS7zLK3RUNU a+UEIHJrJhLrCkxUA0Yy5L+hCJW/XU7vy1rffIuV0XeH7rHJPYd6SQty/cI0MmslG3Yp T8Uc/u5Z6oOOzbc3dkJshJkNeU94Eb1hs0ZYkR5zpohOQt/mRZARSvR129iwgOts9RlN LK91lBv9XEZVbTbd0Xc8FLjF9ssvWOpITUee/xeA2taq+j1TffgpXrxcL4qdCzG/J9xJ MmtQXlDY4lCtVF7v/KucivArjP3Ee0oagRh8LUkvzGIKegnvH/RzqdAcD4zbGOtMFAqG iFhw== X-Forwarded-Encrypted: i=1; AJvYcCUZ3HbGitky2yC9IKEsqZiIOf5NAjq2lcuw191YZ1yJVu6WlAghruBxIssTYei4GCC9wyTnc9KUb0cYAyA=@vger.kernel.org X-Gm-Message-State: AOJu0YyJwCgYf28S6G54d6GYPru2dkVuCoqGlDxKmJVV1S7SOPprHCbt rQy46tZLvGT0RHeEPKkeU/Ut+CkOSWSqmBxcku4CbdHufHGSXuhlaZ6THbTX2zoizBkCi7sR2+r FzkBl9Oyd/WyX41Xyq8+OwSnmQ5oN6VfqHwcJ X-Gm-Gg: ATEYQzzqs3/0xzhKnz2NIF9LsKLG7q25iBGISuGUrPTKgl+7z/VBYZsQsdnUzOsohiV UBvRIJUlBeGJGuyKvH5VLaVe6xWYZDiL4XvLEbu65DpCO6RfIPHt4I2wUcx8AM1AZ8xkByUT72q TbR4BGcdyP6BwUUjuXB9NDf6CkFUmB/90b7SFUUIYa6RdZGVtZ9k2Ha18JZGx+LGyv6SDugvnfy Ut2CqT+sMi7q1WwxrqA37UoUHB38I77ShdpPf4xoMrMCV4QUr5J0PRrHn8i1EFHev3YWbL3kERm T9VRJSbliQ0phFuRUu8TuM2h2nDJbLdglrVkuJcGqfpKvmvrC6T5JbMuh7xXG2v8A2N/VkJ4U4o oqQVYj9rU436TNQfXGuFX/U/Lf2nOTUdMo9x1gPnYlA4VkKwIlyZWVQ== X-Received: by 2002:a05:6830:25cc:b0:7d7:ce56:b93 with SMTP id 46e09a7af769-7dbb72f247cmr1794595a34.1.1775245281603; Fri, 03 Apr 2026 12:41:21 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 46e09a7af769-7dba72d7182sm505129a34.7.2026.04.03.12.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 12:41:21 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 31F7C3422E1; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 27E8FE41AC2; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Date: Fri, 3 Apr 2026 13:41:07 -0600 Message-ID: <20260403194109.2255933-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260403194109.2255933-1-csander@purestorage.com> References: <20260403194109.2255933-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bip_iter.bi_sector is meant to be in units of integrity intervals rather than 512-byte sectors. bio_integrity_verify() doesn't actually use it currently (it uses the passed in struct bvec_iter's bi_sector instead). But let's set it to the expected value for consistency. Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- block/bio-integrity-fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bio-integrity-fs.c b/block/bio-integrity-fs.c index 389372803b38..5d1b0e33fc5f 100644 --- a/block/bio-integrity-fs.c +++ b/block/bio-integrity-fs.c @@ -62,11 +62,11 @@ int fs_bio_integrity_verify(struct bio *bio, sector_t s= ector, unsigned int size) * * This is for use in the submitter after the driver is done with the * bio. Requires the submitter to remember the sector and the size. */ memset(&bip->bip_iter, 0, sizeof(bip->bip_iter)); - bip->bip_iter.bi_sector =3D sector; + bip->bip_iter.bi_sector =3D bio_integrity_intervals(bi, sector); bip->bip_iter.bi_size =3D bio_integrity_bytes(bi, size >> SECTOR_SHIFT); return blk_status_to_errno(bio_integrity_verify(bio, &data_iter)); } =20 static int __init fs_bio_integrity_init(void) --=20 2.45.2 From nobody Sun Jun 21 13:59:04 2026 Received: from mail-pg1-f226.google.com (mail-pg1-f226.google.com [209.85.215.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC5CC3D3D1F for ; Fri, 3 Apr 2026 19:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245285; cv=none; b=R7bUoePEVsP31o62KhwU5y3JG31+/m0cde3DS5M2voo54hnkfc4ie7jPPtazRjYm7eUFiWLHtyGtDYR29mp33HKQgZtyzKBXc8bBYJ7zWo7JiDPziQa+AYvxkoi8cZwT8UgTbbaI1yGuW8CK5qkQJqd5mKGN/djC1txaAK+3AVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245285; c=relaxed/simple; bh=3X8FVNCusqycQp84YyxWQtssypswH6QLhLTJE0aKENM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XmyTUJJEHZEDyAN/vKkp7CV4S0eXSfPxfJ0v3VDIgq6fSTiSw7N3zVj+N3Md4uJu3BWH4mR1+78fvBFUKFH4B+rc76Um4dIcLo1D0nA3BbGqU2enZRCvaq4WZgzQIQx/AffUJXrdKhvEbF3QsP+LhIm3LAS0j1eiGeeN5cI/FLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=Qc2Jf0oU; arc=none smtp.client-ip=209.85.215.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="Qc2Jf0oU" Received: by mail-pg1-f226.google.com with SMTP id 41be03b00d2f7-c741c1a656aso133011a12.3 for ; Fri, 03 Apr 2026 12:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1775245282; x=1775850082; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FBT4yhY9HCpI609RSvOs0NG7s5YjLQ+PXcfiCvwv9X4=; b=Qc2Jf0oUPwOX5x18L+T6AtHmmvUM/LGEgchVQPfoPiyPBNZI20CiqiQOMEHqgW6VmN IDhYEc/istquK+3cbLEOcdQhxZwEIGzO3KNx+kvZ25jlnlO6OQr0Gns5p9B4zhcRMFhr QzIVqD8yxEPf9z6KzdQHBXMuwIi4ylmbzynmjmuS/bjYrDQX2vQHQVOl1WGjPETYM6Hq asja5Ze3I5GEl3o6FzyDQplyD/7cd2u23CL3FbPFOYiEg8tpW2Z3TZTEqwDUbRRVmvOu MMG2aibMnIDdhRIOXctl7s86IBX5jjpOYvsWyOvQdoB94k4jZ1LX45XbdtRIb3D3IQSs vsYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775245282; x=1775850082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FBT4yhY9HCpI609RSvOs0NG7s5YjLQ+PXcfiCvwv9X4=; b=cOGo7tT5NSGOAuwYlTFcPAyzhprn6F/FBit8dEOupi31QAoYGyjSKVSqgF6Oa8vwzT e4hckHqxtT8zjYCxvUfMorXZJC9nEeKrzrHN/FfXTPFkx+kCplx8Y89RS7A9sFmB/oPw aoPo7jjCjxzHFnNdDv/VmUzv9qCpa1vjtC3eS9N603D6Amw31gCPZt5yd+8jI9wS2OYL HEKu+tjdOc4tvNRrzSmKzDBeY3RARhU/8Feui/Lf+mvb7MGQoF364IjcZO95FbkZvj0X CfTdRRyXtddQxSE7rSYMyXb54F9uCJ5fYz0hgkJ4CSV1J/PrwaUdGJilTcoSoVTm3rS9 bMLg== X-Forwarded-Encrypted: i=1; AJvYcCVk8LYunFiDu+p+xdZ5DXj6SevPyT8FCQJGYX0IskOzjQZv6l1OJ5QYVV7bgJs9Xcam3PpNTEpTn8nIQXw=@vger.kernel.org X-Gm-Message-State: AOJu0Yyl9FWC5GFfKdx1JVWaiNMqvTNOlqdq9HcYWJNCOdMHSxLtK82N SBojEcWq9IjKeg2FS3YXu8x1g65adVpsxMgB3kiGHfWBlgTAUidw1WljUOMJn9eyv7syEc6pwBM 2g8RdV5iP20LQbmXLF17GNxPXkNQ7R+3uKnDh X-Gm-Gg: AeBDievaBAfIdeTo1ztQkl75L37oxy2rjVSRNarHwCpjfyiFyFLTSFJ3mF2O03eqjPO oGqyaYplNG6O7VvF+tU+wySa73xPXP753wVl24xr2M4+8xHjA/sUe5jnbF1SrOOYVN1cjEOoidJ ZNvC9j97Mgbupb2eKWu05uWqYd4JhRLiEgAxHN+Irj5hKlVEx7faz6drQeMM/Qm/L2Ql39FZfcw k+7jS2QoebwLjj4ITOkjoMJS2qIVmRGh/l0eHYNVEff9pe/GeA5rj9Qqnpua2T9omVAgqTDL53f dN8FNQYiJbTSigqfNpVNf9/yo16k45HzuhcN3MJOYYnQrCV9tAyCasI2Wmi+45vzqtJRkpHluIf R0jtD9KvWkf1mB80fR8Y1oijBIOwuXAI2nWy5pKdTmmqc5VPFbCK4jg== X-Received: by 2002:a17:90b:4b52:b0:359:ff8a:ee4d with SMTP id 98e67ed59e1d1-35de69d98a8mr2252048a91.6.1775245282098; Fri, 03 Apr 2026 12:41:22 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-35dd3602d2csm550564a91.2.2026.04.03.12.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 12:41:22 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 583413422E3; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 4EF9EE41AC2; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper Date: Fri, 3 Apr 2026 13:41:08 -0600 Message-ID: <20260403194109.2255933-6-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260403194109.2255933-1-csander@purestorage.com> References: <20260403194109.2255933-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use bio_integrity_intervals() to convert blk_rq_pos(rq) to integrity intervals to reduce code duplication. Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- block/t10-pi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/t10-pi.c b/block/t10-pi.c index 36475369cd16..112015cdeb72 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -540,11 +540,11 @@ static void __blk_reftag_remap(struct bio *bio, struc= t blk_integrity *bi, =20 static void blk_integrity_remap(struct request *rq, unsigned int nr_bytes, bool prep) { struct blk_integrity *bi =3D &rq->q->limits.integrity; - u64 ref =3D blk_rq_pos(rq) >> (bi->interval_exp - SECTOR_SHIFT); + u64 ref =3D bio_integrity_intervals(bi, blk_rq_pos(rq)); unsigned intervals =3D nr_bytes >> bi->interval_exp; struct bio *bio; =20 if (!(bi->flags & BLK_INTEGRITY_REF_TAG)) return; --=20 2.45.2 From nobody Sun Jun 21 13:59:04 2026 Received: from mail-dy1-f228.google.com (mail-dy1-f228.google.com [74.125.82.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B23533D6CA2 for ; Fri, 3 Apr 2026 19:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245286; cv=none; b=SQcFUUne1vF0XSpv8xYoU/wrYwBzmXWsEoxqOvUYiMAuF+f+fcmde6IJb7WtPw8CgIZlsWy4H0NO4CO1Ge+G7BcnwlmYRZt6pIMdkpv9R45HWv8b1jJMGh3PPGSoOJwmv7eu6peVZs7JPJ+Zw2fK43KguXKfjCYB7VCSaE1f3FE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775245286; c=relaxed/simple; bh=dXB9nsSEQr0UD6HILmUJ3dO6tL18AphRTyOEKOREPnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NXppmzJ7d+6IGJbxQnW+NTxAgQNf/Dj1V4xYwY+11EuSq+IEQm/WuVguX3eeXednVqP3Zjp4IfSgrebYvYcxESQIinaMNU/ClfwaKkXF8JnqfI8hNb9Wpgb66kJIVv3VkG7A1VmJlaEB0YMINOoSnodDSgtKypit9uB5xxclMHc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=JvULn3uO; arc=none smtp.client-ip=74.125.82.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="JvULn3uO" Received: by mail-dy1-f228.google.com with SMTP id 5a478bee46e88-2c645e399ffso77581eec.3 for ; Fri, 03 Apr 2026 12:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1775245282; x=1775850082; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i7Uy8gUL8icrsg5BG6MoYGthlOT8yOCeEWU7Db5146I=; b=JvULn3uOwkKUaQaHqiJT+f+UAp8ILB924uzwY7yoeg21GuaTAkNMfn7WUgSTmCkyyC smp36/0PpdPHWDotyaAGL/JbIpK+JlJaBVTYquHkH154ucK+3pSS95gCSapl3kKo9uf4 CwKtYFWipRUDso/ZR6Q+7MeTxbp66XDGH5FaEwhIQQf5KAHfzO4HRx5Ch2hcidmiMls7 wASCAkOrzJBIOCxCNniqYnNrUCX2PDkSp054MqK0XYeRm+Mhy60OSUv9gYlxEKXOSt89 AFrDjNx/epWcUHg7nLd6JKf0zEH5JSKt8eVcdbCrM6HrP6YF+DCiIQzbi/HLtM+sOnOx w5wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775245282; x=1775850082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=i7Uy8gUL8icrsg5BG6MoYGthlOT8yOCeEWU7Db5146I=; b=WrjNcCv4t4XAh9j3XM5OeYu1PNQicaV6F94E62TNptK74LpOvl+qcpVXNzLFCfnBy7 UgffnQDMTMVQ+Ie59HU16KvKCM0wAau0SW0of0IDRio2sQHHu9tXhSLej1K0WSGImR18 VjL56GTFwCxcl27Oumc8VbWI1/bTOQaUsP7YLzNikvcfwy4p+KsD3MDwe9q8NaiSC0L3 wsEGTPnukCDYgHq4D0GOM+crvE2/yWl13IzNpx3xJVyxgf0YdwJtIQTIsHIa6JJ95ML5 k0GzL9yKyG3/jpYHBJXD9ZN/BCneNFp4KThkSeaw8jqTu4ieTdr8JKzJ8f0F+1lmqQPY 1wVw== X-Forwarded-Encrypted: i=1; AJvYcCWpKu/AKo27Vy24vLLwBPKWw5l2MSzmpvh9cmPBYX8I+M705JdztvQml16l7bj6q274wY3l55/8NdN6F9Q=@vger.kernel.org X-Gm-Message-State: AOJu0YyZ/7VI0C+bkQ6IRvNyH07fFbExrkwkyxFCAIr3VT967/Bo8LXt D1KGDN56W3zDUEpK7qh4P9G1lhEKpeu12Kq8H+anz46gXItbvR0++pPU32XGxwKWdsQ5XvzDr+K R43LHvSN6yl63lA7k1t0K78b2eapXENTaiT+j X-Gm-Gg: AeBDietVKKHD9bZeAL99pfTmhBvsp6ugUgoxhP+oUi5fGgG/Fcy36goRQ6cadMVdqrp cNx4MuS5A4GAS64noiJq5sbiSRUa2tP1/ndUWSx962PnoAryusxe48QmBcItNtFpWl0eewN+Cpu cNAZgG9AftnPCyHFvH2L1hn3A6lsyh1jZ/97XNc8Zef1dd7u5+vdTjObuJtaziD8EvgwVM/3UaC 8Uv4lKdWwtg2u0VEuiLciy8U42S+0cd1sVubQ2WV1HkwDY++GZadG0D1x11DLNroKWdYCa/xGO+ oggzBJlyrOsyIFMzKHoK3a5lCxa1XVC/Mku4XIzztCNFh3lLqz+AjxrkXLfdkAYGeKOc8BpWXPd yIbuT2DgJRiLs3KlOSB4RjnWpVvjSkckmY/vIE7zOyMKN4PoOdMOR4Q== X-Received: by 2002:a05:7301:6093:b0:2c0:c55c:156f with SMTP id 5a478bee46e88-2cbfbc82969mr870935eec.4.1775245282274; Fri, 03 Apr 2026 12:41:22 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id 5a478bee46e88-2cb61750eb8sm339741eec.29.2026.04.03.12.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 12:41:22 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 7623D34014E; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 6CCCEE41AC2; Fri, 3 Apr 2026 13:41:21 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH 6/6] target: use bio_integrity_intervals() helper Date: Fri, 3 Apr 2026 13:41:09 -0600 Message-ID: <20260403194109.2255933-7-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260403194109.2255933-1-csander@purestorage.com> References: <20260403194109.2255933-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use bio_integrity_intervals() to convert bio->bi_iter.bi_sector to integrity intervals to reduce code duplication. Make the same change in the nvmet code that appears to have been copied from the target code. Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta --- drivers/nvme/target/io-cmd-bdev.c | 3 +-- drivers/target/target_core_iblock.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd= -bdev.c index f2d9e8901df4..dcf273360015 100644 --- a/drivers/nvme/target/io-cmd-bdev.c +++ b/drivers/nvme/target/io-cmd-bdev.c @@ -218,12 +218,11 @@ static int nvmet_bdev_alloc_bip(struct nvmet_req *req= , struct bio *bio, pr_err("Unable to allocate bio_integrity_payload\n"); return PTR_ERR(bip); } =20 /* virtual start sector must be in integrity interval units */ - bip_set_seed(bip, bio->bi_iter.bi_sector >> - (bi->interval_exp - SECTOR_SHIFT)); + bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector)); =20 resid =3D bio_integrity_bytes(bi, bio_sectors(bio)); while (resid > 0 && sg_miter_next(miter)) { len =3D min_t(size_t, miter->length, resid); rc =3D bio_integrity_add_page(bio, miter->page, len, diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_co= re_iblock.c index 1087d1d17c36..434ef2b0b120 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -706,12 +706,11 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, pr_err("Unable to allocate bio_integrity_payload\n"); return PTR_ERR(bip); } =20 /* virtual start sector must be in integrity interval units */ - bip_set_seed(bip, bio->bi_iter.bi_sector >> - (bi->interval_exp - SECTOR_SHIFT)); + bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector)); =20 pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size, (unsigned long long)bip->bip_iter.bi_sector); =20 resid =3D bio_integrity_bytes(bi, bio_sectors(bio)); --=20 2.45.2