OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.2 v3 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD
@ 2026-11-25 11:56 Alexander Ivanov
  2026-11-25 11:57 ` [Devel] [PATCH hci-8.2 v3 1/4] drivers/vhost/blk: drop ring features already in VHOST_FEATURES Alexander Ivanov
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Alexander Ivanov @ 2026-11-25 11:56 UTC (permalink / raw)
  To: andrey.zhadchenko; +Cc: devel

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.

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 | 110 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 85 insertions(+), 25 deletions(-)

-- 
2.53.0

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-11-25 14:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 11:56 [Devel] [PATCH hci-8.2 v3 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD Alexander Ivanov
2026-11-25 11:57 ` [Devel] [PATCH hci-8.2 v3 1/4] drivers/vhost/blk: drop ring features already in VHOST_FEATURES Alexander Ivanov
2026-11-25 11:57 ` [Devel] [PATCH hci-8.2 v3 2/4] drivers/vhost/blk: stop failing write zeroes above the backend limit Alexander Ivanov
2026-11-25 12:32   ` Konstantin Khorenko
2026-11-25 11:57 ` [Devel] [PATCH hci-8.2 v3 3/4] drivers/vhost/blk: return UNSUPP for write zeroes on a backend without it Alexander Ivanov
2026-11-25 12:32   ` Konstantin Khorenko
2026-11-25 11:57 ` [Devel] [PATCH hci-8.2 v3 4/4] drivers/vhost/blk: support VIRTIO_BLK_F_DISCARD Alexander Ivanov
2026-11-25 12:32   ` Konstantin Khorenko
2026-11-25 12:32 ` [Devel] [PATCH hci-8.2 v3 0/4] drivers/vhost/blk: fix write zeroes errors, " Konstantin Khorenko
2026-11-25 14:07   ` Alexander Ivanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox