block/linux-aio: convert to blk_io_plug_call() API
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 30 May 2023 18:09:58 +0000 (14:09 -0400)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 1 Jun 2023 11:34:03 +0000 (07:34 -0400)
commit076682885d6fe521ed005b988fde6a67ec6818df
tree9b1e887119f0f3aff92f0fb2dccff8235bdf1730
parent6a6da231b7076b8ed5409c4745e11cb14d962194
block/linux-aio: convert to blk_io_plug_call() API

Stop using the .bdrv_co_io_plug() API because it is not multi-queue
block layer friendly. Use the new blk_io_plug_call() API to batch I/O
submission instead.

Note that a dev_max_batch check is dropped in laio_io_unplug() because
the semantics of unplug_fn() are different from .bdrv_co_unplug():
1. unplug_fn() is only called when the last blk_io_unplug() call occurs,
   not every time blk_io_unplug() is called.
2. unplug_fn() is per-thread, not per-BlockDriverState, so there is no
   way to get per-BlockDriverState fields like dev_max_batch.

Therefore this condition cannot be moved to laio_unplug_fn(). It is not
obvious that this condition affects performance in practice, so I am
removing it instead of trying to come up with a more complex mechanism
to preserve the condition.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20230530180959.1108766-6-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/file-posix.c
block/linux-aio.c
include/block/raw-aio.h