On 8/26/26 05:57, Niklas Cassel wrote:
> From: Sam Li <[email protected]>
> 
> virtio_blk_submit_multireq() fuses adjacent in-zone requests into a
> single request. On a zoned backend, a merged zone append request
> that straddles a zone boundary is rejected by the device because
> each write must stay within a single zone.
> 
> Add a bail condition to the merge coalescer: if combining the
> candidate request into the current batch would cross a zone
> boundary, flush the current batch and start a new one.
> 
> Signed-off-by: Sam Li <[email protected]>
> Reviewed-by: Stefan Hajnoczi <[email protected]>
> Reviewed-by: Niklas Cassel <[email protected]>
> Signed-off-by: Niklas Cassel <[email protected]>

Looks good.

Reviewed-by: Damien Le Moal <[email protected]>

A couple of minor nit below.

> @@ -309,17 +312,34 @@ static void virtio_blk_submit_multireq(VirtIOBlock *s, 
> MultiReqBuffer *mrb)
>      for (i = 0; i < mrb->num_reqs; i++) {
>          VirtIOBlockReq *req = mrb->reqs[i];
>          if (num_reqs > 0) {
> +            zone_cross = false;

Move this as a else of the if below.

> +
> +            /*
> +             * On zoned backends, a single backend write/read must not span
> +             * a zone boundary. Bail out of merging if combining req into
> +             * the current batch would straddle a zone.
> +             */
> +            if (zone_size > 0) {
> +                zone_sector = zone_size / BDRV_SECTOR_SIZE;

Super confusing name. Can we have this be zone_nr_sectors ?

> +                end_sector = req->sector_num
> +                                + req->qiov.size / BDRV_SECTOR_SIZE - 1;
> +                zone_cross = (sector_num / zone_sector) !=
> +                             (end_sector / zone_sector);
> +            }

-- 
Damien Le Moal
Western Digital Research

Reply via email to