* [PATCH 0/6] block: fix integrity offset/length conversions
@ 2026-04-03 19:41 Caleb Sander Mateos
2026-04-03 19:41 ` [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Caleb Sander Mateos
` (6 more replies)
0 siblings, 7 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
The block layer's integrity code currently sets the seed (initial
reference tag) in units of 512-byte sectors but increments it in units
of integrity intervals. Not only do the T10 DIF formats require ref tags
to be the lower bits of the logical block address, but mixing the two
units means the ref tags used for a particular logical block vary based
on its offset within a read/write request. This looks to be a
longstanding bug affecting block devices that support integrity with
block sizes > 512 bytes; I'm surprised it wasn't noticed before.
Also fix the newly added fs_bio_integrity_verify() to pass
bio_integrity_verify() a struct bdev_iter representing the data instead
of the integrity. Most of the integrity data is currently being skipped.
Caleb Sander Mateos (6):
blk-integrity: take sector_t in bio_integrity_intervals()
block: use integrity interval instead of sector as seed
bio-integrity-fs: pass data iter to bio_integrity_verify()
bio-integrity-fs: use integrity interval instead of sector as seed
t10-pi: use bio_integrity_intervals() helper
target: use bio_integrity_intervals() helper
block/bio-integrity-fs.c | 5 +++--
block/bio-integrity.c | 2 +-
block/t10-pi.c | 4 ++--
drivers/nvme/target/io-cmd-bdev.c | 3 +--
drivers/target/target_core_iblock.c | 3 +--
include/linux/blk-integrity.h | 12 ++++++------
6 files changed, 14 insertions(+), 15 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals()
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
@ 2026-04-03 19:41 ` Caleb Sander Mateos
2026-04-05 11:27 ` Anuj gupta
2026-04-06 6:31 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 2/6] block: use integrity interval instead of sector as seed Caleb Sander Mateos
` (5 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
To allow bio_integrity_intervals() to convert an absolute sector_t to an
absolute integrity interval, change its argument type to sector_t and
its return type to u64.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
include/linux/blk-integrity.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
index b1b530613c34..2e366f03a3d8 100644
--- a/include/linux/blk-integrity.h
+++ b/include/linux/blk-integrity.h
@@ -64,21 +64,21 @@ queue_max_integrity_segments(const struct request_queue *q)
{
return q->limits.max_integrity_segments;
}
/**
- * 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 *bi,
- unsigned int sectors)
+static inline u64 bio_integrity_intervals(struct blk_integrity *bi,
+ sector_t sectors)
{
return sectors >> (bi->interval_exp - 9);
}
static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
@@ -151,12 +151,12 @@ static inline unsigned short
queue_max_integrity_segments(const struct request_queue *q)
{
return 0;
}
-static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi,
- unsigned int sectors)
+static inline u64 bio_integrity_intervals(struct blk_integrity *bi,
+ sector_t sectors)
{
return 0;
}
static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/6] block: use integrity interval instead of sector as seed
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
2026-04-03 19:41 ` [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Caleb Sander Mateos
@ 2026-04-03 19:41 ` Caleb Sander Mateos
2026-04-05 11:27 ` Anuj gupta
2026-04-06 6:34 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Caleb Sander Mateos
` (4 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
bio_integrity_setup_default() and blk_integrity_iterate() set the
integrity seed (initial reference tag) to the absolute address in the
block device in units of 512-byte sectors. The seed is correctly
incremented/decremented in units of integrity intervals in
bio_integrity_map_iter(), bio_integrity_advance(), and
blk_integrity_interval(). As a result, the ref tag written or read to a
particular integrity interval on a block device with integrity interval
size > 512 bytes varies with the starting offset of the read/write.
Convert the initial seed to units of integrity intervals so a consistent
ref tag is used for each integrity interval.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
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")
---
block/bio-integrity.c | 2 +-
block/t10-pi.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index e79eaf047794..4be2cf649e54 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -104,11 +104,11 @@ void bio_integrity_free_buf(struct bio_integrity_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);
- bip_set_seed(bip, bio->bi_iter.bi_sector);
+ bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector));
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..36475369cd16 100644
--- a/block/t10-pi.c
+++ b/block/t10-pi.c
@@ -315,11 +315,11 @@ static blk_status_t blk_integrity_iterate(struct bio *bio,
.bip = bip,
.bi = bi,
.data_iter = *data_iter,
.prot_iter = bip->bip_iter,
.interval_remaining = 1 << bi->interval_exp,
- .seed = data_iter->bi_sector,
+ .seed = bio_integrity_intervals(bi, data_iter->bi_sector),
.csum = 0,
};
blk_status_t ret = BLK_STS_OK;
while (iter.data_iter.bi_size && ret == BLK_STS_OK) {
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify()
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
2026-04-03 19:41 ` [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Caleb Sander Mateos
2026-04-03 19:41 ` [PATCH 2/6] block: use integrity interval instead of sector as seed Caleb Sander Mateos
@ 2026-04-03 19:41 ` Caleb Sander Mateos
2026-04-05 11:28 ` Anuj gupta
2026-04-06 6:35 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Caleb Sander Mateos
` (3 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
bio_integrity_verify() expects the passed struct bvec_iter to be an
iterator over bio data, not integrity. So construct a separate data
bvec_iter without the bio_integrity_bytes() conversion and pass it to
bio_integrity_verify() instead of bip_iter.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: 0bde8a12b554 ("block: add fs_bio_integrity helpers")
---
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);
int fs_bio_integrity_verify(struct bio *bio, sector_t sector, unsigned int size)
{
struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
struct bio_integrity_payload *bip = bio_integrity(bio);
+ struct bvec_iter data_iter = {.bi_sector = sector, .bi_size = size};
/*
* 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 = sector;
bip->bip_iter.bi_size = 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));
}
static int __init fs_bio_integrity_init(void)
{
fs_bio_integrity_cache = kmem_cache_create("fs_bio_integrity",
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
` (2 preceding siblings ...)
2026-04-03 19:41 ` [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Caleb Sander Mateos
@ 2026-04-03 19:41 ` Caleb Sander Mateos
2026-04-05 11:29 ` Anuj gupta
2026-04-06 6:36 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper Caleb Sander Mateos
` (2 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
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 <csander@purestorage.com>
---
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 sector, 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 = sector;
+ bip->bip_iter.bi_sector = bio_integrity_intervals(bi, sector);
bip->bip_iter.bi_size = bio_integrity_bytes(bi, size >> SECTOR_SHIFT);
return blk_status_to_errno(bio_integrity_verify(bio, &data_iter));
}
static int __init fs_bio_integrity_init(void)
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
` (3 preceding siblings ...)
2026-04-03 19:41 ` [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Caleb Sander Mateos
@ 2026-04-03 19:41 ` Caleb Sander Mateos
2026-04-05 23:43 ` Anuj gupta
2026-04-06 6:36 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 6/6] target: " Caleb Sander Mateos
2026-04-05 11:26 ` [PATCH 0/6] block: fix integrity offset/length conversions Anuj gupta
6 siblings, 2 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
Use bio_integrity_intervals() to convert blk_rq_pos(rq) to integrity
intervals to reduce code duplication.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
block/t10-pi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/t10-pi.c b/block/t10-pi.c
index 36475369cd16..112015cdeb72 100644
--- a/block/t10-pi.c
+++ b/block/t10-pi.c
@@ -540,11 +540,11 @@ static void __blk_reftag_remap(struct bio *bio, struct blk_integrity *bi,
static void blk_integrity_remap(struct request *rq, unsigned int nr_bytes,
bool prep)
{
struct blk_integrity *bi = &rq->q->limits.integrity;
- u64 ref = blk_rq_pos(rq) >> (bi->interval_exp - SECTOR_SHIFT);
+ u64 ref = bio_integrity_intervals(bi, blk_rq_pos(rq));
unsigned intervals = nr_bytes >> bi->interval_exp;
struct bio *bio;
if (!(bi->flags & BLK_INTEGRITY_REF_TAG))
return;
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 6/6] target: use bio_integrity_intervals() helper
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
` (4 preceding siblings ...)
2026-04-03 19:41 ` [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper Caleb Sander Mateos
@ 2026-04-03 19:41 ` Caleb Sander Mateos
2026-04-05 11:29 ` Anuj gupta
2026-04-05 11:26 ` [PATCH 0/6] block: fix integrity offset/length conversions Anuj gupta
6 siblings, 1 reply; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-03 19:41 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen
Cc: linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel,
Caleb Sander Mateos
Use bio_integrity_intervals() to convert bio->bi_iter.bi_sector to
integrity intervals to reduce code duplication. Make the same change in
the nvmet code that appears to have been copied from the target code.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
drivers/nvme/target/io-cmd-bdev.c | 3 +--
drivers/target/target_core_iblock.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index f2d9e8901df4..dcf273360015 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -218,12 +218,11 @@ static int nvmet_bdev_alloc_bip(struct nvmet_req *req, struct bio *bio,
pr_err("Unable to allocate bio_integrity_payload\n");
return PTR_ERR(bip);
}
/* virtual start sector must be in integrity interval units */
- bip_set_seed(bip, bio->bi_iter.bi_sector >>
- (bi->interval_exp - SECTOR_SHIFT));
+ bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector));
resid = bio_integrity_bytes(bi, bio_sectors(bio));
while (resid > 0 && sg_miter_next(miter)) {
len = min_t(size_t, miter->length, resid);
rc = bio_integrity_add_page(bio, miter->page, len,
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 1087d1d17c36..434ef2b0b120 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -706,12 +706,11 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio,
pr_err("Unable to allocate bio_integrity_payload\n");
return PTR_ERR(bip);
}
/* virtual start sector must be in integrity interval units */
- bip_set_seed(bip, bio->bi_iter.bi_sector >>
- (bi->interval_exp - SECTOR_SHIFT));
+ bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector));
pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size,
(unsigned long long)bip->bip_iter.bi_sector);
resid = bio_integrity_bytes(bi, bio_sectors(bio));
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 0/6] block: fix integrity offset/length conversions
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
` (5 preceding siblings ...)
2026-04-03 19:41 ` [PATCH 6/6] target: " Caleb Sander Mateos
@ 2026-04-05 11:26 ` Anuj gupta
6 siblings, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 11:26 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel
> The block layer's integrity code currently sets the seed (initial
> reference tag) in units of 512-byte sectors but increments it in units
> of integrity intervals. Not only do the T10 DIF formats require ref tags
> to be the lower bits of the logical block address, but mixing the two
> units means the ref tags used for a particular logical block vary based
> on its offset within a read/write request. This looks to be a
> longstanding bug affecting block devices that support integrity with
> block sizes > 512 bytes; I'm surprised it wasn't noticed before.
>
This likely went unnoticed because the remap path compensates for it:
blk_integrity_prepare() rewrites the host-side sector-based ref tag to
the correct device-visible interval/LBA value, and
blk_integrity_complete() rewrites it back on reads. So for block-auto
PI, and for the FS-PI path that goes through the same remap, the
device-facing ref tag still comes out correct even though the host-side
seed is semantically wrong.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals()
2026-04-03 19:41 ` [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Caleb Sander Mateos
@ 2026-04-05 11:27 ` Anuj gupta
2026-04-06 6:31 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 11:27 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel, Anuj Gupta
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/6] block: use integrity interval instead of sector as seed
2026-04-03 19:41 ` [PATCH 2/6] block: use integrity interval instead of sector as seed Caleb Sander Mateos
@ 2026-04-05 11:27 ` Anuj gupta
2026-04-06 6:34 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 11:27 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel, Anuj Gupta
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify()
2026-04-03 19:41 ` [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Caleb Sander Mateos
@ 2026-04-05 11:28 ` Anuj gupta
2026-04-06 6:35 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 11:28 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel, Anuj Gupta
> 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.
Good catch!
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed
2026-04-03 19:41 ` [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Caleb Sander Mateos
@ 2026-04-05 11:29 ` Anuj gupta
2026-04-06 6:36 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 11:29 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel
Looks ok to me.
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 6/6] target: use bio_integrity_intervals() helper
2026-04-03 19:41 ` [PATCH 6/6] target: " Caleb Sander Mateos
@ 2026-04-05 11:29 ` Anuj gupta
0 siblings, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 11:29 UTC (permalink / raw)
To: Caleb Sander Mateos, Anuj Gupta
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel
Looks ok to me.
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper
2026-04-03 19:41 ` [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper Caleb Sander Mateos
@ 2026-04-05 23:43 ` Anuj gupta
2026-04-06 6:36 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Anuj gupta @ 2026-04-05 23:43 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals()
2026-04-03 19:41 ` [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Caleb Sander Mateos
2026-04-05 11:27 ` Anuj gupta
@ 2026-04-06 6:31 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2026-04-06 6:31 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel
> /**
> - * 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 *bi,
> - unsigned int sectors)
> +static inline u64 bio_integrity_intervals(struct blk_integrity *bi,
> + sector_t sectors)
sector_t is a sector number, not a number of sectors. So if you need a
64-bit value here, it should just be a u64.
> {
> return sectors >> (bi->interval_exp - 9);
If you touch this, maybe also replace 9 with SECTOR_SHIFT?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/6] block: use integrity interval instead of sector as seed
2026-04-03 19:41 ` [PATCH 2/6] block: use integrity interval instead of sector as seed Caleb Sander Mateos
2026-04-05 11:27 ` Anuj gupta
@ 2026-04-06 6:34 ` Christoph Hellwig
2026-04-07 16:48 ` Caleb Sander Mateos
1 sibling, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2026-04-06 6:34 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Sagi Grimberg, Chaitanya Kulkarni, Martin K. Petersen,
linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel
On Fri, Apr 03, 2026 at 01:41:05PM -0600, Caleb Sander Mateos wrote:
> 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);
>
> - bip_set_seed(bip, bio->bi_iter.bi_sector);
> + bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector));
Should we simply switch bip_set_seed to take a bio bvec_iter argument and
lift all this logic into it? That feels a lot less fragile.
Bonus points for writing useful documentation for the new bip_set_seed.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify()
2026-04-03 19:41 ` [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Caleb Sander Mateos
2026-04-05 11:28 ` Anuj gupta
@ 2026-04-06 6:35 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2026-04-06 6:35 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
Martin K. Petersen, linux-block, linux-kernel, linux-nvme,
linux-scsi, target-devel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed
2026-04-03 19:41 ` [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Caleb Sander Mateos
2026-04-05 11:29 ` Anuj gupta
@ 2026-04-06 6:36 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2026-04-06 6:36 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Sagi Grimberg, Chaitanya Kulkarni, Martin K. Petersen,
linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper
2026-04-03 19:41 ` [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper Caleb Sander Mateos
2026-04-05 23:43 ` Anuj gupta
@ 2026-04-06 6:36 ` Christoph Hellwig
1 sibling, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2026-04-06 6:36 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Jens Axboe, Sagi Grimberg, Chaitanya Kulkarni, Martin K. Petersen,
linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/6] block: use integrity interval instead of sector as seed
2026-04-06 6:34 ` Christoph Hellwig
@ 2026-04-07 16:48 ` Caleb Sander Mateos
0 siblings, 0 replies; 20+ messages in thread
From: Caleb Sander Mateos @ 2026-04-07 16:48 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Sagi Grimberg, Chaitanya Kulkarni, Martin K. Petersen,
linux-block, linux-kernel, linux-nvme, linux-scsi, target-devel
On Sun, Apr 5, 2026 at 11:35 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Fri, Apr 03, 2026 at 01:41:05PM -0600, Caleb Sander Mateos wrote:
> > 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);
> >
> > - bip_set_seed(bip, bio->bi_iter.bi_sector);
> > + bip_set_seed(bip, bio_integrity_intervals(bi, bio->bi_iter.bi_sector));
>
> Should we simply switch bip_set_seed to take a bio bvec_iter argument and
> lift all this logic into it? That feels a lot less fragile.
Perhaps I'm misunderstanding the suggestion, but how would that work
for initializing the seed from struct uio_meta in
bio_integrity_map_iter()?
bip_set_seed(bio_integrity(bio), meta->seed);
Thanks,
Caleb
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-04-07 16:49 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 19:41 [PATCH 0/6] block: fix integrity offset/length conversions Caleb Sander Mateos
2026-04-03 19:41 ` [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals() Caleb Sander Mateos
2026-04-05 11:27 ` Anuj gupta
2026-04-06 6:31 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 2/6] block: use integrity interval instead of sector as seed Caleb Sander Mateos
2026-04-05 11:27 ` Anuj gupta
2026-04-06 6:34 ` Christoph Hellwig
2026-04-07 16:48 ` Caleb Sander Mateos
2026-04-03 19:41 ` [PATCH 3/6] bio-integrity-fs: pass data iter to bio_integrity_verify() Caleb Sander Mateos
2026-04-05 11:28 ` Anuj gupta
2026-04-06 6:35 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 4/6] bio-integrity-fs: use integrity interval instead of sector as seed Caleb Sander Mateos
2026-04-05 11:29 ` Anuj gupta
2026-04-06 6:36 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 5/6] t10-pi: use bio_integrity_intervals() helper Caleb Sander Mateos
2026-04-05 23:43 ` Anuj gupta
2026-04-06 6:36 ` Christoph Hellwig
2026-04-03 19:41 ` [PATCH 6/6] target: " Caleb Sander Mateos
2026-04-05 11:29 ` Anuj gupta
2026-04-05 11:26 ` [PATCH 0/6] block: fix integrity offset/length conversions Anuj gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox