[PATCH 0/5] block: move AioContext and AIOCB out of include/block/

Paolo Bonzini posted 5 patches 1 week, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251203185133.2458207-1-pbonzini@redhat.com
Maintainers: John Snow <jsnow@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Aarushi Mehta <mehta.aaru20@gmail.com>, Julia Suvorova <jusual@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Stefan Weil <sw@weilnetz.de>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Greg Kurz <groug@kaod.org>, Phil Dennis-Jordan <phil@philjordan.eu>, "Michael S. Tsirkin" <mst@redhat.com>, Eric Blake <eblake@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Alberto Garcia <berto@igalia.com>, "Alex Bennée" <alex.bennee@linaro.org>, Zhang Chen <zhangckid@gmail.com>, Li Zhijian <lizhijian@fujitsu.com>, Jason Wang <jasowang@redhat.com>, Markus Armbruster <armbru@redhat.com>, Michael Roth <michael.roth@amd.com>, Coiby Xu <Coiby.Xu@gmail.com>
MAINTAINERS                        |  4 ++--
docs/devel/multiple-iothreads.rst  |  4 ++--
fsdev/qemu-fsdev-throttle.h        |  1 -
include/block/block-copy.h         |  1 +
include/block/block-global-state.h |  2 ++
include/block/block-io.h           |  4 +++-
include/block/block_int-common.h   |  2 +-
include/block/dirty-bitmap.h       |  1 +
include/block/raw-aio.h            |  3 ++-
include/block/thread-pool.h        |  3 ++-
include/hw/char/serial.h           |  1 +
include/hw/core/qdev.h             |  6 +----
include/hw/ide/ide-dma.h           |  2 +-
include/hw/scsi/scsi.h             |  3 ++-
include/hw/virtio/virtio.h         |  2 +-
include/io/channel.h               |  2 +-
include/{block => qemu}/aio-wait.h |  2 +-
include/{block => qemu}/aio.h      | 28 +++-------------------
include/qemu/aiocb.h               | 38 ++++++++++++++++++++++++++++++
include/qemu/job.h                 |  4 +++-
include/qemu/main-loop.h           |  4 ++--
include/qemu/mem-reentrancy.h      | 10 ++++++++
include/qemu/throttle.h            |  1 +
include/scsi/pr-manager.h          |  2 +-
include/system/event-loop-base.h   |  2 +-
include/system/iothread.h          |  2 +-
include/system/replay.h            |  2 +-
tests/unit/iothread.h              |  2 +-
util/aio-posix.h                   |  2 +-
block/aio_task.c                   |  2 +-
block/export/fuse.c                |  2 +-
block/io.c                         |  2 +-
block/io_uring.c                   |  2 +-
block/linux-aio.c                  |  2 +-
block/win32-aio.c                  |  3 ++-
blockjob.c                         |  2 +-
hw/core/ptimer.c                   |  1 -
hw/misc/i2c-echo.c                 |  1 -
hw/virtio/iothread-vq-mapping.c    |  1 +
hw/virtio/virtio-pmem.c            |  1 -
io/channel.c                       |  2 +-
iothread.c                         |  2 +-
job.c                              |  2 +-
net/colo-compare.c                 |  2 +-
net/filter-mirror.c                |  2 +-
net/net.c                          |  1 +
qapi/qmp-dispatch.c                |  2 +-
replay/replay-events.c             |  2 +-
scsi/pr-manager.c                  |  2 +-
scsi/qemu-pr-helper.c              |  1 -
stubs/linux-aio.c                  |  2 +-
stubs/replay-tools.c               |  2 +-
tests/unit/iothread.c              |  2 +-
tests/unit/test-aio-multithread.c  |  2 +-
tests/unit/test-aio.c              |  2 +-
tests/unit/test-nested-aio-poll.c  |  2 +-
tests/unit/test-thread-pool.c      |  3 ++-
tests/unit/test-throttle.c         |  2 +-
ui/input-linux.c                   |  1 -
ui/vnc-jobs.c                      |  1 -
util/aio-wait.c                    |  2 +-
util/aiocb.c                       |  2 +-
util/async.c                       |  3 ++-
util/main-loop.c                   |  2 +-
util/qemu-co-timeout.c             |  2 +-
util/qemu-coroutine-lock.c         |  2 +-
util/qemu-coroutine-sleep.c        |  2 +-
util/qemu-coroutine.c              |  2 +-
util/throttle.c                    |  2 +-
util/vhost-user-server.c           |  2 +-
hw/display/apple-gfx-mmio.m        |  2 +-
hw/display/apple-gfx.m             |  2 +-
scripts/analyze-inclusions         |  2 +-
73 files changed, 128 insertions(+), 95 deletions(-)
rename include/{block => qemu}/aio-wait.h (99%)
rename include/{block => qemu}/aio.h (97%)
create mode 100644 include/qemu/aiocb.h
create mode 100644 include/qemu/mem-reentrancy.h
[PATCH 0/5] block: move AioContext and AIOCB out of include/block/
Posted by Paolo Bonzini 1 week, 3 days ago
Split include/block/aio.h into qemu/aiocb.h and qemu/aio.h,
and reduce the amount of included files from outside include/qemu/
for consistency with the implementation's placement in util/.

While Kevin originally suggested moving AIOCB declarations to
block-common.h, the functions are implemented in util/aiocb.c
and outside the block layer too, for example in the thread pool
(see thread_pool_submit_aio which is used in places such as 9pfs,
TPM backends or hw/virtio/virtio-pmem.c).  So, do keep a separate
small header but call it util/aiocb.h---not block/aio.h.

Compared to the previous attempt, this introduces another teeny tiny
header qemu/mem-reentrancy.h, which is used to avoid including
hw/core/qdev.h

Also for consistency, move block/aio-wait.h to qemu/aio-wait.h;
it is effectively part of the main event loop implementation, not
the block layer.

Paolo

Based-on: <20251127131516.80807-1-pbonzini@redhat.com>
Supersedes: <20251128101555.227630-1-pbonzini@redhat.com>

Paolo Bonzini (5):
  hw: add missing includes hidden by block/aio.h
  block: extract include/qemu/aiocb.h out of include/block/aio.h
  block: reduce files included by block/aio.h
  block: rename block/aio.h to qemu/aio.h
  block: rename block/aio-wait.h to qemu/aio-wait.h

 MAINTAINERS                        |  4 ++--
 docs/devel/multiple-iothreads.rst  |  4 ++--
 fsdev/qemu-fsdev-throttle.h        |  1 -
 include/block/block-copy.h         |  1 +
 include/block/block-global-state.h |  2 ++
 include/block/block-io.h           |  4 +++-
 include/block/block_int-common.h   |  2 +-
 include/block/dirty-bitmap.h       |  1 +
 include/block/raw-aio.h            |  3 ++-
 include/block/thread-pool.h        |  3 ++-
 include/hw/char/serial.h           |  1 +
 include/hw/core/qdev.h             |  6 +----
 include/hw/ide/ide-dma.h           |  2 +-
 include/hw/scsi/scsi.h             |  3 ++-
 include/hw/virtio/virtio.h         |  2 +-
 include/io/channel.h               |  2 +-
 include/{block => qemu}/aio-wait.h |  2 +-
 include/{block => qemu}/aio.h      | 28 +++-------------------
 include/qemu/aiocb.h               | 38 ++++++++++++++++++++++++++++++
 include/qemu/job.h                 |  4 +++-
 include/qemu/main-loop.h           |  4 ++--
 include/qemu/mem-reentrancy.h      | 10 ++++++++
 include/qemu/throttle.h            |  1 +
 include/scsi/pr-manager.h          |  2 +-
 include/system/event-loop-base.h   |  2 +-
 include/system/iothread.h          |  2 +-
 include/system/replay.h            |  2 +-
 tests/unit/iothread.h              |  2 +-
 util/aio-posix.h                   |  2 +-
 block/aio_task.c                   |  2 +-
 block/export/fuse.c                |  2 +-
 block/io.c                         |  2 +-
 block/io_uring.c                   |  2 +-
 block/linux-aio.c                  |  2 +-
 block/win32-aio.c                  |  3 ++-
 blockjob.c                         |  2 +-
 hw/core/ptimer.c                   |  1 -
 hw/misc/i2c-echo.c                 |  1 -
 hw/virtio/iothread-vq-mapping.c    |  1 +
 hw/virtio/virtio-pmem.c            |  1 -
 io/channel.c                       |  2 +-
 iothread.c                         |  2 +-
 job.c                              |  2 +-
 net/colo-compare.c                 |  2 +-
 net/filter-mirror.c                |  2 +-
 net/net.c                          |  1 +
 qapi/qmp-dispatch.c                |  2 +-
 replay/replay-events.c             |  2 +-
 scsi/pr-manager.c                  |  2 +-
 scsi/qemu-pr-helper.c              |  1 -
 stubs/linux-aio.c                  |  2 +-
 stubs/replay-tools.c               |  2 +-
 tests/unit/iothread.c              |  2 +-
 tests/unit/test-aio-multithread.c  |  2 +-
 tests/unit/test-aio.c              |  2 +-
 tests/unit/test-nested-aio-poll.c  |  2 +-
 tests/unit/test-thread-pool.c      |  3 ++-
 tests/unit/test-throttle.c         |  2 +-
 ui/input-linux.c                   |  1 -
 ui/vnc-jobs.c                      |  1 -
 util/aio-wait.c                    |  2 +-
 util/aiocb.c                       |  2 +-
 util/async.c                       |  3 ++-
 util/main-loop.c                   |  2 +-
 util/qemu-co-timeout.c             |  2 +-
 util/qemu-coroutine-lock.c         |  2 +-
 util/qemu-coroutine-sleep.c        |  2 +-
 util/qemu-coroutine.c              |  2 +-
 util/throttle.c                    |  2 +-
 util/vhost-user-server.c           |  2 +-
 hw/display/apple-gfx-mmio.m        |  2 +-
 hw/display/apple-gfx.m             |  2 +-
 scripts/analyze-inclusions         |  2 +-
 73 files changed, 128 insertions(+), 95 deletions(-)
 rename include/{block => qemu}/aio-wait.h (99%)
 rename include/{block => qemu}/aio.h (97%)
 create mode 100644 include/qemu/aiocb.h
 create mode 100644 include/qemu/mem-reentrancy.h

-- 
2.52.0