Browse Source
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>pull/256/head
committed by
Kevin Wolf
13 changed files with 27 additions and 7 deletions
@ -0,0 +1,16 @@ |
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|||
/*
|
|||
* Deferred calls |
|||
* |
|||
* Copyright Red Hat. |
|||
*/ |
|||
|
|||
#ifndef QEMU_DEFER_CALL_H |
|||
#define QEMU_DEFER_CALL_H |
|||
|
|||
/* See documentation in util/defer-call.c */ |
|||
void defer_call_begin(void); |
|||
void defer_call_end(void); |
|||
void defer_call(void (*fn)(void *), void *opaque); |
|||
|
|||
#endif /* QEMU_DEFER_CALL_H */ |
|||
Loading…
Reference in new issue