[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 02/25] include/block/block: split header into I/O and glob
From: |
Eric Blake |
Subject: |
Re: [PATCH v3 02/25] include/block/block: split header into I/O and global state API |
Date: |
Thu, 14 Oct 2021 15:31:30 -0500 |
User-agent: |
NeoMutt/20210205-854-613e2c |
On Tue, Oct 12, 2021 at 04:48:43AM -0400, Emanuele Giuseppe Esposito wrote:
> block.h currently contains a mix of functions:
> some of them run under the BQL and modify the block layer graph,
> others are instead thread-safe and perform I/O in iothreads.
> It is not easy to understand which function is part of which
> group (I/O vs GS), and this patch aims to clarify it.
>
> The "GS" functions need the BQL, and often use
> aio_context_acquire/release and/or drain to be sure they
> can modify the graph safely.
> The I/O function are instead thread safe, and can run in
> any AioContext.
>
> By splitting the header in two files, block-io.h
> and block-global-state.h we have a clearer view on what
> needs what kind of protection. block-common.h
> instead contains common structures shared by both headers.
s/instead //
>
> block.h is left there for legacy and to avoid changing
> all includes in all c files that use the block APIs.
>
> Assertions are added in the next patch.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> diff --git a/include/block/block-common.h b/include/block/block-common.h
> new file mode 100644
> index 0000000000..4f1fd8de21
> --- /dev/null
> +++ b/include/block/block-common.h
> @@ -0,0 +1,389 @@
> +#ifndef BLOCK_COMMON_H
> +#define BLOCK_COMMON_H
As a new file, it probably deserves a copyright/license blurb copied
from the file it is split out of.
> diff --git a/include/block/block-global-state.h
> b/include/block/block-global-state.h
> new file mode 100644
> index 0000000000..b57e275da9
> --- /dev/null
> +++ b/include/block/block-global-state.h
> @@ -0,0 +1,263 @@
> +#ifndef BLOCK_GLOBAL_STATE_H
> +#define BLOCK_GLOBAL_STATE_H
Likewise, here and in all other newly-split files in your series.
> +++ b/include/block/block.h
> @@ -1,864 +1,9 @@
> #ifndef BLOCK_H
> #define BLOCK_H
Oh. There wasn't one to copy from :( Well, now's as good a time to fix
that as any.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v3 00/25] block layer: split block APIs in global state and I/O, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 01/25] main-loop.h: introduce qemu_in_main_thread(), Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 02/25] include/block/block: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 03/25] assertions for block global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 05/25] block/block-backend.c: assertions for block-backend, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 04/25] include/sysemu/block-backend: split header into I/O and global state (GS) API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 06/25] include/block/block_int: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 07/25] assertions for block_int global state API, Emanuele Giuseppe Esposito, 2021/10/12
- [PATCH v3 08/25] block: introduce assert_bdrv_graph_writable, Emanuele Giuseppe Esposito, 2021/10/12