From nobody Tue Jun 16 03:56:21 2026 Received: from mail-pf1-f227.google.com (mail-pf1-f227.google.com [209.85.210.227]) (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 C82A02D6E72 for ; Fri, 17 Apr 2026 01:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391071; cv=none; b=oIwtf68drDSjdwnb9/tMUr0SObztTYSFhvuxHGXeieIkC8tgjtsA8v0bzlGWe+TNXb0VCgAVVw0rR0nDEUzB1S9ETR0SACSUFJkW8WIqzCG+Wonwy45TLLffYfxD9zCyc8uTF71JbbY387Tu6x2il47qohn/z6rdXGElIDdDj9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391071; c=relaxed/simple; bh=ohy1wVq/S70Vz7N/CvoXP+q1xaLNMz098vhZKOg7jwI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OS+ovEaqXQQQlKxby8eC8x+N7KGh57pjqhtXF1mosP0XpVEghxdRf7eBoSI2DOg655wZWrXKEXgKWuzwKUllTd7wB1TktSJHeGVWmzN0yM9s7i4mvjAzhD4KxOa1Nucf+4lQO6K+WsDGJgIahBluuMu8TFSrbZNekRQDVhkSLPs= 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=JiCEr8me; arc=none smtp.client-ip=209.85.210.227 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="JiCEr8me" Received: by mail-pf1-f227.google.com with SMTP id d2e1a72fcca58-82f401f2e4dso22822b3a.1 for ; Thu, 16 Apr 2026 18:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776391060; x=1776995860; 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=i9pyvtNYah5iCr5GskErP9n/SMj5zNsqkI2O6P5JyAY=; b=JiCEr8meVletjSYNPVhWU0BNb5lHci4nAGEo1unYXQZakhLH8zwfuRyZy1DhKj1Xpg TD9ZoLvoSZ3sSgBWLTw3sDFJ2OCrudYfBwo7leWFDh4T6tTjDzE+GrWFCfVc5d6uEwVq 0F/VtbZF9PT/+KY+t84yCR8O+QdvR5umPX8GPMhOOMvYu6yYE+YL6cS9I1OutNfk53Qf e1qz8QmFuWjxwubDjbaZHstzUZo6vcwdG5fF/XYx+YsUiXBHwSQ9NYyN3r7D6sBvV9X+ 0O9smbqZx1mFRdQIYRMrq7eV/U7yketg9Mvlx8VQZrV+YVKZKTi0mcxt+Lqa8+xwN33V dpAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776391060; x=1776995860; 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=i9pyvtNYah5iCr5GskErP9n/SMj5zNsqkI2O6P5JyAY=; b=qfp9BH8cGFhQru+9Vta8jKE/73i1Rv4m+PRVLvg53IRVRfyFQrVxkupYZdbRR53l6y FB61tn1nLcPnDahJD9bSyMeub8v1u4sl+/wDsbqFE+OqKsf3cOA/c0nBdyb4p2Jn6dQT a8I2U0qb5ZbRVQFGapS8K+wfRwBQTOOgzEr0lUuOkPzCUS82poxbT21dTNj6LrSopsAA 5z7SHwZljRNXD+A59oMO5bq8CWquDYxDdodFd/ED71IaCQfXrOmewEBh5eEGKNnU2ToD dQkMsqhWFdgsnksUqAVhMwPLgqoJ/qWw3UZhCv1+IdveovJsRN7/SHota+oQxaY0sGRV undw== X-Forwarded-Encrypted: i=1; AFNElJ/UhTMZAK7WSJ62ieQ110kABrQrzjTre55xQPw6AzGYFhb7DQ6+6JTg2KsInOinhcw6w0prP5YT2UkjPGI=@vger.kernel.org X-Gm-Message-State: AOJu0YzwgdG7ysXEoVc/4I6UgXIF12e2Fs6k5RYmjAnT4N2HHli7YQk/ dItdTa8qlJpthnMi0kInv4iUagQcb7B9dhzr3fzRm9AWblN9zH6KtuRbrP9LeyMjko4/XVS0OEF 1NAXfyQ4OShAmy0nhhZmXnAgbAOklYaQ0OQbh6T/4+d16+nJhUC1Y X-Gm-Gg: AeBDievoT/PmLThRJCblM0+uTDxAMrIBTpRNGs3qwORcfcjOepFces9yHNpDFzc1hTL huZgHdMluFsbv1vVRbCwAErNCDVGhs8dcKIHv2Ca/SMg+AaXnD4XpB/RxxpZXfV+en+v7Wn5LAN Ih4hz6kMPn4YZvJMySrdxqy8BAFvSQlmR+NOce7whn2mVkgzPD+Kf1yJMM8g1AEdowHbw58CZ1D ZXq23di5z2C938+Tg84a1znEgJIxYyTR4/H0ohVrAsvNxFP0Q1it9rP3qxPi+SoZdwxLzbWH4uI E2B+T61hyKhhklksGWD9CDqkbax+p942fLuULPua58CV0iUsNdrnr0c32SLoJxbEHg1Jvc+86nc gUXWnus67NMqveeB1iBw8c0W3BHNJKiWwKvH1aLYUBCpt2SHbMw== X-Received: by 2002:a17:903:3b88:b0:2b2:ac6f:104b with SMTP id d9443c01a7336-2b5f9e79f5bmr4284705ad.1.1776391060519; Thu, 16 Apr 2026 18:57:40 -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-2b5faaf81b5sm203705ad.40.2026.04.16.18.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 18:57:40 -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 D6079340796; Thu, 16 Apr 2026 19:57:39 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id D2633E406BE; Thu, 16 Apr 2026 19:57:39 -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 v3 1/6] block: use integrity interval instead of sector as seed Date: Thu, 16 Apr 2026 19:57:27 -0600 Message-ID: <20260417015732.2692434-2-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260417015732.2692434-1-csander@purestorage.com> References: <20260417015732.2692434-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:56: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 E90A32BFC7B for ; Fri, 17 Apr 2026 01:57:41 +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=1776391067; cv=none; b=fOvJyTWuFl9oyBF5ACejZ+r/4usPapelunXzKGcAfyoQNf5FzjMMWtM///+LYN3ash/wrBAyclR7wmyFb/X9dyfRBH4jFsDxHNJJGnGi6Rk6CaCz7D0UgjzwHLIXSiFLF/kTzRs57F2enNmTSw5qfBC89Vk67GqfF+ri6qEbgyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391067; c=relaxed/simple; bh=fQjdv8zJMdZXPE3+o9HQjjjAYJQi9CMWVL/qH8XIuzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YUjsxGB1rr/kMvIkrUxac4YClvwM5JZMtAHjvxc0fv8JbGm7OAYeBr1YyBoIZkV5heYaLhFzVGZYOc/QVFoAe/af1GIP+gLA94sTqRPvoPSZZSelCZmd93IHI6GUC3sag8E7jwrH5LH6/yDx/hVoL/cJGJpOBcUZcXQJhlqMRGw= 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=ZJZi3M08; 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="ZJZi3M08" Received: by mail-pj1-f99.google.com with SMTP id 98e67ed59e1d1-3597822d6d8so20380a91.3 for ; Thu, 16 Apr 2026 18:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776391061; x=1776995861; 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=Zj1lF3dU8n4YC5fdjZZVtRHMdHV4skYCpsqVKv3fQsI=; b=ZJZi3M08LetAVLNfc6qawM3q4dOy/laMdDch3I4DjL5dIjHTKFRadeu7F6qyJFYWbd aneZewcM1s+pCeJHWwskiTfXVwWsO5pfna9DU26vlIvVkmEXH/2UcuaBHwzrNphm6AsE Q1g/XjnXbnOKPAEQbCrEBP39MkaXprf+T7g87ie5VCutlfYLINmCfnBCgx9me79ZRMIa OlRHn46Q4+Jz9n8wBkCSdZlVv8GuZNRIDSb4NAgAU1eimCaJzkUkeTp2Ounkqjh4olxa Mot5BQ8BpM1H6FB1VW7pocA/Cnm4Z8GSq2n/mhKPlNobPgO7LwmDmLmDJNluJrLYDAMr B59A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776391061; x=1776995861; 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=Zj1lF3dU8n4YC5fdjZZVtRHMdHV4skYCpsqVKv3fQsI=; b=DTG7541Cf+93ijjAYXg4V7qfcawy3jk5g311VhxakCUWWRE0upADdWYwcyxi1hpv0M CgPuTm8GtWGugsvGECCCGIjiOzcbKxOus0Gxl5sg+owlmjUEurlOoheIHT/zfpzZfFVu KcfXt5k/7lT7EV0J7JQ0cQ3QTnwyMFhxGFKLMGRj5kW4obSrqj+VQU0SwfHGfHFWLefd QHm1TwoG3yfKtTHt3TSE0MVwmoD9klirDJjKpY3httbpVzrUz0pKgWnW0m+0b1VPDhs8 JjF1oSjOFjvLR+kR2S1N+FG5AaQkumgwn/n2eeHrSCQKJpuqTDkPTcG+ppSSo1JrgWEq 31OA== X-Forwarded-Encrypted: i=1; AFNElJ+uUPkFdTjrUGrsdSKNUOr1JV/Mx3iIfkp9cIrHEeKMoMWc/NHfpa5HO+IBdeAWT7f5abPB/lsU/lrev60=@vger.kernel.org X-Gm-Message-State: AOJu0YyRRMQwgdC6B0SXvGn/7yGCNsxUjCIOx8gu9xRJrDbW+lsgcpqG b+9OUKRp6UFyqgMsli3fHEcojjQD2S1m0Nnr3SMOAto6/vHa1Ja53jZGD8bcWjmnknG7eMMiojH aXYYV5xLwn62xGcFnmDHSsRiXbX0JAGWqPpCwJEq8J8Y8aycsNCG/ X-Gm-Gg: AeBDies7025vrHa4eIpklESxoc/l62+9iXo3sC+D6KS3aNWTnGI7xGx35+3GIqGfNBv ohG8gKj09joKvmUB+QyrKGBB/TPNhbV84kRT5UDAToGL1gzKqFT33ffJqIUmkShbnrtW/+Chbeh 26C9DeeIJ1rvFLNgw8tCNL5CL9Ze/UzLs7MuAqoZSW52BpmFNGBVj5TAvQV3byjCdO0l2wrIFem 62E5DFppS2nlfWAvka4OaZibmHq6Dg8SVAJAMXmj8MZOeWPT3zieWbNcAunJsB7IrlZmFGq9wFF dWVc0eOTqvQc9MGiPX17pWstFigNZiGjp2vu/M2uxi0QTyaqhyzNmk6ukDKC7H+KbO7kDcOGEMy N7iByEbaJtwAjGdJftnNXA0D7Tu7Y071xXz3MILYXgrwI7wnmEQ== X-Received: by 2002:a17:903:3dd2:b0:2b2:57a0:9c08 with SMTP id d9443c01a7336-2b5f9f7bc49mr2795455ad.4.1776391060723; Thu, 16 Apr 2026 18:57:40 -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-2b5faae2378sm215195ad.25.2026.04.16.18.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 18:57:40 -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 0333F340B52; Thu, 16 Apr 2026 19:57:40 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id F3652E406BE; Thu, 16 Apr 2026 19:57:39 -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 v3 2/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Date: Thu, 16 Apr 2026 19:57:28 -0600 Message-ID: <20260417015732.2692434-3-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260417015732.2692434-1-csander@purestorage.com> References: <20260417015732.2692434-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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/bio-integrity-fs.c b/block/bio-integrity-fs.c index acb1e5f270d2..0daa42d9ead7 100644 --- a/block/bio-integrity-fs.c +++ b/block/bio-integrity-fs.c @@ -53,21 +53,25 @@ 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:56:21 2026 Received: from mail-yw1-f226.google.com (mail-yw1-f226.google.com [209.85.128.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 53594283C9D for ; Fri, 17 Apr 2026 01:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391069; cv=none; b=fxsVHOp4dkb2W4xaf8jDkWb/EdnsJ1wGmUYr42fZXAB5Y7oogKQIfMtR4oCse35GtkwCOdE+lgii7rH/SQCQhgr1Uoe+fa4AAzdLwknd5tJHYp0UGsaVBQ4l7bp8sicUOZtu5gl3jSu+H7iCBsCDc9qHolsx+ZYZiLin86qG+XY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391069; c=relaxed/simple; bh=4rwKcoxtwwyEUMs+lZSg7yRkJNPnm1I0J0geFKeIcpo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bBKfR/EQxL2zwkxvbivCWKNr6Mq+rscy90x2/Eoq9MSXirzcWahrMqJotFPe1B8nNXoOb6CXkvfsj3UTyXf0K4psi9TmcPpkchcscTpTapkFwcp6lWD8z8ATGE5+peWVqOvhE+F/O1ybVF7kNp73rC2oTyUelSMH52XBci+tOsg= 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=dxq58Rwp; arc=none smtp.client-ip=209.85.128.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="dxq58Rwp" Received: by mail-yw1-f226.google.com with SMTP id 00721157ae682-79853007604so35367b3.0 for ; Thu, 16 Apr 2026 18:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776391061; x=1776995861; 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=nVdvVaugSDz6j9AO/nmgKpHbKb4qPtoLkQfjj793Zaw=; b=dxq58RwpRQQBlt04OmbEH1R33EnT3d1TCgA1dmt+LGq32r0ELoA/TIOYRSQEvWuZlZ /clMEcjdCCnXogPb0rQlAKPufdE44kTA6l2oWn6MZfQJ57H5wwKqMjKGq1LxIPZoeEnh H8HoCZM34DNvvaepcGHdySfabteMnvohic2kflq4SLCtYo75/c01bbGnvAtVQv0YAVrr 0X+6n+OHnHkCH8puWj/ilZejiiHAfXg8pFaFqQG3UWqK71rSAMtQ+7ylPV8JjtkEjpYO BLV1zktVZeMe+LRHU1QCcyfdw6t8ECeV0ErgrYYGk2JDs4Lqt9xzQwFHkdg3vGWHnA9K 8B/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776391061; x=1776995861; 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=nVdvVaugSDz6j9AO/nmgKpHbKb4qPtoLkQfjj793Zaw=; b=q+us4D3Wjja3w4zMgMqhV3R8XK5r7XPzO4paau6zLT2N/uwoMBltus5sWCmY7b0M+f qZ27cwi5G+td7GhGXxIMIxSZUfZDWdfUB9z5ujwOqxkjsS5kMDj32Eh6nNZ2+otFKYlP 26IrBIv9OQvNBRYQOfCKJa27wAtJBgOTqoZ+d45t8SvpkJEeusyGKgJZ3eD9NRFgfeHk EhSKnjNEhLsTx8dSah+fqeUs8eXf6WYKFDjQ6ld5UkklnbjQB4e717N4I9Hao3Lc/Z6Y kF+YAsTMTgrYx0mwJVzrQ5bw3XGUwe2YNdYGdUrtTR+rWrauEXBiZUDufivxg/XFxgbQ hiNw== X-Forwarded-Encrypted: i=1; AFNElJ/KwcRjdr7bkGidlCHj9UYHCra+YMYfk01IOGLsDWE2GtTZfue0gb4qoS1SpjaMp4wFpIZYbsK3Ows4Q70=@vger.kernel.org X-Gm-Message-State: AOJu0YztSfAd3pIdcC5QCkuo+rXXI7MGtqWthtTqCsxQclBV9APEonbe D5/u19Q5m4tMdtzAGvyWI5xNaHd2YbjIpCanW6L63MBd2SxEwbXIzdDgTCZY7D/DeeZF9sW/UGL Cshmc+ibOIUTljia2Bbqlhl4r7slt5OGaP4rDRP4zT5ODLc/UHlqd X-Gm-Gg: AeBDievB06BAq+oY7LWwig71hZt6PZsMSDLGNqYaczqOn2ByxBNncO+oabHP7W6+0am QKotHmHBGd8qDwIeVIOYKasWcUBdBgkvhRjVhhN34/phjtpUxiF4gGOZJwk3qxxf5dbhZxFuG9L I79haKHz6rml3M8w4BnHBS/E29pqaJuSc9J1L2bFqSq4R689SWlGBopCzIbOHewL0pHx74Gu+PD sYlKKMiFmeAGuaME3MzMytB7Tsei3R1rXq6qN53Lygb6cVzzSUa+IqYrpKMxnnq0X2Y9gqXISVw iIOwPtSZZa/3CLN0CpGi1kJZo1ntUZ9c6aARG3kFI41uknVUcJIYcCN2xeTPpSmwZklSk8wgb57 aRL6hv4KAsv+xIUzaui02TtwUpyYGmKvmqIkFl4p/KaUv7tvfkA== X-Received: by 2002:a05:690c:4b0f:b0:79c:ff02:a03e with SMTP id 00721157ae682-7b9ed037d1emr5894277b3.2.1776391060655; Thu, 16 Apr 2026 18:57:40 -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 00721157ae682-7b9ee9a8042sm125407b3.21.2026.04.16.18.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 18:57:40 -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 295C2340BC4; Thu, 16 Apr 2026 19:57:40 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 25C2DE406BE; Thu, 16 Apr 2026 19:57:40 -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 v3 3/6] blk-integrity: take u64 in bio_integrity_intervals() Date: Thu, 16 Apr 2026 19:57:29 -0600 Message-ID: <20260417015732.2692434-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260417015732.2692434-1-csander@purestorage.com> References: <20260417015732.2692434-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:56:21 2026 Received: from mail-qk1-f227.google.com (mail-qk1-f227.google.com [209.85.222.227]) (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 3337A2D7DC8 for ; Fri, 17 Apr 2026 01:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391070; cv=none; b=VVnu+LDV5c2/npCNn9Dm17vAzfYGyu9YoIk+XP1S15Gl0dghLMWMBDFpNmhu2xM7AkEa4gGPSJ+mTcLV6rTpnsyBhN5b8gHaeT2BC0ZsX8xxXd3KXIG3xvJEo2tI2Xsa31v9AWgoApiAZt4xrUVjDUDUTBQZcTdL/sLZMAi79+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391070; c=relaxed/simple; bh=fhgMAHy09LsI1L6bahd3pmbOSSyNApfMWjie8uHGN74=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V7D0L8LQPZRgqGCFwsEcsJz00wqaRH4MK8bDGWFnmZ9wRJBe4lGJ2xBS40phbuNO9Qfj9xpgtgm5G7DHbU6TmEoo6h8Vz9y+oUpnUYup1ZgQ3bQqIqzISK2LCxidJnY59PPQ1YrKe3iLGE3lFHSW7aC2ng8+g/oQLR7B+h53ejo= 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=WcXV0ODh; arc=none smtp.client-ip=209.85.222.227 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="WcXV0ODh" Received: by mail-qk1-f227.google.com with SMTP id af79cd13be357-8dd7a652f80so3453685a.1 for ; Thu, 16 Apr 2026 18:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776391061; x=1776995861; 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=MNTSjciFlX9Rr/279QUaN+sXA97OE3S8NKaAWj6D0d0=; b=WcXV0ODhPgZRhhFcuKI/SlGxMpU9IB9Qat1jFXkv3DIO4HdS/16t6whB1jhXzXQdJ4 gP8Bn2lZqv7KO0XYceQPW+TRMlVLKjV7yPj/oi3npgktWRjn8Ore6pxWltWu+eQVwbgK 6rpFIf7/a7/C+F+Thaguc9F1Jbp/MgwNbtkyGZyZ1fy8ttgzwvUOy0D6BPOR+0uowNUp /kA3AGSZFtX51JQir926dqj4X3O+Cb4x+W8NiU/lfYe9XIu8Uax52ye4Lo8NNLVj8kt5 SRt+dcmT0lB0HrLYSWHHTUSdHkcp39LRKPT01jtYQ8R+reI3jp51/djtc2UEbRwTgx7u UqZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776391061; x=1776995861; 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=MNTSjciFlX9Rr/279QUaN+sXA97OE3S8NKaAWj6D0d0=; b=s5osTOsIxlORhyLZ1pct8Rfp2Kgqpxcd37Wji616S1vd1GVvwPgGGlKzDt8SgjHuEN OdGi0lGryyVJWo/d7gp73ecQpatoNgBKHdz7+pErCZAIgFfM65GUleatcirtQJd7C0iy +VxfL6XcfLd2iMfvpC5tqkdD/oKfjCpgTABB9jtxWMZMUW44a/ur7DptNvTrfunqBhTJ C8+UDCW92fO0sIGaKNzhbQiwxQfD8lnJ9KkCIGwPc7sjJiaGSKuHpqTKsktOSAJOisGn Jf2ZKxGrz6I0reKrsyw9GIcEXVQpRKQHOX242iICEtu6ttc/xn4a1neNkCvJDnBd0Vgo N8XQ== X-Forwarded-Encrypted: i=1; AFNElJ/iqTiOaVbBMxYnSc8ooo3CAY7HDQ7nuBWKADwJBSqbHs6oiMFhQ4HKuPnyWD/cSerhJAgwiWFrSabeSRI=@vger.kernel.org X-Gm-Message-State: AOJu0YyFB95msDtLoKZMvX6xCNbMA/L2TAW/UrkMDWouoGqrSFWDABPv QLjSk4MihXh3l9rPVYGAcg49+nwb+PYXUJF4LCT9GRd5vvQEiCfU9AopDwzxVaynnFiMhP18c3z oLDYYpChSRQdX/xyBYPEGvL9xkhjtAJYHukispWK3BjsKSUyH2LrG X-Gm-Gg: AeBDieskuSEy6z9qafOWsdtVVIJ445+rHzdbpNLtpG2Ab8amfX1kWDeee5BnuGHE+n5 3ri7yEFa6OEntFwOEdbXMxR521in+XUpiWiVDhEVsTV91ICyjrSVFXirg//qvd4q+YVmZq7rqPR ZgkgA845fEG/S9hJLXfmeq3/Nd/w09OLBj3jOtX5bHD1xP1hmLOuVw3vzsJaZqsdcvklwSXck0d +Hms1UuJzuqwJD2E7Xr0PNIW+yfi+VAwkAKbN6jt10MFyHdhYfWzRcPscs18tZzZhKFHJ+YCpQu Co0QAK9AJJM/PXuxVir7fkR//HxQuRo238E/7o1EM1IICXyil91Ygzl5hiPIqTYkNld6StheiuM /uzNFdIyjOInVO2xw+L8V8ABKmzxfuz5PjYd23HGK5rZcmPAavw== X-Received: by 2002:a05:622a:44a:b0:509:15aa:cf03 with SMTP id d75a77b69052e-50e36c0afcdmr8556161cf.4.1776391060999; Thu, 16 Apr 2026 18:57:40 -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 d75a77b69052e-50e394581ccsm55631cf.26.2026.04.16.18.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 18:57:40 -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 446ED340C58; Thu, 16 Apr 2026 19:57:40 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 3FEBEE406BE; Thu, 16 Apr 2026 19:57:40 -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 v3 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Date: Thu, 16 Apr 2026 19:57:30 -0600 Message-ID: <20260417015732.2692434-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260417015732.2692434-1-csander@purestorage.com> References: <20260417015732.2692434-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 0daa42d9ead7..0ad1c5ab64e9 100644 --- a/block/bio-integrity-fs.c +++ b/block/bio-integrity-fs.c @@ -65,11 +65,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:56: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 A06FD2D3A75 for ; Fri, 17 Apr 2026 01:57:45 +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=1776391071; cv=none; b=TCFpQt9TeZTQPhSgg8C9g09nTMV3kMPuBpCeB9DGcovWecTX9PI7LV8SChzzUWE1TLkEBcBvFNXCXc8joyx9mEFQ7wLHHgEedV8Dkn3wxiSK1jXpNBGn53ttOnKQLi90rPB+SE1cShM2z0r7aKGhH3kXJKtDqZGdf+RFV9Zre7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391071; c=relaxed/simple; bh=D1sF5rCpyJ8v1Q/Gw4hLl9PjXnZwN2O7sQ73iHxyGO4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XMqCPsTVt7oIfbP2klb0Wzx9Xe9sYiQ6saRAvwquUYGo+prTz4OIQYpC26SyX9RLLS4FS9xP/5onSwqQXftNj8m3wLxVtgtLHoiZK1vgVtFekjx1W4UDoQvhUkBAZrd+8odlZ97Q0cekR9xL2EDczboDA3qNVsNSk1+/JNbl/90= 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=AFvkSnDU; 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="AFvkSnDU" Received: by mail-pj1-f99.google.com with SMTP id 98e67ed59e1d1-35daa02ea08so14264a91.2 for ; Thu, 16 Apr 2026 18:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776391062; x=1776995862; 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=AFvkSnDUcK3u1Z91caVhRRC7hPOoHYN5oMUDYLNsn1oapZb2taaVA74MEYy3uy1u2s mkA0uFhcwjmNZrN3CJKgLYa05x/RXD/8mvlp48UXaYdGnqNz0HFZs9tH+R9cPrVtmJVi R7rwtpxbDoq6HX6DHaNz9/yAOVUvy0r+fLX4LUhYB261yQc5rOV0aswngv945idzpHoN 5/7DAN5v+81jzxH4wFidWM3vpGVwB2oLYb1BAHkdlTq0yE8PUfJdWcEHQXeweCtbbMrj ya+0cEmczxyk9+BV3fWb13UX03yrFNTzRv6/4ixTBeNXVmYkwJBfW/8hQ/y9FxVzd8Rf q5Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776391062; x=1776995862; 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=A/RyfgZWiOQHdXhf+CGdpJ9tcEf6Exc8rwtsFpOQS8LiiL6UAZDEmq/GUT32sMtZ/d shAaeMA6Nct6giSxJ5HNZwuJv2z/UABQ/eeU7SxlzgVEcocFMxL7yJPED9Bc3X+dJswM D+om4MeHzgp+Bti+MFJQ5udsIjChX5Ja8mm0Z2UnizAQVP8bfMxBCBZmFPvG2rcpdZR5 XJAupVuJ38C1du3I2h4LK2cDbnlXW72NNrwWUomt2LDZRNUyyXe4GsruHGTCS/irnqFr 91fMZ4/ewgGVnvn4qT6+gOVw6fri+L6u1TuEdmYCfRXfjgJ5rh8TgzxHtnH/6T8rtTks 46Mg== X-Forwarded-Encrypted: i=1; AFNElJ8DjgTzaIi4StMbf6X8GLPAr+g6dzrfmthVhpm8W9zfuOS0JXLtMmiqw5Cw2/2KUygiUnH55YMf4SFKaUg=@vger.kernel.org X-Gm-Message-State: AOJu0YwMXMEVttce+FmhmsupbmHkjS3JHQFYd1VifaZEuIj3wfuEM8qr Za+Kmi3TMvTdXBBJguM1Wru5gxYaGpHaqwNyvPfE2o0awM6rfzhganb+Ev7RqqGceT+1N8H7Cci kpCU2KSXbs8eC1kqro6gg9SikiM24hDYC6caI X-Gm-Gg: AeBDiesX0VNPNWqh3mevMjCLgqJqMyPyPZKMivP6eH6HB6eHmpijH0QuKG/h6YmM3PD O7QwVT/NcZhBExxh6HC5+7abTQPWfi4DhV5w/KVGr5cpufWrlWCfy2VEWrEutYrD+V69rZ3X8n6 eqzvNuIfUM0vngHfPDGTCGkN1vIKXr0PdEqIvmVaqvK+LDmRA+OISAAHx5ku1tsaQJxJyUEFNMq 92NyAx0dm5KlhwnHtcusu/gM0E1XIcRng4Do0zgqKNtpKMWDpK+1CAfsJ+Yy8OT5Bkniw63o5Pf 18D0uEui49KrXMcq1nSbDe4zhvCyTV9wccsLTryFXanTQOR0lV8VsN5rTBzQd0jlnu+m6O5ondP dZgrmPBcUjQXmWMS/NbYrzxacjiiSXnNhOHNoGjzifoL3VRsEfp6om8dwQEQ7Thsl X-Received: by 2002:a17:902:b68f:b0:2b2:48a5:45c3 with SMTP id d9443c01a7336-2b5f9eceb6amr2890535ad.1.1776391062085; Thu, 16 Apr 2026 18:57:42 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-2b5faa0fa70sm233095ad.14.2026.04.16.18.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 18:57:42 -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 658EC3406AA; Thu, 16 Apr 2026 19:57:41 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 60208E406BE; Thu, 16 Apr 2026 19:57:40 -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 v3 5/6] t10-pi: use bio_integrity_intervals() helper Date: Thu, 16 Apr 2026 19:57:31 -0600 Message-ID: <20260417015732.2692434-6-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260417015732.2692434-1-csander@purestorage.com> References: <20260417015732.2692434-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:56:21 2026 Received: from mail-pf1-f225.google.com (mail-pf1-f225.google.com [209.85.210.225]) (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 14A882C3271 for ; Fri, 17 Apr 2026 01:57:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391070; cv=none; b=aicnAnDmAuU+7iqtklR6HJmynm3WeTpxDRilvCKBwYtUV9BJQhbwEv4FU0S4Wdxje4NbHlSVIkI9u+AY5J5yppTlbvzjfdlIjNHcgInGMylZZWQHoXXyyZJqYlH7Q9KHBTIG/7Awqg6r9bFID3n6xTZxPK8RUzUFbeke8CIJ58I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776391070; c=relaxed/simple; bh=sIarZi4SDoM15BRFouM9vXGrkYDtf3itMS6IncqGb8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DV+XAKIFj7ZoKqJvdWC78suDOARfoAHXQsXvZTm5Q5mVguhHK++vqMPs4NRcIplDY3OKMqv0gvspZSDkiEBP0PHVeehqg4sEMCQ7AWBzm/t+9e7EY+sBv18rt2tySaW6FXag9lzluyd9ExFY9QFv3KdHfGLxSwxRDLZGADtAUJw= 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=bfV/zaSw; arc=none smtp.client-ip=209.85.210.225 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="bfV/zaSw" Received: by mail-pf1-f225.google.com with SMTP id d2e1a72fcca58-82f08a84126so16900b3a.2 for ; Thu, 16 Apr 2026 18:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1776391061; x=1776995861; 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=g++H+r0qfX5K115kzK83mAIHId7HSerOrnUwj7zT4F8=; b=bfV/zaSwAaXnUNU7ZVjv+RV/R9vs9wzZxlahN0K+Nr/220ay8aZQ39BIAmF1Y8aKBH eMnX6pX79xeq4D2lyYA/imU8K0QhR9nbkdkH5vQeGMRj5/EIYlErTvJSlT0InLtNjuZQ /PudpGk7rEwNMaja1jZsY1ts1ijH7t1OvCNXGWIQo7dye5fip1lFQbt34Dlsbl+/5RkB g4qO1VbVAMIhxO/vltIb1F51py+NFfvD43kmIXtwEjvcdwt3ANG6uAabDXEECDB9v+eS b8TVSNdzJ3IlUbqKS6lSH+qPt1SFS17INfmsMwDCB1PcUOgZj5z+R1sxRrW/YKCJ6m8i Kk1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776391061; x=1776995861; 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=g++H+r0qfX5K115kzK83mAIHId7HSerOrnUwj7zT4F8=; b=j0Hs8ShIQFKaqw8XXgOS7nZjSY9l+X/mkSxeqVsc1xJ6p/5dsTQnU9+nuHbDrsqq9Y Q8qphgT7WawD3LNtVUIliK/2JB5kyAM6HONayp9lGHomKhX7eJe10RffJsYSsrVNVG69 G0LFyUuXzia/IAoQACjywjrIfG5JpXIeYeEdonooSHdiS0Hc+gFo0Vt5FbEc0eBORTBS uV0zneB0ac3n3Ewp81QF25KumGc3B+Vze99aedDwn6q5QySIA2T5oCxh+BFNT74GWQUg l9GlBWeUZT7WfjXgnuUtxsffToDgxE11KngCqIy1S2mvkokIYXzeRqfIEay2HvQU2NUi btdA== X-Forwarded-Encrypted: i=1; AFNElJ9E1TgeelIVjAUtYkcLUVFk6Rm/hjKcyVp+FwGHd0quzHCGU7zJHc6a5pFT0LG6Xf3KNLHy1qEssLWcxfg=@vger.kernel.org X-Gm-Message-State: AOJu0YzQvV8x8gO+4GzUrP8Mv3XDTEhvRKPlzel053FbnTcwidyqoK4z ErBL463WvhenubG3nZ3kYr70mt7J1KLE81VQvC8UkGQ3uqRQXRvZzZ7jmRL/ExTQjBi+haxHmba IY6fhlWSWOs3ijn1CUFpqcW21bmDnHd6jPAtHbSE/t5XA4DitoAu1 X-Gm-Gg: AeBDieumfCAAN8GpmQbw7BWmEZdMGACj0gMbpAJDt9TRJ1pnxeNUSlkFcIbruNNHMDR DYJazHzf7ae9TT5G5uSUuV73KYmGAwbVO1vmv35ydi11RVtcwduEVSCbrOOcZX6MbGruf4J1SVd JDLu74XVX9eqXW5/Y6HKuU56WZ04ozpnUz91V1ZOm4YltrA1PFjDtiEoC/kIheh2jQSw8sCl/Gq fzuzqx2sThwF8vp/+/HcPXW3itWkdeXW42EUfjezxssBgiR/WJJh7BS5OWvMQk3UA760AhA+HRR mRKGNKY8RqqstYECtdNrz/LoK3hSED/GBUzA18gjR8rDar3ZyFTIEo2vfgkEou1QBxCG/DPSw9h Yu3G3CMi7eJWiuFJrBLrbe0ILy/8laGhAg+oqRJr0eEu7fik6jQ== X-Received: by 2002:a17:90b:268b:b0:35f:b47e:7225 with SMTP id 98e67ed59e1d1-361404991ecmr456269a91.6.1776391061376; Thu, 16 Apr 2026 18:57:41 -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-361410a19d3sm38091a91.7.2026.04.16.18.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 18:57:41 -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 8FFA0341D23; Thu, 16 Apr 2026 19:57:40 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 8601FE499D2; Thu, 16 Apr 2026 19:57:40 -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 v3 6/6] blk-integrity: avoid sector_t in bip_{get,set}_seed() Date: Thu, 16 Apr 2026 19:57:32 -0600 Message-ID: <20260417015732.2692434-7-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260417015732.2692434-1-csander@purestorage.com> References: <20260417015732.2692434-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 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. Suggested-by: Christoph Hellwig Signed-off-by: Caleb Sander Mateos --- 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 | 13 +++++++++++++ include/linux/bvec.h | 1 + 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3ad6a6799f17..8549d9148b0b 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(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..65fce51b024a 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(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..1aeb5be529a8 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(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..c82b2f6fe194 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -85,10 +85,23 @@ 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 + * @bio: struct bio whose integrity payload's ref tag seed to initialize + */ +static inline void bip_set_seed(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); + + 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