[PATCH] io_uring: move LuringState typedef to block/aio.h

Paolo Bonzini posted 1 patch 4 years, 7 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210712131030.465621-1-pbonzini@redhat.com
Maintainers: Julia Suvorova <jusual@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>, Fam Zheng <fam@euphon.net>, Stefan Hajnoczi <stefanha@redhat.com>, Aarushi Mehta <mehta.aaru20@gmail.com>
block/io_uring.c        | 4 ++--
include/block/aio.h     | 8 ++++----
include/block/raw-aio.h | 1 -
3 files changed, 6 insertions(+), 7 deletions(-)
[PATCH] io_uring: move LuringState typedef to block/aio.h
Posted by Paolo Bonzini 4 years, 7 months ago
The LuringState typedef is defined twice, in include/block/raw-aio.h and
block/io_uring.c.  Move it in include/block/aio.h, which is included
everywhere the typedef is needed, since include/block/aio.h already has
to define the forward reference to the struct.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/io_uring.c        | 4 ++--
 include/block/aio.h     | 8 ++++----
 include/block/raw-aio.h | 1 -
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/block/io_uring.c b/block/io_uring.c
index 00a3ee9fb8..aa856a4c5d 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -46,7 +46,7 @@ typedef struct LuringQueue {
     QSIMPLEQ_HEAD(, LuringAIOCB) submit_queue;
 } LuringQueue;
 
-typedef struct LuringState {
+struct LuringState {
     AioContext *aio_context;
 
     struct io_uring ring;
@@ -56,7 +56,7 @@ typedef struct LuringState {
 
     /* I/O completion processing.  Only runs in I/O thread.  */
     QEMUBH *completion_bh;
-} LuringState;
+};
 
 /**
  * luring_resubmit:
diff --git a/include/block/aio.h b/include/block/aio.h
index 807edce9b5..8e2e4fe10f 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -54,7 +54,7 @@ typedef void IOHandler(void *opaque);
 struct Coroutine;
 struct ThreadPool;
 struct LinuxAioState;
-struct LuringState;
+typedef struct LuringState LuringState;
 
 /* Is polling disabled? */
 bool aio_poll_disabled(AioContext *ctx);
@@ -209,7 +209,7 @@ struct AioContext {
      * State for Linux io_uring.  Uses aio_context_acquire/release for
      * locking.
      */
-    struct LuringState *linux_io_uring;
+    LuringState *linux_io_uring;
 
     /* State for file descriptor monitoring using Linux io_uring */
     struct io_uring fdmon_io_uring;
@@ -513,10 +513,10 @@ struct LinuxAioState *aio_setup_linux_aio(AioContext *ctx, Error **errp);
 struct LinuxAioState *aio_get_linux_aio(AioContext *ctx);
 
 /* Setup the LuringState bound to this AioContext */
-struct LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp);
+LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp);
 
 /* Return the LuringState bound to this AioContext */
-struct LuringState *aio_get_linux_io_uring(AioContext *ctx);
+LuringState *aio_get_linux_io_uring(AioContext *ctx);
 /**
  * aio_timer_new_with_attrs:
  * @ctx: the aio context
diff --git a/include/block/raw-aio.h b/include/block/raw-aio.h
index 251b10d273..af0ea0fba4 100644
--- a/include/block/raw-aio.h
+++ b/include/block/raw-aio.h
@@ -59,7 +59,6 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s);
 #endif
 /* io_uring.c - Linux io_uring implementation */
 #ifdef CONFIG_LINUX_IO_URING
-typedef struct LuringState LuringState;
 LuringState *luring_init(Error **errp);
 void luring_cleanup(LuringState *s);
 int coroutine_fn luring_co_submit(BlockDriverState *bs, LuringState *s, int fd,
-- 
2.31.1


Re: [PATCH] io_uring: move LuringState typedef to block/aio.h
Posted by Philippe Mathieu-Daudé 4 years, 7 months ago
On 7/12/21 3:10 PM, Paolo Bonzini wrote:
> The LuringState typedef is defined twice, in include/block/raw-aio.h and
> block/io_uring.c.  Move it in include/block/aio.h, which is included
> everywhere the typedef is needed, since include/block/aio.h already has
> to define the forward reference to the struct.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/io_uring.c        | 4 ++--
>  include/block/aio.h     | 8 ++++----
>  include/block/raw-aio.h | 1 -
>  3 files changed, 6 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Re: [PATCH] io_uring: move LuringState typedef to block/aio.h
Posted by Pankaj Gupta 4 years, 7 months ago
> The LuringState typedef is defined twice, in include/block/raw-aio.h and
> block/io_uring.c.  Move it in include/block/aio.h, which is included
> everywhere the typedef is needed, since include/block/aio.h already has
> to define the forward reference to the struct.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/io_uring.c        | 4 ++--
>  include/block/aio.h     | 8 ++++----
>  include/block/raw-aio.h | 1 -
>  3 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/block/io_uring.c b/block/io_uring.c
> index 00a3ee9fb8..aa856a4c5d 100644
> --- a/block/io_uring.c
> +++ b/block/io_uring.c
> @@ -46,7 +46,7 @@ typedef struct LuringQueue {
>      QSIMPLEQ_HEAD(, LuringAIOCB) submit_queue;
>  } LuringQueue;
>
> -typedef struct LuringState {
> +struct LuringState {
>      AioContext *aio_context;
>
>      struct io_uring ring;
> @@ -56,7 +56,7 @@ typedef struct LuringState {
>
>      /* I/O completion processing.  Only runs in I/O thread.  */
>      QEMUBH *completion_bh;
> -} LuringState;
> +};
>
>  /**
>   * luring_resubmit:
> diff --git a/include/block/aio.h b/include/block/aio.h
> index 807edce9b5..8e2e4fe10f 100644
> --- a/include/block/aio.h
> +++ b/include/block/aio.h
> @@ -54,7 +54,7 @@ typedef void IOHandler(void *opaque);
>  struct Coroutine;
>  struct ThreadPool;
>  struct LinuxAioState;
> -struct LuringState;
> +typedef struct LuringState LuringState;
>
>  /* Is polling disabled? */
>  bool aio_poll_disabled(AioContext *ctx);
> @@ -209,7 +209,7 @@ struct AioContext {
>       * State for Linux io_uring.  Uses aio_context_acquire/release for
>       * locking.
>       */
> -    struct LuringState *linux_io_uring;
> +    LuringState *linux_io_uring;
>
>      /* State for file descriptor monitoring using Linux io_uring */
>      struct io_uring fdmon_io_uring;
> @@ -513,10 +513,10 @@ struct LinuxAioState *aio_setup_linux_aio(AioContext *ctx, Error **errp);
>  struct LinuxAioState *aio_get_linux_aio(AioContext *ctx);
>
>  /* Setup the LuringState bound to this AioContext */
> -struct LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp);
> +LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp);
>
>  /* Return the LuringState bound to this AioContext */
> -struct LuringState *aio_get_linux_io_uring(AioContext *ctx);
> +LuringState *aio_get_linux_io_uring(AioContext *ctx);
>  /**
>   * aio_timer_new_with_attrs:
>   * @ctx: the aio context
> diff --git a/include/block/raw-aio.h b/include/block/raw-aio.h
> index 251b10d273..af0ea0fba4 100644
> --- a/include/block/raw-aio.h
> +++ b/include/block/raw-aio.h
> @@ -59,7 +59,6 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s);
>  #endif
>  /* io_uring.c - Linux io_uring implementation */
>  #ifdef CONFIG_LINUX_IO_URING
> -typedef struct LuringState LuringState;
>  LuringState *luring_init(Error **errp);
>  void luring_cleanup(LuringState *s);
>  int coroutine_fn luring_co_submit(BlockDriverState *bs, LuringState *s, int fd,
> --

Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>

Re: [PATCH] io_uring: move LuringState typedef to block/aio.h
Posted by Stefano Garzarella 4 years, 6 months ago
On Mon, Jul 12, 2021 at 03:10:30PM +0200, Paolo Bonzini wrote:
>The LuringState typedef is defined twice, in include/block/raw-aio.h and
>block/io_uring.c.  Move it in include/block/aio.h, which is included
>everywhere the typedef is needed, since include/block/aio.h already has
>to define the forward reference to the struct.
>
>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>---
> block/io_uring.c        | 4 ++--
> include/block/aio.h     | 8 ++++----
> include/block/raw-aio.h | 1 -
> 3 files changed, 6 insertions(+), 7 deletions(-)

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