* [PATCH v3 0/2] virtio_blk: add FUA write support
@ 2026-11-25 8:39 Alberto Faria
2026-11-25 8:39 ` [PATCH v3 1/2] virtio_blk: add fua " Alberto Faria
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alberto Faria @ 2026-11-25 8:39 UTC (permalink / raw)
To: linux-block
Cc: virtualization, Michael S. Tsirkin, Jens Axboe,
Eugenio Pérez, Paolo Bonzini, Stefan Hajnoczi, Xuan Zhuo,
Jason Wang, Alberto Faria
virtio-blk FUA write support has been added to the virtio spec [1]. This series
implements that by adding the new request flag uapi definitions and
corresponding virtio-blk support. It also enables vdpa_sim_blk to handle fua
writes.
[1] https://lore.kernel.org/virtio-comment/20251112055113.62207-1-afaria@redhat.com/
v2:
- Check for VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA when handling requests with REQ_FUA.
- Don't advertise FUA support on zoned devices.
- Restore BLK_FEAT_FUA in cache_type_store().
- vdpa_sim: Reject VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA without VIRTIO_BLK_F_REQ_FLAGS.
v3:
- (sashiko) virtio_blK: Check for both VIRTIO_BLK_F_REQ_FLAGS and
VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA when handling REQ_FUA.
- (sashiko) vdpa_sim: Fix possible ERR_PTR(0) return.
Alberto Faria (2):
virtio_blk: add fua write support
vdpa_sim_blk: add support for FUA writes
drivers/block/virtio_blk.c | 29 ++++++++++++++++++++++++++--
drivers/vdpa/vdpa_sim/vdpa_sim.c | 15 +++++++++++++-
drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 +
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 14 +++++++++++++-
include/uapi/linux/virtio_blk.h | 13 +++++++++++--
5 files changed, 66 insertions(+), 6 deletions(-)
--
2.56.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/2] virtio_blk: add fua write support
2026-11-25 8:39 [PATCH v3 0/2] virtio_blk: add FUA write support Alberto Faria
@ 2026-11-25 8:39 ` Alberto Faria
2026-11-25 9:07 ` Johannes Thumshirn
2026-11-25 9:09 ` Damien Le Moal
2026-11-25 8:39 ` [PATCH v3 2/2] vdpa_sim_blk: add support for FUA writes Alberto Faria
2026-11-25 8:48 ` [PATCH v3 0/2] virtio_blk: add FUA write support sashiko-bot
2 siblings, 2 replies; 7+ messages in thread
From: Alberto Faria @ 2026-11-25 8:39 UTC (permalink / raw)
To: linux-block
Cc: virtualization, Michael S. Tsirkin, Jens Axboe,
Eugenio Pérez, Paolo Bonzini, Stefan Hajnoczi, Xuan Zhuo,
Jason Wang, Alberto Faria
Add the new virtio-blk request FUA flag uapi definitions and
corresponding virtio-blk support.
Signed-off-by: Alberto Faria <afaria@redhat.com>
---
drivers/block/virtio_blk.c | 29 +++++++++++++++++++++++++++--
include/uapi/linux/virtio_blk.h | 13 +++++++++++--
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 2b462005cdb68..7ee2e6a6a591b 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -248,7 +248,10 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
return BLK_STS_NOTSUPP;
/* Set fields for all request types */
- vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
+ if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS))
+ vbr->out_hdr.flags = 0;
+ else
+ vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
switch (req_op(req)) {
case REQ_OP_READ:
@@ -258,6 +261,11 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
case REQ_OP_WRITE:
type = VIRTIO_BLK_T_OUT;
sector = blk_rq_pos(req);
+ if ((req->cmd_flags & REQ_FUA) &&
+ virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
+ virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA))
+ vbr->out_hdr.flags |= cpu_to_virtio32(vdev,
+ BIT(VIRTIO_BLK_REQ_FLAG_OUT_FUA));
break;
case REQ_OP_FLUSH:
type = VIRTIO_BLK_T_FLUSH;
@@ -1151,10 +1159,17 @@ cache_type_store(struct device *dev, struct device_attribute *attr,
virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
lim = queue_limits_start_update(disk->queue);
+
if (virtblk_get_cache_mode(vdev))
lim.features |= BLK_FEAT_WRITE_CACHE;
else
lim.features &= ~BLK_FEAT_WRITE_CACHE;
+
+ if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
+ virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA) &&
+ !(lim.features & BLK_FEAT_ZONED))
+ lim.features |= BLK_FEAT_FUA;
+
i = queue_limits_commit_update_frozen(disk->queue, &lim);
if (i)
return i;
@@ -1575,6 +1590,15 @@ static int virtblk_probe(struct virtio_device *vdev)
if (virtblk_get_cache_mode(vdev))
lim.features |= BLK_FEAT_WRITE_CACHE;
+ /*
+ * Do not advertise FUA when the device is zoned, since we
+ * would not be able to handle it on REQ_OP_ZONE_APPEND.
+ */
+ if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
+ virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA) &&
+ !(lim.features & BLK_FEAT_ZONED))
+ lim.features |= BLK_FEAT_FUA;
+
vblk->disk = blk_mq_alloc_disk(&vblk->tag_set, &lim, vblk);
if (IS_ERR(vblk->disk)) {
err = PTR_ERR(vblk->disk);
@@ -1740,7 +1764,8 @@ static unsigned int features[] = {
VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
- VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_ZONED,
+ VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_ZONED, VIRTIO_BLK_F_REQ_FLAGS,
+ VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA,
};
static struct virtio_driver virtio_blk = {
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index 3744e4da1b2a7..c5047e6a9a9bc 100644
--- a/include/uapi/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
@@ -42,6 +42,8 @@
#define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */
#define VIRTIO_BLK_F_SECURE_ERASE 16 /* Secure Erase is supported */
#define VIRTIO_BLK_F_ZONED 17 /* Zoned block device */
+#define VIRTIO_BLK_F_REQ_FLAGS 18 /* Request flags supported */
+#define VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA 19 /* FUA flag supported */
/* Legacy feature bits */
#ifndef VIRTIO_BLK_NO_LEGACY
@@ -211,6 +213,9 @@ struct virtio_blk_config {
#define VIRTIO_BLK_T_BARRIER 0x80000000
#endif /* !VIRTIO_BLK_NO_LEGACY */
+/* Request flag bits */
+#define VIRTIO_BLK_REQ_FLAG_OUT_FUA 0
+
/*
* This comes first in the read scatter-gather list.
* For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated,
@@ -219,8 +224,12 @@ struct virtio_blk_config {
struct virtio_blk_outhdr {
/* VIRTIO_BLK_T* */
__virtio32 type;
- /* io priority. */
- __virtio32 ioprio;
+ union {
+ /* io priority. */
+ __virtio32 ioprio;
+ /* Request flags. */
+ __virtio32 flags;
+ };
/* Sector (ie. 512 byte offset) */
__virtio64 sector;
};
--
2.56.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/2] vdpa_sim_blk: add support for FUA writes
2026-11-25 8:39 [PATCH v3 0/2] virtio_blk: add FUA write support Alberto Faria
2026-11-25 8:39 ` [PATCH v3 1/2] virtio_blk: add fua " Alberto Faria
@ 2026-11-25 8:39 ` Alberto Faria
2026-11-25 8:48 ` [PATCH v3 0/2] virtio_blk: add FUA write support sashiko-bot
2 siblings, 0 replies; 7+ messages in thread
From: Alberto Faria @ 2026-11-25 8:39 UTC (permalink / raw)
To: linux-block
Cc: virtualization, Michael S. Tsirkin, Jens Axboe,
Eugenio Pérez, Paolo Bonzini, Stefan Hajnoczi, Xuan Zhuo,
Jason Wang, Alberto Faria
Expose VIRTIO_BLK_F_REQ_FLAGS and VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA to
drivers. The simulator is a ramdisk, so it handles FUA and non-FUA
writes in the same way.
Signed-off-by: Alberto Faria <afaria@redhat.com>
---
drivers/vdpa/vdpa_sim/vdpa_sim.c | 15 ++++++++++++++-
drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 +
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 14 +++++++++++++-
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index 97d437d89524a..bec348d3dd7d1 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -198,7 +198,7 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr,
struct vdpa_device *vdpa;
struct vdpasim *vdpasim;
struct device *dev;
- int i, ret = -ENOMEM;
+ int i, ret = -ENOMEM, ret2;
if (!dev_attr->alloc_size)
return ERR_PTR(-EINVAL);
@@ -209,6 +209,12 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr,
if (config->device_features &
~dev_attr->supported_features)
return ERR_PTR(-EINVAL);
+ if (dev_attr->validate_features) {
+ ret2 = dev_attr->validate_features(
+ config->device_features);
+ if (ret2)
+ return ERR_PTR(ret2);
+ }
dev_attr->supported_features =
config->device_features;
}
@@ -442,11 +448,18 @@ static u64 vdpasim_get_backend_features(const struct vdpa_device *vdpa)
static int vdpasim_set_driver_features(struct vdpa_device *vdpa, u64 features)
{
struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
+ int ret;
/* DMA mapping must be done by driver */
if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM)))
return -EINVAL;
+ if (vdpasim->dev_attr.validate_features) {
+ ret = vdpasim->dev_attr.validate_features(features);
+ if (ret)
+ return ret;
+ }
+
vdpasim->features = features & vdpasim->dev_attr.supported_features;
return 0;
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h
index bb137e4797633..70890974b6e56 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.h
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h
@@ -45,6 +45,7 @@ struct vdpasim_dev_attr {
u32 nas;
void (*work_fn)(struct vdpasim *vdpasim);
+ int (*validate_features)(u64 features);
void (*get_config)(struct vdpasim *vdpasim, void *config);
void (*set_config)(struct vdpasim *vdpasim, const void *config);
int (*get_stats)(struct vdpasim *vdpasim, u16 idx,
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
index 4d3e36fb59d50..e0ed9eb729cf3 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
@@ -32,7 +32,9 @@
(1ULL << VIRTIO_BLK_F_TOPOLOGY) | \
(1ULL << VIRTIO_BLK_F_MQ) | \
(1ULL << VIRTIO_BLK_F_DISCARD) | \
- (1ULL << VIRTIO_BLK_F_WRITE_ZEROES))
+ (1ULL << VIRTIO_BLK_F_WRITE_ZEROES) | \
+ (1ULL << VIRTIO_BLK_F_REQ_FLAGS) | \
+ (1ULL << VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA))
#define VDPASIM_BLK_CAPACITY 0x40000
#define VDPASIM_BLK_SIZE_MAX 0x1000
@@ -371,6 +373,15 @@ static void vdpasim_blk_work(struct vdpasim *vdpasim)
vdpasim_schedule_work(vdpasim);
}
+static int vdpasim_blk_validate_features(u64 features)
+{
+ if ((features & BIT_ULL(VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA)) &&
+ !(features & BIT_ULL(VIRTIO_BLK_F_REQ_FLAGS)))
+ return -EINVAL;
+
+ return 0;
+}
+
static void vdpasim_blk_get_config(struct vdpasim *vdpasim, void *config)
{
struct virtio_blk_config *blk_config = config;
@@ -424,6 +435,7 @@ static int vdpasim_blk_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
dev_attr.nas = VDPASIM_BLK_AS_NUM;
dev_attr.alloc_size = sizeof(struct vdpasim_blk);
dev_attr.config_size = sizeof(struct virtio_blk_config);
+ dev_attr.validate_features = vdpasim_blk_validate_features;
dev_attr.get_config = vdpasim_blk_get_config;
dev_attr.work_fn = vdpasim_blk_work;
dev_attr.free = vdpasim_blk_free;
--
2.56.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/2] virtio_blk: add FUA write support
2026-11-25 8:39 [PATCH v3 0/2] virtio_blk: add FUA write support Alberto Faria
2026-11-25 8:39 ` [PATCH v3 1/2] virtio_blk: add fua " Alberto Faria
2026-11-25 8:39 ` [PATCH v3 2/2] vdpa_sim_blk: add support for FUA writes Alberto Faria
@ 2026-11-25 8:48 ` sashiko-bot
2 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-25 8:48 UTC (permalink / raw)
To: Alberto Faria; +Cc: virtualization, Michael S. Tsirkin, Eugenio Perez
Sashiko has reviewed this 2-patch series and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125083947.263216-1-afaria@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] virtio_blk: add fua write support
2026-11-25 8:39 ` [PATCH v3 1/2] virtio_blk: add fua " Alberto Faria
@ 2026-11-25 9:07 ` Johannes Thumshirn
2026-11-25 9:16 ` Alberto Faria
2026-11-25 9:09 ` Damien Le Moal
1 sibling, 1 reply; 7+ messages in thread
From: Johannes Thumshirn @ 2026-11-25 9:07 UTC (permalink / raw)
To: Alberto Faria, linux-block
Cc: virtualization, Michael S. Tsirkin, Jens Axboe,
Eugenio Pérez, Paolo Bonzini, Stefan Hajnoczi, Xuan Zhuo,
Jason Wang
On 11/25/26 9:39 AM, Alberto Faria wrote:
> + /*
> + * Do not advertise FUA when the device is zoned, since we
> + * would not be able to handle it on REQ_OP_ZONE_APPEND.
> + */
> + if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
> + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA) &&
> + !(lim.features & BLK_FEAT_ZONED))
> + lim.features |= BLK_FEAT_FUA;
> +
Can you elaborate why?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] virtio_blk: add fua write support
2026-11-25 8:39 ` [PATCH v3 1/2] virtio_blk: add fua " Alberto Faria
2026-11-25 9:07 ` Johannes Thumshirn
@ 2026-11-25 9:09 ` Damien Le Moal
1 sibling, 0 replies; 7+ messages in thread
From: Damien Le Moal @ 2026-11-25 9:09 UTC (permalink / raw)
To: Alberto Faria, linux-block
Cc: virtualization, Michael S. Tsirkin, Jens Axboe,
Eugenio Pérez, Paolo Bonzini, Stefan Hajnoczi, Xuan Zhuo,
Jason Wang
On 2026/11/25 17:39, Alberto Faria wrote:
> Add the new virtio-blk request FUA flag uapi definitions and
> corresponding virtio-blk support.
>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
> ---
> drivers/block/virtio_blk.c | 29 +++++++++++++++++++++++++++--
> include/uapi/linux/virtio_blk.h | 13 +++++++++++--
> 2 files changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 2b462005cdb68..7ee2e6a6a591b 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -248,7 +248,10 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
> return BLK_STS_NOTSUPP;
>
> /* Set fields for all request types */
> - vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
> + if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS))
> + vbr->out_hdr.flags = 0;
> + else
> + vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
>
> switch (req_op(req)) {
> case REQ_OP_READ:
> @@ -258,6 +261,11 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
> case REQ_OP_WRITE:
> type = VIRTIO_BLK_T_OUT;
> sector = blk_rq_pos(req);
> + if ((req->cmd_flags & REQ_FUA) &&
> + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
> + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA))
> + vbr->out_hdr.flags |= cpu_to_virtio32(vdev,
> + BIT(VIRTIO_BLK_REQ_FLAG_OUT_FUA));
> break;
> case REQ_OP_FLUSH:
> type = VIRTIO_BLK_T_FLUSH;
> @@ -1151,10 +1159,17 @@ cache_type_store(struct device *dev, struct device_attribute *attr,
> virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
>
> lim = queue_limits_start_update(disk->queue);
> +
White line change.
> if (virtblk_get_cache_mode(vdev))
> lim.features |= BLK_FEAT_WRITE_CACHE;
> else
> lim.features &= ~BLK_FEAT_WRITE_CACHE;
> +
> + if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
> + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA) &&
> + !(lim.features & BLK_FEAT_ZONED))
> + lim.features |= BLK_FEAT_FUA;
> +
> i = queue_limits_commit_update_frozen(disk->queue, &lim);
> if (i)
> return i;
> @@ -1575,6 +1590,15 @@ static int virtblk_probe(struct virtio_device *vdev)
> if (virtblk_get_cache_mode(vdev))
> lim.features |= BLK_FEAT_WRITE_CACHE;
>
> + /*
> + * Do not advertise FUA when the device is zoned, since we
> + * would not be able to handle it on REQ_OP_ZONE_APPEND.
> + */
Why is that? I do not see any reason for this.
> + if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
> + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA) &&
> + !(lim.features & BLK_FEAT_ZONED))
> + lim.features |= BLK_FEAT_FUA;
> +
> vblk->disk = blk_mq_alloc_disk(&vblk->tag_set, &lim, vblk);
> if (IS_ERR(vblk->disk)) {
> err = PTR_ERR(vblk->disk);
> @@ -1740,7 +1764,8 @@ static unsigned int features[] = {
> VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
> VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
> VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> - VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_ZONED,
> + VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_ZONED, VIRTIO_BLK_F_REQ_FLAGS,
> + VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA,
> };
>
> static struct virtio_driver virtio_blk = {
> diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
> index 3744e4da1b2a7..c5047e6a9a9bc 100644
> --- a/include/uapi/linux/virtio_blk.h
> +++ b/include/uapi/linux/virtio_blk.h
> @@ -42,6 +42,8 @@
> #define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */
> #define VIRTIO_BLK_F_SECURE_ERASE 16 /* Secure Erase is supported */
> #define VIRTIO_BLK_F_ZONED 17 /* Zoned block device */
> +#define VIRTIO_BLK_F_REQ_FLAGS 18 /* Request flags supported */
> +#define VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA 19 /* FUA flag supported */
>
> /* Legacy feature bits */
> #ifndef VIRTIO_BLK_NO_LEGACY
> @@ -211,6 +213,9 @@ struct virtio_blk_config {
> #define VIRTIO_BLK_T_BARRIER 0x80000000
> #endif /* !VIRTIO_BLK_NO_LEGACY */
>
> +/* Request flag bits */
> +#define VIRTIO_BLK_REQ_FLAG_OUT_FUA 0
> +
> /*
> * This comes first in the read scatter-gather list.
> * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated,
> @@ -219,8 +224,12 @@ struct virtio_blk_config {
> struct virtio_blk_outhdr {
> /* VIRTIO_BLK_T* */
> __virtio32 type;
> - /* io priority. */
> - __virtio32 ioprio;
> + union {
> + /* io priority. */
> + __virtio32 ioprio;
> + /* Request flags. */
> + __virtio32 flags;
> + };
> /* Sector (ie. 512 byte offset) */
> __virtio64 sector;
> };
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] virtio_blk: add fua write support
2026-11-25 9:07 ` Johannes Thumshirn
@ 2026-11-25 9:16 ` Alberto Faria
0 siblings, 0 replies; 7+ messages in thread
From: Alberto Faria @ 2026-11-25 9:16 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: linux-block, virtualization, Michael S. Tsirkin, Jens Axboe,
Eugenio Pérez, Paolo Bonzini, Stefan Hajnoczi, Xuan Zhuo,
Jason Wang, dlemoal
On Wed, Nov 25, 2026 at 9:07 AM Johannes Thumshirn
<johannes.thumshirn@wdc.com> wrote:
> On 11/25/26 9:39 AM, Alberto Faria wrote:
> > + /*
> > + * Do not advertise FUA when the device is zoned, since we
> > + * would not be able to handle it on REQ_OP_ZONE_APPEND.
> > + */
> > + if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS) &&
> > + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA) &&
> > + !(lim.features & BLK_FEAT_ZONED))
> > + lim.features |= BLK_FEAT_FUA;
> > +
>
> Can you elaborate why?
The virtio spec currently only defines FUA for OUT requests, so there
would be no way to pass on the REQ_FUA to the device on a zone append.
Alberto
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-25 9:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 8:39 [PATCH v3 0/2] virtio_blk: add FUA write support Alberto Faria
2026-11-25 8:39 ` [PATCH v3 1/2] virtio_blk: add fua " Alberto Faria
2026-11-25 9:07 ` Johannes Thumshirn
2026-11-25 9:16 ` Alberto Faria
2026-11-25 9:09 ` Damien Le Moal
2026-11-25 8:39 ` [PATCH v3 2/2] vdpa_sim_blk: add support for FUA writes Alberto Faria
2026-11-25 8:48 ` [PATCH v3 0/2] virtio_blk: add FUA write support sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox