From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 v3 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD
Date: Wed, 25 Nov 2026 12:56:59 +0100 [thread overview]
Message-ID: <20261125115703.741517-1-alexander.ivanov@virtuozzo.com> (raw)
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
next reply other threads:[~2026-11-25 11:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:56 Alexander Ivanov [this message]
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
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=20261125115703.741517-1-alexander.ivanov@virtuozzo.com \
--to=alexander.ivanov@virtuozzo.com \
--cc=andrey.zhadchenko@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 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.