Re: [PATCH 03/26] block: Introduce bio_straddle_zones() and bio_offset_from_zone_start()

Bart Van Assche
2024-02-03T04:09:11Z

On 2/1/24 23:30, Damien Le Moal wrote:
> Implement the inline helper functions bio_straddle_zones() and
> bio_offset_from_zone_start() to respectively test if a BIO crosses a
> zone boundary (the start sector and last sector belong to different
> zones) and to obtain the oofset from a zone starting sector of a BIO.

oofset -> offset
> +static inline bool bio_straddle_zones(struct bio *bio)
> +{
> + return bio_zone_no(bio) !=
> + disk_zone_no(bio->bi_bdev->bd_disk, bio_end_sector(bio) - 1);
> +}

It seems to me that the above code is not intended to handle the case
where bi_size == 0, as is the case for an empty flush request. Should a
comment be added above this function or do we perhaps need to add a
WARN_ON_ONCE() statement?

Thanks,

Bart.