From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit 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 context of block integrity") Fixes: 63573e359d05 ("bio-integrity: Restore original iterator on verify stage") Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta --- 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_payload *bip) void bio_integrity_setup_default(struct bio *bio) { struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); struct bio_integrity_payload *bip = bio_integrity(bio); + u64 seed = bio->bi_iter.bi_sector >> (bi->interval_exp - SECTOR_SHIFT); - bip_set_seed(bip, bio->bi_iter.bi_sector); + bip_set_seed(bip, seed); if (bi->csum_type) { bip->bip_flags |= BIP_CHECK_GUARD; if (bi->csum_type == BLK_INTEGRITY_CSUM_IP) bip->bip_flags |= 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 = blk_get_integrity(bio->bi_bdev->bd_disk); struct bio_integrity_payload *bip = bio_integrity(bio); + u64 seed = data_iter->bi_sector >> (bi->interval_exp - SECTOR_SHIFT); struct blk_integrity_iter iter = { .bio = bio, .bip = bip, .bi = bi, .data_iter = *data_iter, .prot_iter = bip->bip_iter, .interval_remaining = 1 << bi->interval_exp, - .seed = data_iter->bi_sector, + .seed = seed, .csum = 0, }; blk_status_t ret = BLK_STS_OK; while (iter.data_iter.bi_size && ret == BLK_STS_OK) { -- 2.45.2