All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.2 v4 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD
@ 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
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Alexander Ivanov @ 2026-11-25 14:21 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.

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(-)

-- 
2.53.0

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

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

end of thread, other threads:[~2026-11-30 15:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 14:21 [Devel] [PATCH hci-8.2 v4 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD 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 ` [Devel] [PATCH hci-8.2 v4 0/4] drivers/vhost/blk: fix write zeroes errors, " Andrey Zhadchenko
2026-11-30 15:24 ` Konstantin Khorenko
2026-11-30 15:24 ` Konstantin Khorenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.