diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2023-09-13 16:00:43 -0400 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-10-31 15:41:42 +0100 |
commit | 433fcea40c31ff355f84da22a46977c2a1b596c3 (patch) | |
tree | 47a995db30935c88634c46402b26d736a10d8b73 /hw/block | |
parent | ccee48aa736b97f0ce4ab04ad41815f0e575d526 (diff) | |
download | qemu-433fcea40c31ff355f84da22a46977c2a1b596c3.zip qemu-433fcea40c31ff355f84da22a46977c2a1b596c3.tar.gz qemu-433fcea40c31ff355f84da22a46977c2a1b596c3.tar.bz2 |
util/defer-call: move defer_call() to util/
The networking subsystem may wish to use defer_call(), so move the code
to util/ where it can be reused.
As a reminder of what defer_call() does:
This API defers a function call within a defer_call_begin()/defer_call_end()
section, allowing multiple calls to batch up. This is a performance
optimization that is used in the block layer to submit several I/O requests
at once instead of individually:
defer_call_begin(); <-- start of section
...
defer_call(my_func, my_obj); <-- deferred my_func(my_obj) call
defer_call(my_func, my_obj); <-- another
defer_call(my_func, my_obj); <-- another
...
defer_call_end(); <-- end of section, my_func(my_obj) is called once
Suggested-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230913200045.1024233-3-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/dataplane/xen-block.c | 1 | ||||
-rw-r--r-- | hw/block/virtio-blk.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index e9dd8f8..c4bb28c 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qemu/defer-call.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/memalign.h" diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 6a45033..a1f8e15 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qemu/defer-call.h" #include "qapi/error.h" #include "qemu/iov.h" #include "qemu/module.h" |