From nobody Tue Jun 16 03:46:21 2026 Received: from mail-pj1-f98.google.com (mail-pj1-f98.google.com [209.85.216.98]) (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 7BFCF18DB1A for ; Thu, 16 Apr 2026 00:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.98 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298970; cv=none; b=euDtBPwQuagiLdRe4XMUq2ExyjRrivyVYP5V/zlJp9yYSy8ebXSJRQp+H0yJ6NYCF4XOCyjLuvReNqf8SKyjMnVDt/CP+2nwliIBYeegSVyh1luOwJmAnLfCk/W09246naT1J4YsjZzmdKMEKmp2TOG0/mCWuS5H3R/B3Qxvxyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298970; c=relaxed/simple; bh=O636dE9N69mBMEYSKXLOipICMqqDxgahqZWWn++RCU8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FhtLiHgfxvR14KWnaXbNEyg3G8GY6JnXsmNXNIYHSaiIljLoc38rh5Zg+K5kuQfRHRSGJelka/1WhJjG0UAfwlZ9zd+/6twb8J3fpHqI07ApNbM0JmfHAkrBJL6uJ5MZZxIgpBAZ+CzTvAIIaC1E5k0c4cx0yz8C5L/MyBcOc0o= 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=JRtyR4Bj; arc=none smtp.client-ip=209.85.216.98 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="JRtyR4Bj" Received: by mail-pj1-f98.google.com with SMTP id 98e67ed59e1d1-3538952a464so960827a91.2 for ; Wed, 15 Apr 2026 17:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776298967; x=1776903767; 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=UbLFjrQgSq+vo/irY8puWuag67WZ2r6Vk4eT1HQFu+k=; b=JRtyR4BjFln/4yy/caVkMKlZ0LRW4mraIQPe8LqPfvGDvryRe0Ii7QS1DVEUyU8suV 7PRyTpOk116LtbOkM+dYF+6nYa5wUoZVwI5SOpqBRB+iW2+VhD2l8A7QfOmV89ngCB6K lyWpbGevt+ic15OAp2sBW/q4h2dOwszgawgOYhhBN4b2kNgzWeSmWX9LsYJyJFESA6He QywuI6FX+2VhfpkJhedxi5I5JfzBokz25f/5fFrR9DyPbC+rrdQIgYtXP31jx40CNACD lb/ckAnDkdagTfQBdJCNKt/xhIJp5FzXKO/hDePlfsqEOdw5lq+avE3LVOqreCkM5Lgy QE/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776298967; x=1776903767; 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=UbLFjrQgSq+vo/irY8puWuag67WZ2r6Vk4eT1HQFu+k=; b=CbVrNwOH1GJpBy6rIwaSS0gc9jLz8xjsUBlkIBTkYa4VEie8fbxDmSIRGpncGMK3gB LyZtd6lWzz4zOKZR8LGgKBI9In6HdzpEdlMjN7XSjz3dp/IyHO7NRXtOp9bRei5aQpEh 1x8a8AguAT3utI30RaiacxbhHCc3cX4I81g2FiHyYwXF7Id1WjfdFrH+9akzQvKO9wk5 Zb4ysHxl4Pki22T0GrzzU25bWZj5mBG+XPUF8aFdhXiCD+c1Fquw3Xl8gXn6sDGTMFeu rJYrfse5zUPJcArrwUBxy8mA6VBxFUTuy6+udZCiwXc76CoxvnnRfBWQ8r4xIaHJbJ/Z KPbQ== X-Forwarded-Encrypted: i=1; AFNElJ/0iVNfGAfc3NGztFCVK3aaCLgKHiKaSfAiXp619HLboglWlynTvuUesEd7fIWgJ0D3rNrM2dPVp+bgf44=@vger.kernel.org X-Gm-Message-State: AOJu0YxBkvbJCMTlcRpQDfmgOrKRXO8obQjtANp60W0c1B7xQZ0lC7lG n9o+JPm/fL1OFAUguPoC1NQHxfePCUz8Wo+o/s/WlzYiUz7JY60Jot6UzZZvTF6OGoUWHd3vJaX R7yBhqfHgErjssRYqEyWiYayc41UO1hhX4oZlyZFlodj527ZggWVh X-Gm-Gg: AeBDies0s8qijnLn8LeN5SI7X59l81Fw0uRQilTC7Dlue8okegRXqIsuelJgoN5VNRj omBWgDD7AmLJI5I9PKnghZo88nv8xI6BmvvHlYUw7pRIBNakXCim82oV8xg6vuBYeVnorW4lm+f jaXrvvp4d0fgtW/sVghT6PxT7nhzYqsfIIEytl5SvLUfRJK5xSG4tpZmtsZfIdbZuXjm+r2qbG4 Buvx3xHmC47Pv5NRZmWLid3bTzpAMgQJosguQxYuCETUgWqtsd2W2uOhK4k1Zjop+dU8qT0S/4d KUh0CXaNRw99AxNpPw/qSTh6EcGO5hFfz5evdMfWjH5+GFer4FVmz0NRjTBQNJocvc3lZbPwkzq +Jqi74+MQK/1AtFV1U97c+XfyLZA1GapMxEpTursUovIXf5ED5g== X-Received: by 2002:a17:90b:1850:b0:35e:596b:8a3 with SMTP id 98e67ed59e1d1-361333cbb8amr152191a91.8.1776298966715; Wed, 15 Apr 2026 17:22:46 -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 98e67ed59e1d1-36132c7b9a8sm25551a91.1.2026.04.15.17.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 17:22:46 -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 095613422C2; Wed, 15 Apr 2026 18:22:46 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id F2DEDE41B93; Wed, 15 Apr 2026 18:22:45 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: Anuj Gupta , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v2 1/6] block: use integrity interval instead of sector as seed Date: Wed, 15 Apr 2026 18:22:09 -0600 Message-ID: <20260416002214.2048150-2-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260416002214.2048150-1-csander@purestorage.com> References: <20260416002214.2048150-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. 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") Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- block/bio-integrity.c | 3 ++- block/t10-pi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index e79eaf047794..3ad6a6799f17 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -103,12 +103,13 @@ void bio_integrity_free_buf(struct bio_integrity_payl= oad *bip) =20 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); + u64 seed =3D bio->bi_iter.bi_sector >> (bi->interval_exp - SECTOR_SHIFT); =20 - bip_set_seed(bip, bio->bi_iter.bi_sector); + bip_set_seed(bip, seed); =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..e58d5eb6cefb 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -308,18 +308,19 @@ static blk_status_t blk_integrity_iterate(struct bio = *bio, struct bvec_iter *data_iter, bool verify) { struct blk_integrity *bi =3D blk_get_integrity(bio->bi_bdev->bd_disk); struct bio_integrity_payload *bip =3D bio_integrity(bio); + u64 seed =3D data_iter->bi_sector >> (bi->interval_exp - SECTOR_SHIFT); struct blk_integrity_iter iter =3D { .bio =3D 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 seed, .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 Tue Jun 16 03:46:21 2026 Received: from mail-oo1-f100.google.com (mail-oo1-f100.google.com [209.85.161.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 AB35F1A680A for ; Thu, 16 Apr 2026 00:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; cv=none; b=JfeK4nqLJSl6YrhGGXWIaf54NaqYsOXgqzKy5GyqAFKaNhiQp1WMDXQel3rulhi/XQOK9a0jGavvtogCBSRGt2tJKv7rgdMqh1WC5od/AsJWQe9yN+WUSG4DYbLPeAdvjRYI7V44r7cdZcP+oW5RveIBvaEWhRKT4FodxlHqHZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; c=relaxed/simple; bh=OxwYPUsXcJJxrZKG40PE0m1JReSMAndHxHt1ouUG2w0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qI/8+C5NVNzYIZZBPSol1Cg3ftgcZdmoX/8CAxOi6ZNRcLE2I9YKL+eJFk41QLv+OiPbS8W/mQFPNQ0ALRiAMamaat0HJ/oEdZThsn270Z7irHO/D9JUoPGCg3HDFxn32vvybqtWWt47KHxmTYEEy7ld1lGgow/lHd2gIYF0zFU= 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=WekJt2Zq; arc=none smtp.client-ip=209.85.161.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="WekJt2Zq" Received: by mail-oo1-f100.google.com with SMTP id 006d021491bc7-6828cffbcd4so188088eaf.0 for ; Wed, 15 Apr 2026 17:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776298967; x=1776903767; 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=KbrCUVte0mVKnP3wd9JwZ7YRnd40ug3Wdm2BJ0sYmnk=; b=WekJt2ZqrzMGGrjKyV48raQKDxHgeLv7u9UT7Uf82xNwpHea9ZuG9/f+qDxEQVQYYo dpT60UreSc4dI1o2ad5ZZBs5LvKpfNqF+Jf0aaaCSC+9WhAWWhNyAsH4QFrk7rBqIJHx TQvDgJzJ2/WrTFvV1Ec49WuEsJiXNPTkEhiNqSuERMU2wQnnaVsTDH2UqgLuBKZqIeI6 ClHsL78aEWlMFk1zy9mfrD/Fu9safWTZmXiqd5wLSCqvIJ2C3zIrIZlcld0AGoltYu65 pe3ggIkkeyUaKlD3VPFrEKfh9GlN6X2w7LWT5CZaV6BI4bp/YV7KWdHMdqvaPns1+Xb8 J28Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776298967; x=1776903767; 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=KbrCUVte0mVKnP3wd9JwZ7YRnd40ug3Wdm2BJ0sYmnk=; b=rKhgQF1glcBoIccGFhkQtIZAThwQW2ToOnrZvFBVQ18eB7gMUct/gsNprC94N64lGM 9F6lpPoI/xmQjS9jDtZsKQphig01P7gnfT6zJxw1N6H0HGQsWec8t9wWZKXkcew+TrrW E5Zdg3ikkdcNVndY2fS18zgzzXXR1yBmCSTSqquqweuyq+1j2YfIZbKeqlYx9SMJhmh8 NssYR+pYqrzrd90IG2i7o/wJuRD90nbe2OzJod8pSDb/kWYMCgikV1NRCe2VPOqpyyzj SvCB4hL1UVLhNxGnrTF5o3e3jecIKKUNsua+lIN7Ob0ljCl3NQuaYx3jYPFCVhJH2PUx hbWA== X-Forwarded-Encrypted: i=1; AFNElJ+CAYAn5onjZwbKA21jM5kNhVbWVDpRTViFYH2mMnxfRYAQdFLii2uox0zw60SzpstFf1U4t0MOREn29cE=@vger.kernel.org X-Gm-Message-State: AOJu0YxzPeRyxnI6jUDD9vXlNU9nCh+v222zqe+4+GOywIgGpn+FmXWW GXXWMIrEdbj2xij9dZUT9GEhXaPSdGXB/9S8jc/zuQ7tedbq+QhHX441uP5xviEDeStgwPCwJzb yAjnNWsVnKFJty76DynnzFhZivvdDt6mELXCdFcpUNj0srQbKYWKF X-Gm-Gg: AeBDieu7tH011pYUTbo0UdsrRPJHpAGEtsdRROK4HW0HihfX2IFLB/qXn9xrshxX+ad buD7NtnGW1VRSux0qP++QBiys4ToKsZQcThIuuWnZVgDAaUjhpF3yuInFN/OfBYcIpG3P+tiSxI aZLOhJ2IKa+i2esuj+z4urkxBJKEj/qn+6ZkdNam5fwZaFPjBPspcgh/Fu2vYTdaz0jfcJOEVnq 2IkOxlbYEa/MY3/0ZM8N6DCoIhMonPCpUCMga+FKt7W5GUztnoMEYqeLWt3u5xjF/pSJw5xvbcG +Mr6JFPG1f8bQn3q1JvzgEYtNI/W4tCJGUllhQAmA0yEU+EwVuZKs9LxAfAleiMi30H88WOk+kX yI1B+jysQDZn+ivkDvFmx+T2fl60U61YJ+D2v1ww5CVLEG/21TA== X-Received: by 2002:a05:6820:488c:b0:67c:3021:908a with SMTP id 006d021491bc7-69456aa5cd1mr88811eaf.3.1776298967567; Wed, 15 Apr 2026 17:22:47 -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 006d021491bc7-6932a7959ddsm231360eaf.4.2026.04.15.17.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 17:22:47 -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 6AAE23422C7; Wed, 15 Apr 2026 18:22:46 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 5FA79E41B93; Wed, 15 Apr 2026 18:22:46 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: Anuj Gupta , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v2 2/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Date: Wed, 15 Apr 2026 18:22:10 -0600 Message-ID: <20260416002214.2048150-3-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260416002214.2048150-1-csander@purestorage.com> References: <20260416002214.2048150-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. Fixes: 0bde8a12b554 ("block: add fs_bio_integrity helpers") Signed-off-by: Caleb Sander Mateos 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 Tue Jun 16 03:46:21 2026 Received: from mail-pj1-f99.google.com (mail-pj1-f99.google.com [209.85.216.99]) (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 114851A9F97 for ; Thu, 16 Apr 2026 00:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298970; cv=none; b=KEb5OBBU8pCI7IkorV4qVwAChl3777swmJhmT5iLU0pjiAETwqwg7X+8Zw/dR58rY9eO6ybDY0STAnnLv3fq6iGEosuSJC8pIyo9sZ2cKPsAHfNDXJObf0NStUyRirRDnExbrE1XLrHOBcLvklEUFrGxdN1TA2Oc1BzTn7UDFDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298970; c=relaxed/simple; bh=OqvmwxPUynjDh5Tn3iMgPFDXoA/L2INxvr56NUjgkIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OEER53VWPuPz8vX8nHmz4a9hnmYYbvO7ScuDDk3czxpseUtODnm1Yptx9UWWJhASl/M+UMXS7TGlhTGvtXfKZgImEC+8MN0E54s/sc9/dKtEfzyqs7uqVIXH6+kQyJ3Fq+g7eIhqy/cRQ5pD9QVDdwKgzgzdEsWyplYkKhlWwcY= 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=UNsHozT1; arc=none smtp.client-ip=209.85.216.99 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="UNsHozT1" Received: by mail-pj1-f99.google.com with SMTP id 98e67ed59e1d1-358dff8447cso1132529a91.0 for ; Wed, 15 Apr 2026 17:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776298968; x=1776903768; 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=eyCXVkuEBYx6RuPx/hECYTdCdsu/oyGta5lJzqSGfU8=; b=UNsHozT1KlO2DwnCIh6jPeQ+TDp/CiNCzfZl4OGWY1NAbw0Qqf1tC8hL/KuwIpud22 lhCBocSoB219FHkQMJKmua65/xMRnhuJch+ZH50amgT2p6FErj3sai1dKPujjfj7jcJo Y3wU6Mp19/assUTplr4q+6CSD+Abqodhu+Ytn1TKP1DcxI8JuQia+9IxfG35w4mY8hnZ rYgbV5MUZHpsDqRXNW8whyI7Yt7y1YwBpN0YiiM/ZhytMQ0JcgB/C9zBVS+AW+wo+SDO Og0rmfAgN+1+VWDUfD1eUs+H/5D5D5+8AeYFqfumi3cpgP3FvA0LFOoP8Vy5Gww2ruWj Th1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776298968; x=1776903768; 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=eyCXVkuEBYx6RuPx/hECYTdCdsu/oyGta5lJzqSGfU8=; b=c4jXufKgeMCF0YeoKujRzXeCosMYtDPsjcjIZmd68EjbjosvNKrWEekywHb5O29Kgp 6gLNMPX9PUaxRS3fbgLEh7+Hchoki5y8Wz706F45Ih6tHs7TU2Xd+eFoR2xuUynifDZF 7RPuT2Gat7ahsY9gtwF1Em6eR/b4h8Qfh7dKECJ65q9SaWEjnj5Kccm5J+lBkGZ99AlR 68z0RC6X0Psn4wEfgeS2Xu4D1/QZ7V5qmTU71CRL1rdP/oTqRLIIgWmsAT6k+B4uiQgQ GUVVKiLHPKu1TTN2q56BS6nHHujKPoXh9uyNUo1EEGNJD7/ADQHXmXCOBdaSI4YmXEAB 4eBw== X-Forwarded-Encrypted: i=1; AFNElJ9rznqrS/t/dxDKnNvnmmIdokJCFHm3Q7NtZ/422wv/dl1YoLTPD9haIfGPbGQH37TDWM+8nSx/EjjVvyE=@vger.kernel.org X-Gm-Message-State: AOJu0YzYsD1usXjV1JAo2VWWt9ekfZtm0vfvxjEEEeEtZBH9g6fhUIu7 7yNxEctBEYe7OC2q3NLKFJ7dF8Sg7HHW1tB7BXOeUQTet2aLXH/GXcXycGPk2QCe52sV4raR+wN tre5m5AsencfhBh486sm7YbHDhSmrIG1QkFka X-Gm-Gg: AeBDietPuclixlnFJjXCsiDgRNTUREXVrFWrERArI6shGoXOh9UCYMziJ9A0vpzlySg 8sByPd4OStKnNIY5Vo6dI8bE8BslrJDscpSE1s4ZXEqy3IkQ4e07JKYPbsuQ4NfsBSmcw8RnfTQ +yHgXdmxmvY3PVNL3RFsF3wx8SLOwJSK5nBtAtnvpIfzPSogfOOlsPue227+GlOJESsVqiFF1wS QRHJi3rKEIBYVO7bTkJztO9QQUlNP1JDbZn4TiX+C7pJtIaXvaGxIjNC1WVNiifAa2VVc6Wfy1R 4CXjYCf6PZ5ZaTgMnJSct5PItLUHKLIIkuG9oZ42xMbY+/Gutp6XPaoFv3KypY+nqXgWx8i3FCl rVNYi+Tz4avoZj4bBTEJJboebaCGHASO5b0h35lYciml3M86MZWIPDWCWfNh2eE4x X-Received: by 2002:a17:902:d58c:b0:2b0:7041:63fc with SMTP id d9443c01a7336-2b5eda8b366mr2383085ad.7.1776298968060; Wed, 15 Apr 2026 17:22:48 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-2b4781301b8sm2399375ad.18.2026.04.15.17.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 17:22:48 -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 AEDE23422C8; Wed, 15 Apr 2026 18:22:46 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id A3C50E41B93; Wed, 15 Apr 2026 18:22:46 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: Anuj Gupta , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v2 3/6] blk-integrity: take u64 in bio_integrity_intervals() Date: Wed, 15 Apr 2026 18:22:11 -0600 Message-ID: <20260416002214.2048150-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260416002214.2048150-1-csander@purestorage.com> References: <20260416002214.2048150-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 to an absolute integrity interval, use u64 for its argument and return types. Also use SECTOR_SHIFT instead of the magic constant 9. Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- include/linux/blk-integrity.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index b1b530613c34..825d777c078b 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -64,23 +64,23 @@ 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(const struct blk_integrity *bi, + u64 sectors) { - return sectors >> (bi->interval_exp - 9); + return sectors >> (bi->interval_exp - SECTOR_SHIFT); } =20 static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, unsigned int sectors) { @@ -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(const struct blk_integrity *bi, + u64 sectors) { return 0; } =20 static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, --=20 2.45.2 From nobody Tue Jun 16 03:46:21 2026 Received: from mail-qk1-f226.google.com (mail-qk1-f226.google.com [209.85.222.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 8EAB81B87C0 for ; Thu, 16 Apr 2026 00:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; cv=none; b=TOdNb2pdRCXygbTwki+ZCnEX6inuQtrNWBR1SUzsvM7cwSZ0xKsqsN4P4ONVZtsqdM2eG2Dhy/Qx2yPot5QGRuG+BRdgZOJ1wie+iU8yKJjp2WNscWF7uL2fHNMVN5/nZIAt30QG/XIGFpxWKrqWdtP79gS9yhecgSBzDdbOWeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; c=relaxed/simple; bh=FVwKbgioBZ+VO2vvdiCyvzfplqZuonuE42jMiRh7ulc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XQpdTieFxMwi+tniDN7RRE6WWibBMEVWtch1VMvSYF/g2ZNIfvBfpocwj3hdz2RDkIBLkBTYTM+uuszzCpS88KGOQlMFm11d31LxTh9tuE3epvrgi19KnL3+1pkN+8jyVxyOJDXqTWXdxuhbl5J21ZTRYNICUknuvj1ndpA1+34= 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=A/n/Ah/B; arc=none smtp.client-ip=209.85.222.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="A/n/Ah/B" Received: by mail-qk1-f226.google.com with SMTP id af79cd13be357-8dd7a652f80so96208485a.1 for ; Wed, 15 Apr 2026 17:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776298968; x=1776903768; 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=qTb4WYVL+QtfOgfKxr2rwJdF5OfB66I75dlU3VTdI6c=; b=A/n/Ah/BZ7Zj8v9yQwgw9Cu4aQ6WfKwC+hRGVwA4AHyKZa2Nbs9i+ELQuUPwQlnuTZ eyCuB3IlKTQXCmeRPe/c6C3rqeKkEHAmm1QLyjMu8s26OXW6ASdD+bj6Z/uansAf6sKX wOGV+Xh+ZJzHBxISK95ydcIkN+kof+IybXgBtRAXXUlZIh7+mRLpzQvAGewvkQkOFqQu tciz32ruqZAecMZi6npaY2c1Rh3DgOsk2cJ2sZow/FfkRJwRhcHnRgrBo4FYqekGg/ef WtHzecD5pENS5wkST1IwrjYpg/dUTsClHvSGFq+4nFPFEgbu3DFxqhw0wdzrJp+6k9zR Ac7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776298968; x=1776903768; 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=qTb4WYVL+QtfOgfKxr2rwJdF5OfB66I75dlU3VTdI6c=; b=BYiN31gzr0pRZ0AFd1mJzQnqJENym2Cjzcv84IzhkXD8RtPw2E7Aq229ZjCwn2DWNn XtEgJoFm/uq9CmP6E3If+fy5z4vfDbnyAIjhllJleSA80s0FWUrhgcAIp6T1YiZiQ0V7 ECqshykK4jtDcDB/n5y60t0q0ajyHEbBjT3uCe3AXb+7JiCszlgU73BCU8ojkWhUxCue 48HH343ab5VyE/uMd0a29zvmobduUW6wNLjzbhL2YO1WZ6eudKlYsK+xyKE1ktyl+N3a t7t7/SZ3A7sY0gktAUcN7klqmpc80WtLOSdgaTKd6Cb1mX35ZKwreQxqCxiE6aRFQzIf UrzQ== X-Forwarded-Encrypted: i=1; AFNElJ8KBFa8PT8HKR3J/JqMg8AtwPqCLRm2GVwk2xAFA93k6jt5UK8KscZwj6yeRU4I9Fn34+3E8rIKQb09+Qc=@vger.kernel.org X-Gm-Message-State: AOJu0YxmpWbwy8iWwEabjPhLJckA5oiGJ25TexxT1qloQ0m4x3y2a4m0 uQwptg0GFpiPYqh0POcg1k1hpt4cZnMnA0PRDXbupHYF0r2KIkSEj/3a+SoSO8/JR3DHa6g0MVj mCPnkn18FG8qg1gO+WX+6xt4rJA0O7CnlOlqj X-Gm-Gg: AeBDiesw4Q3LnMtq6D8+gQxibTtI07g7+190OIlCABw1l6hyPzuJXrtzy0UnvgEfj35 +85jyHpJJzkaa+tTtjwe43LbMjgc0ja+lHTwGXJT5Wkb9SQjAaUZ96ehqU7powZrmn3U6KfpOrN cLZWkxSL2NN4oBNgkj33Z5RI9DApOcIZAIrGfeX5HcJlCIESoqB/Dfj9xc1ss2Sc9IX1h6VtNVy lP9UHWOFMvA+KVzdWpc2k6uA3YebhGp+Di1x2cSVyXmO7KDHiewQ2H2U44slSnrOvYCSNsovPz8 sLAqkhxF3WIv2317xxnnFdhEms6/WjgyJjS879Bnwz/Tcv4E5XcSLwcUn/jOz+Cxasx72uy41LK ED8sq6NjAPuZL7B4AGDRsQ9YO387Zni3YhpmR1eoLWcVeEvNr2cvLyX6AgiHxm6Gl X-Received: by 2002:a05:620a:4614:b0:8d2:394a:d3f3 with SMTP id af79cd13be357-8e6321e7da5mr60618285a.2.1776298968296; Wed, 15 Apr 2026 17:22:48 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 6a1803df08f44-8ae6c93d2b9sm2589456d6.4.2026.04.15.17.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 17:22:48 -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 07F4F3422D5; Wed, 15 Apr 2026 18:22:47 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id F1B94E41B93; Wed, 15 Apr 2026 18:22:46 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: Anuj Gupta , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v2 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Date: Wed, 15 Apr 2026 18:22:12 -0600 Message-ID: <20260416002214.2048150-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260416002214.2048150-1-csander@purestorage.com> References: <20260416002214.2048150-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 Tue Jun 16 03:46:21 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 43C9E1ADC83 for ; Thu, 16 Apr 2026 00:22:49 +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=1776298972; cv=none; b=t5Lpm/bQagbtmljg67rLIPd7b7L+I6pSAD8TcKjmij3CQ0y1ztqaNn1PCSB7M6+YSqDYD/+mOyCQO0ayRXOMWiiXsLhyhRczkr9R0iMPSG5fKGsFHW80dzJQG6qYuVsKH5BH7ZLcEL1IPEavEjxYp7x+UXxcyeDnHkREfboLWFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; c=relaxed/simple; bh=D1sF5rCpyJ8v1Q/Gw4hLl9PjXnZwN2O7sQ73iHxyGO4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R4z9Cgc+20VzfE6QiAGPokW7/k2Prgwh06aIyIG98HkaH998q18n1MFdRFx2pH2U+xxzf70enY6Uf6P1Qub615XTzeygerAzFcUbvZ+GNLFfOp/t/2pbUkCSYwMinLOyEsYI4t07ilVsQRCLzlnYIlheKgG+8AvxKbQ5/Xk7mE0= 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=Z4gt3sjs; 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="Z4gt3sjs" Received: by mail-dy1-f228.google.com with SMTP id 5a478bee46e88-2d99367957eso65268eec.1 for ; Wed, 15 Apr 2026 17:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776298968; x=1776903768; 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=ePLDDsMaoT6WX22t4kx7uDAhAvj4BaoTe7M9oy5w3tM=; b=Z4gt3sjs7HJOg5E1Rhbzz43BV0kwY8dMsAmzdD/tuifVtfLydTShtX2/qQmkGD3T30 9Nnejmw1T9pK1E5ePw9Cj15I1zEzIiHzYpKTzMII6xi5ndDVrX/DruADAvAizl+iWQaQ ciaZEKelqJn9pWp3JyMSyDQvBAC18BdebOUSEB1ULtYpfJcXVxxvnxtEUWoLEjmYOpbR L0WDu0VGPzQp3zVukilu42+UvgbPmy2qu7pverMeEWb3Cz7zvxGrhuYoesL8TltK6EjF yWcHkQLPInhgMqX9I3o5OGltw2TWgrzLOv+7RUcZufkaVJxHoxpzg6FeQiJJnSBEJOfb DwmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776298968; x=1776903768; 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=ePLDDsMaoT6WX22t4kx7uDAhAvj4BaoTe7M9oy5w3tM=; b=o2L8nQQnxHn0ANvoQ9UZDtZLWD4HZPnNYEzC4WSlQPKwZic4QfhCmsVkYYd8bqxVNq 9eZOfAPIOzvdhUVJkSglcdaD0iBDo+h8rF+fIeFT+yERyJkVkcwDyE4xUy/l4a2kp+3n cWubws+Ss88UIswLs9UapqVxHC93n/mXvUfJGYhaLj1QUr9RQTNVVBuQQunESDk5qZc/ rYRJhcqrRYh5tabKJO+Rg4uMYthISKydeuKAjrRhxLN9ynDK4IS5RPAWF+GZZSjl6yEo iAmVFylI1fBvSM0vLiopugFNjpnVd2wcG/z/aN4lpYF5BfE5SNjuJxzcIEm1/5VCtRBE Tlig== X-Forwarded-Encrypted: i=1; AFNElJ9l9UyLqaxNiaUyUKlFX+Ygqyp7aDIWq3SGwHVhODK/iWKbrpWGjVu0wPH3Ro9FM++dpXl8zrZPb3jHu3I=@vger.kernel.org X-Gm-Message-State: AOJu0YyynAWpGk6C0aPenuzkoraMV540h69Izjs0zr6/2PgEpNQFYRKB Z7Hql1AHGWPhcDnjawxSPNrbkqhjQEZeMd1tz7psDLImWWucwI+mi2fD3Oca4PHDiXttTDF8s+q m4UEZLJsoXWlhQQmg4Mm+OkG2bZQRALZ4k2KF99f24qM6TxJuPo3j X-Gm-Gg: AeBDieuXef+QZ71i4VvKGVlmysn4TI2d0yGVUUdZNpoceqhy16MZu2XuZT1zTYBYQVy M5NczCjTxAumLjZp4/v48+frrko8wnvr3ObGc1jbcfM3C/QaJX2XLb/2tBwEslJN2ZpPjEkaEPH tQycX9aGawsnGO6EzKmp+D73Y3IRURZCLew6gB5bu1I98yJ+Vj3PWctEJlG8tEv+zu5C7r1Fkul aKwDlhxfrYsad+dOADZoDp01/X+5xIgPgvXOG0ebDflsot+Au733ArPrkEBOgCtl9BG+uVdNZKn nhePsJmqGFKhwbK+n+A9wd21JT6YdEADd3ex8OlhTHwZJdozob3TiFxz1fhVMf2PyOenylx3wq9 m9HUIQW6pkoAT8IUvLPF4dqKrUxK+kzER0iSAO3Am2N1USqPNHg== X-Received: by 2002:a05:7300:ac81:b0:2d5:9438:2a02 with SMTP id 5a478bee46e88-2e17d815b51mr60486eec.1.1776298968089; Wed, 15 Apr 2026 17:22:48 -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 5a478bee46e88-2de8ea899b9sm240344eec.18.2026.04.15.17.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 17:22:48 -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 49AC33405AE; Wed, 15 Apr 2026 18:22:47 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 3F4A0E41B93; Wed, 15 Apr 2026 18:22:47 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: Anuj Gupta , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v2 5/6] t10-pi: use bio_integrity_intervals() helper Date: Wed, 15 Apr 2026 18:22:13 -0600 Message-ID: <20260416002214.2048150-6-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260416002214.2048150-1-csander@purestorage.com> References: <20260416002214.2048150-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 e58d5eb6cefb..787950dec50a 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -541,11 +541,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 Tue Jun 16 03:46:21 2026 Received: from mail-oo1-f100.google.com (mail-oo1-f100.google.com [209.85.161.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 E1C301A9B58 for ; Thu, 16 Apr 2026 00:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; cv=none; b=PkBxUha+Ufj/nPJglfNbGhnWeKbTNxiesxUDGhPxCLgfda9QHXQJ4xEVOyjl5zqdJHFi1o1kg+kDcrsq32UYpTqCAMcY9TIESPOSfqNG2tbijuLIIDN9T/anGc/AjMk0K1vW5XY6KNO/fvzNw1+GAoUwnmRzClBDevwYIWgnt8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776298972; c=relaxed/simple; bh=6u2eQeY0Lhyo5ekAE6LH777nKiK783xX+W0PH9Nuc34=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HFFHvwp6lrLSgsnOFU/BDCBattbli3rH9ktfVWV/qQ5G9/MSx702zNxF4dgE+rpIAkNwklynutHZsWrTd8yf2EhNua3rzH2DQYeg1h4gwmMIYPZ5H+iNobW6+j0AeIIjow6T4jzisBPVfe1Eeh6iJvrg4w3cXnP72r1gYvoNzaA= 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=dkgDVyMy; arc=none smtp.client-ip=209.85.161.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="dkgDVyMy" Received: by mail-oo1-f100.google.com with SMTP id 006d021491bc7-6828cffbcd4so188093eaf.0 for ; Wed, 15 Apr 2026 17:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776298969; x=1776903769; 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=tzSVBmed9WYVjt5dbtSGKrtqNS44dOqqrQiFxuenj2U=; b=dkgDVyMy0QHqAbKAxk9WtDu6FS8z1cyPyIYocHtfgY15ho+jwpjfsDKvdvBQ96jFWm 01Zqp/LjkmxfhL/nHScpoiIX2iwaS2BZoNtTRchEHQU8eEf9yffDuIteryHFCZKYqYzS z1LgIHhjTrpPQIJSlSmTzyAGnjfXwabUo9uYQwPKuCMoauFsk7f0DEkWqSLksrxGZ0ZZ 0SDlW7N8H6ifjBpaE2AAZ5JEH0/ZDUP15fv+MMT3RCY3+DtuslIsX7WiysKtsf/lcj9S NrjJVQ6IN5XIYryb0adVP2WLecKePL6Rid/8refVFi8nMQKo2rcozpx0AACsWs9F6h+b 1o6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776298969; x=1776903769; 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=tzSVBmed9WYVjt5dbtSGKrtqNS44dOqqrQiFxuenj2U=; b=qXnjS9hIofnpPl2KjYOwQeraghqxI1hFnxRwBmRqJyLDue3E9mgzXDzt89fr8uvhgf 2E4+Rzx5xPC2h65vz5lh57GsL+I3vg9zqbCehyaB+0XeypzHhSTQeW7VKGcDIOvleRLY VlBWy0ZGTZJ4iKGkcARBBxr8khwkRhjgfeUGxFT5iYuanz+rmtVeFSaMq+UQ6XcymX3l SEI78aHNhFhh2uCxoRo8XpXt4EEfA9lT/B46TBO2fVZ1ZNL7qpCkSvDqdILI1F37Vl4+ pNFS6rLoiea+CECXk6fcBwIuTjqjWNz9QRtdiYWxuB7DXdj79fI/jY8oHyUasWIOkr+y 1eAQ== X-Forwarded-Encrypted: i=1; AFNElJ8FyOMSF0vc8lj7yNCaop7qWysIO9AbbSUoU7CmcVb60RxWN2EsHnmEYa4PYXuoxQoxXHiCWwXx2Nlfy6A=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/QZH6IQ7OdBN6DBM8iPGEmpBElO7Dywdud2D2H23JqEqLQOUR MkXBYkZCqFYvmKoJmfcICy3vCWksNCG2X+4xhwsfzymG9qtJODkt7+myghnpGhFMWYjJeJQlujU 5WPsljUxlf84nR3p+lRctq4db6IY6UFFItPHjqoOIl7lC9HtYvgCy X-Gm-Gg: AeBDieuwKDzI90FKCTCq4CAOoTKKzvT8PvP6cwLsbBPexZKQOdl9cfXvhONzimxR1HC 76RwRL7rQoTZC2fUzDc9TDJIyN/qpAWxB0fTON8ZiTBJAMIENVwMLfmIRm8fq7EDoqD+HG7xnrC nJ/e6cBptOwSM+oTqnllBe9oQIcV0X1eIP4W7JW1eB75chgCz2zhquL+Ksk1lP99eJPqQg1akIT uYqe2tTjZFlaHGXhcZGcJ7sF9/1QA64V9k2rGFNS+vNWiZLtMLzDXTL4/Tcf6w2hweOADQXphd7 Ica+fQxc0LlsYIp+EdTVLG4YdRtJmtkrODL8jEIfkOk0Gx/6Rm29Q9i/pLApGY7tBlNfIgT/dCz f+Qp9AW/1vSsYAEZhcQs7OoTcSFkQfTL8bjTYr5U0ufLhvF8lpg== X-Received: by 2002:a05:6820:488c:b0:67c:3021:908a with SMTP id 006d021491bc7-69456aa5cd1mr88818eaf.3.1776298968643; Wed, 15 Apr 2026 17:22:48 -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 006d021491bc7-6932ac7f504sm219057eaf.9.2026.04.15.17.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 17:22:48 -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 8BA1E3422C2; Wed, 15 Apr 2026 18:22:47 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 80EF3E41B93; Wed, 15 Apr 2026 18:22:47 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" Cc: Anuj Gupta , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos , Christoph Hellwig Subject: [PATCH v2 6/6] blk-integrity: avoid sector_t in bip_{get,set}_seed() Date: Wed, 15 Apr 2026 18:22:14 -0600 Message-ID: <20260416002214.2048150-7-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260416002214.2048150-1-csander@purestorage.com> References: <20260416002214.2048150-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_set_seed() and big_get_seed() take/return a sector_t value that's actually an integrity interval number. This is confusing, so pass struct blk_integrity and struct bio instead to bip_set_seed() and convert the bio's device address to integrity intervals. Open-code the access to bip->bip_iter.bi_sector in the one caller of bip_set_seed() that doesn't use the bio device address for the seed. Open-code bip_get_seed() in its one caller. Add a comment to struct bvec_iter's bi_sector field explaining its alternate use for bip_iter. Signed-off-by: Caleb Sander Mateos Suggested-by: Christoph Hellwig --- block/bio-integrity.c | 5 ++--- block/t10-pi.c | 2 +- drivers/nvme/target/io-cmd-bdev.c | 3 +-- drivers/target/target_core_iblock.c | 3 +-- include/linux/bio-integrity.h | 11 ----------- include/linux/blk-integrity.h | 14 ++++++++++++++ include/linux/bvec.h | 1 + 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3ad6a6799f17..e9ae5db99f64 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -103,13 +103,12 @@ void bio_integrity_free_buf(struct bio_integrity_payl= oad *bip) =20 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); - u64 seed =3D bio->bi_iter.bi_sector >> (bi->interval_exp - SECTOR_SHIFT); =20 - bip_set_seed(bip, seed); + bip_set_seed(bip, bi, bio); =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; @@ -472,11 +471,11 @@ int bio_integrity_map_iter(struct bio *bio, struct ui= o_meta *meta) =20 it.count =3D integrity_bytes; ret =3D bio_integrity_map_user(bio, &it); if (!ret) { bio_uio_meta_to_bip(bio, meta); - bip_set_seed(bio_integrity(bio), meta->seed); + bio_integrity(bio)->bip_iter.bi_sector =3D meta->seed; iov_iter_advance(&meta->iter, integrity_bytes); meta->seed +=3D bio_integrity_intervals(bi, bio_sectors(bio)); } return ret; } diff --git a/block/t10-pi.c b/block/t10-pi.c index 787950dec50a..71367fd082bd 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -510,11 +510,11 @@ static void blk_reftag_remap_prepare(struct blk_integ= rity *bi, static void __blk_reftag_remap(struct bio *bio, struct blk_integrity *bi, unsigned *intervals, u64 *ref, bool prep) { struct bio_integrity_payload *bip =3D bio_integrity(bio); struct bvec_iter iter =3D bip->bip_iter; - u64 virt =3D bip_get_seed(bip); + u64 virt =3D bip->bip_iter.bi_sector; union pi_tuple *ptuple; union pi_tuple tuple; =20 if (prep && bip->bip_flags & BIP_MAPPED_INTEGRITY) { *ref +=3D bio->bi_iter.bi_size >> bi->interval_exp; diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd= -bdev.c index f2d9e8901df4..2c4b312f2f55 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, bi, bio); =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..4e0fa91a08fd 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, bi, bio); =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)); diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index af5178434ec6..edcd0855abba 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -56,21 +56,10 @@ static inline bool bio_integrity_flagged(struct bio *bi= o, enum bip_flags flag) return bip->bip_flags & flag; =20 return false; } =20 -static inline sector_t bip_get_seed(struct bio_integrity_payload *bip) -{ - return bip->bip_iter.bi_sector; -} - -static inline void bip_set_seed(struct bio_integrity_payload *bip, - sector_t seed) -{ - bip->bip_iter.bi_sector =3D seed; -} - void bio_integrity_init(struct bio *bio, struct bio_integrity_payload *bip, struct bio_vec *bvecs, unsigned int nr_vecs); struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, gfp_t g= fp, unsigned int nr); int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned in= t len, diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index 825d777c078b..3a2e55e809c5 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -85,10 +85,24 @@ static inline unsigned int bio_integrity_bytes(struct b= lk_integrity *bi, unsigned int sectors) { return bio_integrity_intervals(bi, sectors) * bi->metadata_size; } =20 +/** + * bip_set_seed - Set bip reference tag seed from bio device address + * @bip: struct bio_integrity_payload whose ref tag seed to set + * @bi: struct blk_integrity profile for device + * @bio: struct bio whose device address to use for the ref tag seed + */ +static inline void bip_set_seed(struct bio_integrity_payload *bip, + const struct blk_integrity *bi, + const struct bio *bio) +{ + bip->bip_iter.bi_sector =3D + bio_integrity_intervals(bi, bio->bi_iter.bi_sector); +} + static inline bool blk_integrity_rq(const struct request *rq) { return rq->cmd_flags & REQ_INTEGRITY; } =20 diff --git a/include/linux/bvec.h b/include/linux/bvec.h index d36dd476feda..3dc88f5cd367 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -76,10 +76,11 @@ static inline void bvec_set_virt(struct bio_vec *bv, vo= id *vaddr, =20 struct bvec_iter { /* * Current device address in 512 byte sectors. Only updated by the bio * iter wrappers and not the bvec iterator helpers themselves. + * For bip_iter, this is overloaded to represent the integrity interval. */ sector_t bi_sector; =20 /* * Remaining size in bytes. --=20 2.45.2