OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.2 v4 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD
Date: Thu, 26 Nov 2026 12:31:05 +0100	[thread overview]
Message-ID: <ea5a36f8-9bfd-43dd-bc5d-ae6118239b36@virtuozzo.com> (raw)
In-Reply-To: <20261125142145.786278-1-alexander.ivanov@virtuozzo.com>

Reviewed-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>

On 11/25/26 15:21, Alexander Ivanov wrote:
> vhost-blk does not offer VIRTIO_BLK_F_DISCARD, so a guest on vhost-blk
> cannot release unused blocks of its disk, while virtio-blk in QEMU can.
> 
> vhost-blk also fails WRITE ZEROES with VIRTIO_BLK_S_IOERR when the range
> is above the backend limit, which the guest does not know, and once the
> backend loses WRITE ZEROES support, e.g. on a dm table reload. In the
> latter case the guest gets -EIO instead of falling back to writing
> zeroes itself.
> 
> Patch 1 drops the ring features that are already part of VHOST_FEATURES.
> Patch 2 stops checking WRITE ZEROES ranges against the backend limit.
> Patch 3 answers VIRTIO_BLK_S_UNSUPP to WRITE ZEROES when the backend has
> no WRITE ZEROES support. Patch 4 handles VIRTIO_BLK_T_DISCARD as a
> single-segment request sent to the backend as one REQ_OP_DISCARD bio.
> 
> The QEMU side is sent separately.
> 
> v4:
> - patch 2: say a backend without WRITE ZEROES still gets
>    VIRTIO_BLK_S_IOERR and the VMM still has to cap
>    max_write_zeroes_sectors
> - patch 3: look up the backend bdev in vhost_blk_req_done() only when
>    the bio failed
> - patch 4: pass the backend file to vhost_blk_parse_segment() instead of
>    bdev; test for REQ_OP_DISCARD instead of op_is_discard(); say the VMM
>    rounds the limit down to the logical block size and must not offer
>    discard for a drive with discard=ignore
> 
> v3:
> - merge with "drivers/vhost/blk: return UNSUPP for write zeroes on a
>    backend without it", split into patches 2 and 3 and put before the
>    discard patch, so the WRITE ZEROES fixes apply without it
> - patch 3: test the op in vhost_blk_req_done() through req->bi_opf;
>    treat any failure as unsupported once the backend limit is 0; say this
>    replaces the contract of 3b2e28a4f6b7 and add its Fixes: line
> - patch 4: count any discard failure as success once the backend
>    discard limit is 0; pass bdev to vhost_blk_parse_segment() instead of
>    a size limit; complete both request types through
>    vhost_blk_req_submit_or_complete(); say which limits the VMM must set
> 
> v2:
> - discard patch: keep vhost_blk_parse_write_zeroes() and add
>    vhost_blk_parse_discard(), both on top of vhost_blk_parse_segment()
>    that reads and checks the segment, instead of one parser full of
>    per-type conditions
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-141683
> https://virtuozzo.atlassian.net/browse/VSTOR-141684
> 
> Assisted-by: LLM
> 
> Alexander Ivanov (4):
>    drivers/vhost/blk: drop ring features already in VHOST_FEATURES
>    drivers/vhost/blk: stop failing write zeroes above the backend limit
>    drivers/vhost/blk: return UNSUPP for write zeroes on a backend without
>      it
>    drivers/vhost/blk: support VIRTIO_BLK_F_DISCARD
> 
>   drivers/vhost/blk.c | 115 +++++++++++++++++++++++++++++++++-----------
>   1 file changed, 88 insertions(+), 27 deletions(-)
> 

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-26 11:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 14:21 Alexander Ivanov
2026-11-25 14:21 ` [Devel] [PATCH hci-8.2 v4 1/4] drivers/vhost/blk: drop ring features already in VHOST_FEATURES Alexander Ivanov
2026-11-25 14:21 ` [Devel] [PATCH hci-8.2 v4 2/4] drivers/vhost/blk: stop failing write zeroes above the backend limit Alexander Ivanov
2026-11-25 14:21 ` [Devel] [PATCH hci-8.2 v4 3/4] drivers/vhost/blk: return UNSUPP for write zeroes on a backend without it Alexander Ivanov
2026-11-25 14:21 ` [Devel] [PATCH hci-8.2 v4 4/4] drivers/vhost/blk: support VIRTIO_BLK_F_DISCARD Alexander Ivanov
2026-11-26 11:31 ` Andrey Zhadchenko [this message]
2026-11-30 15:24 ` [Devel] [PATCH hci-8.2 v4 0/4] drivers/vhost/blk: fix write zeroes errors, " Konstantin Khorenko
2026-11-30 15:24 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea5a36f8-9bfd-43dd-bc5d-ae6118239b36@virtuozzo.com \
    --to=andrey.zhadchenko@virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=devel@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox