Re: [PATCH v4] virtio-blk: Add support for "Force Unit Access" writes

Stefan Hajnoczi <[email protected]> Thu, 13 Nov 2025 10:55:57 -0500
Newsgroups dev.linux.lists.virtio-comment
Message-ID <20251113155557.GD189474@fedora>
On Wed, Nov 12, 2025 at 05:51:13AM +0000, Alberto Faria wrote:
> Add a VIRTIO_BLK_F_REQ_FLAGS feature bit converting the current
> `virtio_blk_req::reserved` field into a `flags` bit field, which can be
> used to modify the behavior of an entire request. The meaning of each
> bit depends on the request type.
> 
> Define a single VIRTIO_BLK_REQ_FLAG_OUT_FUA bit as signaling that a
> VIRTIO_BLK_T_OUT request should be a "Force Unit Access" (FUA) write,
> i.e., should become stable once the request completes. FUA writes enable
> better performance compared to the alternative of waiting for a write to
> complete and subsequently submitting a flush.
> 
> Also add a VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA feature bit indicating device
> support for the aforementioned FUA bit.
> 
> This approach allows for future expansion to other request-level flags
> and allows the same flag bit to be used for different purposes on
> different request types. The VIRTIO_BLK_F_REQ_FLAGS feature bit ensures
> compatibility with legacy devices/drivers that interpret the
> previously-`reserved` field as a priority indicator.
> 
> Signed-off-by: Alberto Faria <[email protected]>
> ---
> 
> v4:
> - Have the semantics of each request flag depend on the request type, as
>   suggested by Stefan.
> - Some other smaller rewordings suggested by Stefan.
> 
> v3:
> - Changed to a more future-proof approach somewhat similar to what was
>   suggested by Stefan.
> - Included a brief rationale for the introduction of FUA write requests,
>   as suggested by Michael.
> 
> v2:
> - Redefine VIRTIO_BLK_T_OUT_FUA to 27 since 15 is already in use.
> - Clarify that the cache mode has no impact on VIRTIO_BLK_T_OUT_FUA
>   semantics.
> - Allow drivers to negotiate VIRTIO_BLK_F_OUT_FUA even if they are
>   incapable of sending VIRTIO_BLK_T_OUT_FUA commands.
> 
>  device-types/blk/description.tex | 43 +++++++++++++++++++++++++++++---
>  1 file changed, 39 insertions(+), 4 deletions(-)

Reviewed-by: Stefan Hajnoczi <[email protected]>

Please see here on how to bring this issue to a vote:
https://github.com/oasis-tcs/virtio-spec/tree/master?tab=readme-ov-file#use-of-github-issues

Thanks,
Stefan
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmkV/40ACgkQnKSrs4Gr
c8gayggAnUjM5GEcHbUWb6GYAylqRbBXB3RhwBnafsqv7/mvMrBP1sN87rIHZqCB
t/GwE+yT+7t44A3huGLXNJNjueKxdIeF4zw6FA9xmyxWzZomLbdswZtImy+MeTBC
V8DYbagb9wSG5VKXWC1IOoxvcD290hvdtKlH9n1C21XsGKAmY59yCiFLenjuBmJE
cmPvS0MjTKfbMvwVcYO83yZ3yS8snKC/uu7eKl1emVlnJ7gozO3cDjlRg3Q7R/I8
LGF5Vb3mRqU9ZZIqJYD0QrI/sqvbSRb+zM/hn/KAyycKVLrhuYbXTsi5AM85FDNZ
XX2rOc3JPmGmxRPrOzPJldkVGjuF3Q==
=Qykw
-----END PGP SIGNATURE-----