[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH v2 3/9] include/block: declare interfaces for io
From: |
Aarushi Mehta |
Subject: |
[Qemu-block] [RFC PATCH v2 3/9] include/block: declare interfaces for io_uring |
Date: |
Fri, 24 May 2019 19:33:31 +0530 |
Signed-off-by: Aarushi Mehta <address@hidden>
---
include/block/aio.h | 16 +++++++++++++++-
include/block/raw-aio.h | 15 +++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/include/block/aio.h b/include/block/aio.h
index 0ca25dfec6..9da3fd9793 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -50,6 +50,7 @@ typedef void IOHandler(void *opaque);
struct Coroutine;
struct ThreadPool;
struct LinuxAioState;
+struct LuringState;
struct AioContext {
GSource source;
@@ -118,11 +119,19 @@ struct AioContext {
struct ThreadPool *thread_pool;
#ifdef CONFIG_LINUX_AIO
- /* State for native Linux AIO. Uses aio_context_acquire/release for
+ /*
+ * State for native Linux AIO. Uses aio_context_acquire/release for
* locking.
*/
struct LinuxAioState *linux_aio;
#endif
+#ifdef CONFIG_LINUX_IO_URING
+ /*
+ * State for Linux io_uring. Uses aio_context_acquire/release for
+ * locking.
+ */
+ struct LuringState *linux_io_uring;
+#endif
/* TimerLists for calling timers - one per clock type. Has its own
* locking.
@@ -387,6 +396,11 @@ struct LinuxAioState *aio_setup_linux_aio(AioContext *ctx,
Error **errp);
/* Return the LinuxAioState bound to this AioContext */
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);
+
+/* Return the LuringState bound to this AioContext */
+struct 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 ba223dd1f1..28a836151e 100644
--- a/include/block/raw-aio.h
+++ b/include/block/raw-aio.h
@@ -58,6 +58,21 @@ void laio_attach_aio_context(LinuxAioState *s, AioContext
*new_context);
void laio_io_plug(BlockDriverState *bs, LinuxAioState *s);
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,
+ uint64_t offset, QEMUIOVector *qiov, int type);
+BlockAIOCB *luring_submit(BlockDriverState *bs, LuringState *s, int fd,
+ int64_t sector_num, QEMUIOVector *qiov, BlockCompletionFunc *cb,
+ void *opaque, int type);
+void luring_detach_aio_context(LuringState *s, AioContext *old_context);
+void luring_attach_aio_context(LuringState *s, AioContext *new_context);
+void luring_io_plug(BlockDriverState *bs, LuringState *s);
+void luring_io_unplug(BlockDriverState *bs, LuringState *s);
+#endif
#ifdef _WIN32
typedef struct QEMUWin32AIOState QEMUWin32AIOState;
--
2.17.1
- [Qemu-block] [RFC PATCH v2 0/9] Add support for io_uring, Aarushi Mehta, 2019/05/24
- [Qemu-block] [RFC PATCH v2 5/9] util/async: add aio interfaces for io_uring, Aarushi Mehta, 2019/05/24
- [Qemu-block] [RFC PATCH v2 4/9] stubs: add aio interface stubs for io_uring, Aarushi Mehta, 2019/05/24
- [Qemu-block] [RFC PATCH v2 3/9] include/block: declare interfaces for io_uring,
Aarushi Mehta <=
- [Qemu-block] [RFC PATCH v2 2/9] block/block: add BDRV flag for io_uring, Aarushi Mehta, 2019/05/24
- [Qemu-block] [RFC PATCH v2 1/9] qapi/block-core: add option for io_uring, Aarushi Mehta, 2019/05/24
- [Qemu-block] [RFC PATCH v2 8/9] block/file-posix: extends to use with io_uring, Aarushi Mehta, 2019/05/24
- [Qemu-block] [RFC PATCH v2 9/9] configure: permit use of io_uring, Aarushi Mehta, 2019/05/24