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

Christoph Hellwig hch at infradead.org
Sun Apr 5 23:31:00 PDT 2026


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




More information about the Linux-nvme mailing list