Re: [PATCH 1/6] blk-integrity: take sector_t in bio_integrity_intervals()

From: Christoph Hellwig

Date: Mon Apr 06 2026 - 02:31:10 EST


> /**
> - * 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?