* [PATCH] block: remove unused BLOCK_OP_TYPE_DATAPLANE
@ 2025-02-03 18:25 Stefan Hajnoczi
2025-02-03 19:53 ` Eric Blake
2025-02-06 13:56 ` Kevin Wolf
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2025-02-03 18:25 UTC (permalink / raw)
To: qemu-block, qemu-devel
Cc: Stefan Hajnoczi, Paolo Bonzini, Fam Zheng,
Vladimir Sementsov-Ogievskiy, Kevin Wolf, Wen Congyang, John Snow,
Michael S. Tsirkin, Xie Changlong, Hanna Reitz
BLOCK_OP_TYPE_DATAPLANE prevents BlockDriverState from being used by
virtio-blk/virtio-scsi with IOThread. Commit b112a65c52aa ("block:
declare blockjobs and dataplane friends!") eliminated the main reason
for this blocker in 2014.
Nowadays the block layer supports I/O from multiple AioContexts, so
there is even less reason to block IOThread users. Any legitimate
reasons related to interference would probably also apply to
non-IOThread users.
The only remaining users are bdrv_op_unblock(BLOCK_OP_TYPE_DATAPLANE)
calls after bdrv_op_block_all(). If we remove BLOCK_OP_TYPE_DATAPLANE
their behavior doesn't change.
Existing bdrv_op_block_all() callers that don't explicitly unblock
BLOCK_OP_TYPE_DATAPLANE seem to do so simply because no one bothered to
rather than because it is necessary to keep BLOCK_OP_TYPE_DATAPLANE
blocked.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/block/block-common.h | 1 -
block/replication.c | 1 -
blockjob.c | 2 --
hw/block/virtio-blk.c | 9 ---------
hw/scsi/virtio-scsi.c | 3 ---
5 files changed, 16 deletions(-)
diff --git a/include/block/block-common.h b/include/block/block-common.h
index 338fe5ff7a..2b0aae5bc9 100644
--- a/include/block/block-common.h
+++ b/include/block/block-common.h
@@ -355,7 +355,6 @@ typedef enum BlockOpType {
BLOCK_OP_TYPE_CHANGE,
BLOCK_OP_TYPE_COMMIT_SOURCE,
BLOCK_OP_TYPE_COMMIT_TARGET,
- BLOCK_OP_TYPE_DATAPLANE,
BLOCK_OP_TYPE_DRIVE_DEL,
BLOCK_OP_TYPE_EJECT,
BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
diff --git a/block/replication.c b/block/replication.c
index 2ce16f0589..d4d677a902 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -576,7 +576,6 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
return;
}
bdrv_op_block_all(top_bs, s->blocker);
- bdrv_op_unblock(top_bs, BLOCK_OP_TYPE_DATAPLANE, s->blocker);
bdrv_graph_wrunlock();
diff --git a/blockjob.c b/blockjob.c
index e94a840d7f..32007f31a9 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -539,8 +539,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
goto fail;
}
- bdrv_op_unblock(bs, BLOCK_OP_TYPE_DATAPLANE, job->blocker);
-
if (!block_job_set_speed(job, speed, errp)) {
goto fail;
}
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index e0acce89e1..a1829e3abd 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1562,15 +1562,6 @@ static bool virtio_blk_vq_aio_context_init(VirtIOBlock *s, Error **errp)
error_setg(errp, "ioeventfd is required for iothread");
return false;
}
-
- /*
- * If ioeventfd is (re-)enabled while the guest is running there could
- * be block jobs that can conflict.
- */
- if (blk_op_is_blocked(conf->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
- error_prepend(errp, "cannot start virtio-blk ioeventfd: ");
- return false;
- }
}
s->vq_aio_context = g_new(AioContext *, conf->num_queues);
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 23516995dc..7d094e1881 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -1065,9 +1065,6 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
int ret;
if (s->ctx && !s->dataplane_fenced) {
- if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
- return;
- }
ret = blk_set_aio_context(sd->conf.blk, s->ctx, errp);
if (ret < 0) {
return;
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: remove unused BLOCK_OP_TYPE_DATAPLANE
2025-02-03 18:25 [PATCH] block: remove unused BLOCK_OP_TYPE_DATAPLANE Stefan Hajnoczi
@ 2025-02-03 19:53 ` Eric Blake
2025-02-06 13:56 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2025-02-03 19:53 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-block, qemu-devel, Paolo Bonzini, Fam Zheng,
Vladimir Sementsov-Ogievskiy, Kevin Wolf, Wen Congyang, John Snow,
Michael S. Tsirkin, Xie Changlong, Hanna Reitz
On Mon, Feb 03, 2025 at 01:25:29PM -0500, Stefan Hajnoczi wrote:
> BLOCK_OP_TYPE_DATAPLANE prevents BlockDriverState from being used by
> virtio-blk/virtio-scsi with IOThread. Commit b112a65c52aa ("block:
> declare blockjobs and dataplane friends!") eliminated the main reason
> for this blocker in 2014.
Wow, that's a long time.
>
> Nowadays the block layer supports I/O from multiple AioContexts, so
> there is even less reason to block IOThread users. Any legitimate
> reasons related to interference would probably also apply to
> non-IOThread users.
>
> The only remaining users are bdrv_op_unblock(BLOCK_OP_TYPE_DATAPLANE)
> calls after bdrv_op_block_all(). If we remove BLOCK_OP_TYPE_DATAPLANE
> their behavior doesn't change.
>
> Existing bdrv_op_block_all() callers that don't explicitly unblock
> BLOCK_OP_TYPE_DATAPLANE seem to do so simply because no one bothered to
> rather than because it is necessary to keep BLOCK_OP_TYPE_DATAPLANE
> blocked.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> include/block/block-common.h | 1 -
> block/replication.c | 1 -
> blockjob.c | 2 --
> hw/block/virtio-blk.c | 9 ---------
> hw/scsi/virtio-scsi.c | 3 ---
> 5 files changed, 16 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: remove unused BLOCK_OP_TYPE_DATAPLANE
2025-02-03 18:25 [PATCH] block: remove unused BLOCK_OP_TYPE_DATAPLANE Stefan Hajnoczi
2025-02-03 19:53 ` Eric Blake
@ 2025-02-06 13:56 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2025-02-06 13:56 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-block, qemu-devel, Paolo Bonzini, Fam Zheng,
Vladimir Sementsov-Ogievskiy, Wen Congyang, John Snow,
Michael S. Tsirkin, Xie Changlong, Hanna Reitz
Am 03.02.2025 um 19:25 hat Stefan Hajnoczi geschrieben:
> BLOCK_OP_TYPE_DATAPLANE prevents BlockDriverState from being used by
> virtio-blk/virtio-scsi with IOThread. Commit b112a65c52aa ("block:
> declare blockjobs and dataplane friends!") eliminated the main reason
> for this blocker in 2014.
>
> Nowadays the block layer supports I/O from multiple AioContexts, so
> there is even less reason to block IOThread users. Any legitimate
> reasons related to interference would probably also apply to
> non-IOThread users.
>
> The only remaining users are bdrv_op_unblock(BLOCK_OP_TYPE_DATAPLANE)
> calls after bdrv_op_block_all(). If we remove BLOCK_OP_TYPE_DATAPLANE
> their behavior doesn't change.
>
> Existing bdrv_op_block_all() callers that don't explicitly unblock
> BLOCK_OP_TYPE_DATAPLANE seem to do so simply because no one bothered to
> rather than because it is necessary to keep BLOCK_OP_TYPE_DATAPLANE
> blocked.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Thanks, applied to the block branch.
I've actually had pretty much the same patch lying around for.. *checks*
five years, but never sent it because I intended it to be part of a more
general op blocker removal series. I don't think we actually rely on any
of them any more, but proving it was still hard when I tried.
One additional part my patch had is removing blk_op_is_blocked() because
it's now unused. I'll send this as a separate patch.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-06 13:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 18:25 [PATCH] block: remove unused BLOCK_OP_TYPE_DATAPLANE Stefan Hajnoczi
2025-02-03 19:53 ` Eric Blake
2025-02-06 13:56 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).