From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id EF99280031 for ; Wed, 25 Nov 2026 14:23:12 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6APELped028354; Wed, 25 Nov 2026 17:21:51 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6APELped028354 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="x+yX2yZZ" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6APELnsV028332 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 25 Nov 2026 17:21:49 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6APELnsV028332 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c49df8fe86eso469948466b.2 for ; Wed, 25 Nov 2026 06:21:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFnWvW6zdQ4vPqa/fSwOpP0N8G3ZXVEagF2IK+EeXM6AeMzW3eyF0E3f+eGWtDmMrnwhnPZvw==@openvz.org X-Gm-Message-State: APuU4Z8EwTW32oOHJpUiiqSQiX4ZRMUDXTwCcy34vbRES0pFjPqusnr8 slbwHPvKgE7d7Fb4YWfZX8SYH3yVZgHt0+Xy0mXxO9b1JuMTaLvvbWvK+J+YLz7gJ1lB7h6v3Nx qQ9/IQzwsPbbmGeRUUIfcY+tCVDCPYS9TW58H/NjthF9DeVHUSd1B7Q== X-Gm-Gg: AZFdTZdhA2ZvyEXgF64dfM5VCsrpdV5DR0GNd/j3fVdJYSfGDBtemKn1pc+Er2vbb6V hiT8yyEAWVVLUGP6ImHj2j+8zJ6ndcyLXEZKGKt6BxbFIoFZoR/VGy/Mk34ozf/9KPdGefnuDj9 HYz/hvMZzKeoy9liju3OQ4E7jKP8wUZCV7eeSQNp9fOJaIRVO5l6N4LpSwvThUM0jWsRTWx/qHC mWVRUg9Wcv2RcmHmL91XbdNcEsulDh3ovyFUwvJhmL3aIauzrHUdCUs6AUjqUdJavC6bKjg3fqz N0Ta4oB9YzF0IPdhOK9zYuJMf3eLx9z0eBlt+m+OD4dsQdRMNx+3sM5oq32XzR8z9h3KPoj2mRA UAejNlevOCyPKilLZq0PMNfzx9es= X-Received: by 2002:a17:907:9903:b0:c49:cdc8:10cf with SMTP id a640c23a62f3a-c513ac754cbmr1120409566b.40.1795616509116; Wed, 25 Nov 2026 06:21:49 -0800 (PST) X-Received: by 2002:a17:907:9903:b0:c49:cdc8:10cf with SMTP id a640c23a62f3a-c513ac754cbmr1120407766b.40.1795616508545; Wed, 25 Nov 2026 06:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795616508; cv=none; d=google.com; s=arc-20260327; b=PqRMhQ4OP77uLqU+bKVd9CyujmKSfYl+0Na4BcETFHinG7P7CdYNTgU6gPrRNgZ7HO aejRm8vVm5cAgnx+nf8eAroNffb5CCf12D8tWnThMqrud16ZZohvYzGrFOW39WeQUREr L4uqTzeC2X+v+ytwZTOwm5MlwKJftCUlvRPPCubfYRvZ8ZEDtC2vxz/mT2Lc8lKC5WdJ raiTYSS2yzeXOAJ5c3zgqykKjNtwFS8J/CtZ7mUJyS3dRKmLJHKLwx3DFRYNP9GZ7lVG zZhwJxnCQc/0JMuwbzmRaQ2rd3se4NGbYrd5rT77vli2C7SjzbzbYaq+CCYUC84yhLBu hqPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=ASpqILGVJouXsypd8Q5uu3y1q7ksrMP7NKI5wQvopnI=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=NbfURypBIaN5WtZPpl1tJ++HSm/qx30ufVpxGpE1/Husjitta2bQwtStkrIKjPWSNr Phf3WNXOKuY2lSou1ZlR8aLPP0gfStzpCmeswAftOvPX2xWMYDAgpVx3IIanC9UYl84C OFrVCTK4n+eF1DLEwKBiT8AGKGp2fZ2HbWeL6G3ZcG/E9aP2u8Tuvb1pw5hr6i2b+lD1 Li3q4Xs1MmIjkpeDy1i6bYpbXHwe4BjE3KATtP+THR80faQtyr9w4tcWUEKcZ8UJU4As MGEG3v2peH26T2HWWDmIbiwTa9wKOPdvdpQkQFQj3vmIt7Co140O/1bQo1ojffsM77re Vlzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=x+yX2yZZ; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id a640c23a62f3a-c513b07a659si1151663666b.268.2026.11.25.06.21.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 06:21:48 -0800 (PST) Received-SPF: pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=x+yX2yZZ; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=ASpqILGVJouXsypd8Q5uu3y1q7ksrMP7NKI5wQvopnI=; b=x+yX2yZZEHWc k5P2Sjfn0nTH/XGshztJkLFc8sImFMSVAmQgaCQstXCJDEaoXhdlYyL1zDCvKdtJD3sOCaQ+T60o3 lAvBTUpBFE7o6OIv6MjXCyCvYIB9xz1xXHSx9mXWcGNu/agAWBfLgm0axn/8m6cDAJj0uty6N6SHZ 0FDKGUntaaHWiLCP7UhJzBuACi340Zl0EkN/NdZswG+66Ccti6/YpGKi6wxRqNvVdngNMlZ6ymWr7 nnuln7ps+MlCS/AabcnujztSQcvB22Uw9spG6CfzkjQWbY2or0N1x8bZNhMukqlj6GnnldRa4GkNv C3VK2y5CjlQLcZsT27QWmw==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xWDsO-009Fgm-1o; Wed, 25 Nov 2026 15:21:47 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Wed, 25 Nov 2026 15:21:41 +0100 Message-ID: <20261125142145.786278-1-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v4 0/4] drivers/vhost/blk: fix write zeroes errors, support VIRTIO_BLK_F_DISCARD X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org 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