virtio-blk: move dataplane code into virtio-blk.c

The dataplane code used to be significantly different from the
non-dataplane code and therefore had a separate source file.

Over time the difference has gotten smaller because the I/O code paths
were unified. Nowadays the distinction between the VirtIOBlock and
VirtIOBlockDataPlane structs is more of an inconvenience that hinders
code simplification.

Move hw/block/dataplane/virtio-blk.c into hw/block/virtio-blk.c, merging
VirtIOBlockDataPlane's fields into VirtIOBlock.

hw/block/virtio-blk.c used VirtIOBlock->dataplane to check if
virtio_blk_data_plane_create() was successful. This is not necessary
because ->dataplane_started and ->dataplane_disabled can be used
instead. This patch makes those changes in order to drop
VirtIOBlock->dataplane.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240119135748.270944-2-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2024-01-19 08:57:43 -05:00 committed by Kevin Wolf
parent effd60c878
commit 3bcc17f065
8 changed files with 357 additions and 463 deletions

View file

@ -50,8 +50,6 @@ struct VirtIOBlkConf
bool x_enable_wce_if_config_wce;
};
struct VirtIOBlockDataPlane;
struct VirtIOBlockReq;
struct VirtIOBlock {
VirtIODevice parent_obj;
@ -64,7 +62,15 @@ struct VirtIOBlock {
VMChangeStateEntry *change;
bool dataplane_disabled;
bool dataplane_started;
struct VirtIOBlockDataPlane *dataplane;
bool dataplane_starting;
bool dataplane_stopping;
/*
* The AioContext for each virtqueue. The BlockDriverState will use the
* first element as its AioContext.
*/
AioContext **vq_aio_context;
uint64_t host_features;
size_t config_size;
BlockRAMRegistrar blk_ram_registrar;