qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/6] block: add blk_io_plug_call() API


From: Stefano Garzarella
Subject: Re: [PATCH v2 1/6] block: add blk_io_plug_call() API
Date: Wed, 24 May 2023 10:08:18 +0200

On Tue, May 23, 2023 at 01:12:55PM -0400, Stefan Hajnoczi wrote:
Introduce a new API for thread-local blk_io_plug() that does not
traverse the block graph. The goal is to make blk_io_plug() multi-queue
friendly.

Instead of having block drivers track whether or not we're in a plugged
section, provide an API that allows them to defer a function call until
we're unplugged: blk_io_plug_call(fn, opaque). If blk_io_plug_call() is
called multiple times with the same fn/opaque pair, then fn() is only
called once at the end of the function - resulting in batching.

This patch introduces the API and changes blk_io_plug()/blk_io_unplug().
blk_io_plug()/blk_io_unplug() no longer require a BlockBackend argument
because the plug state is now thread-local.

Later patches convert block drivers to blk_io_plug_call() and then we
can finally remove .bdrv_co_io_plug() once all block drivers have been
converted.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
v2
- "is not be freed" -> "is not freed" [Eric]
---
MAINTAINERS                       |   1 +
include/sysemu/block-backend-io.h |  13 +--
block/block-backend.c             |  22 -----
block/plug.c                      | 159 ++++++++++++++++++++++++++++++
hw/block/dataplane/xen-block.c    |   8 +-
hw/block/virtio-blk.c             |   4 +-
hw/scsi/virtio-scsi.c             |   6 +-
block/meson.build                 |   1 +
8 files changed, 173 insertions(+), 41 deletions(-)
create mode 100644 block/plug.c

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]