[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [RFC PATCH 5/9] util/asyn: add aio interfa
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [Qemu-devel] [RFC PATCH 5/9] util/asyn: add aio interfaces for io_uring |
Date: |
Wed, 22 May 2019 14:16:51 +0100 |
User-agent: |
Mutt/1.11.4 (2019-03-13) |
On Wed, May 22, 2019 at 05:22:11AM +0530, Aarushi Mehta wrote:
s/asyn/async/ in the Subject line.
> @@ -341,6 +349,25 @@ LinuxAioState *aio_get_linux_aio(AioContext *ctx)
> }
> #endif
>
> +#ifdef CONFIG_LINUX_IO_URING
> +LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp)
> +{
> + if (!ctx->linux_io_uring) {
> + ctx->linux_io_uring = luring_init(errp);
> + if (ctx->linux_io_uring) {
> + luring_attach_aio_context(ctx->linux_io_uring, ctx);
> + }
> + }
> + return ctx->linux_io_uring;
> +}
Personally I find functions that are written to have a single return
statement hard to understand due to the nesting and multiple code paths.
I prefer a straight-line approach that returns as soon as there is an
error.
This is a style thing. You can do it either way. Here is the same
without nesting:
if (ctx->linux_io_uring) {
return ctx->linux_io_uring;
}
ctx->linux_io_uring = luring_init(errp);
if (!ctx->linux_io_uring) {
return NULL;
}
luring_attach_aio_context(ctx->linux_io_uring, ctx);
return ctx->linux_io_uring;
signature.asc
Description: PGP signature
- [Qemu-block] [RFC PATCH 0/9] Add support for io_uring, Aarushi Mehta, 2019/05/21
- Re: [Qemu-block] [Qemu-devel] [RFC PATCH 0/9] Add support for io_uring, no-reply, 2019/05/21
- [Qemu-block] [RFC PATCH 9/9] configure: permits use of io_uring with probe, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 4/9] stubs: add aio interface stubs for io_uring, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 3/9] include/block: declare interfaces for io_uring, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 5/9] util/asyn: add aio interfaces for io_uring, Aarushi Mehta, 2019/05/21
- Re: [Qemu-block] [Qemu-devel] [RFC PATCH 5/9] util/asyn: add aio interfaces for io_uring,
Stefan Hajnoczi <=
- [Qemu-block] [RFC PATCH 2/9] block/block: add BDRV flag for io_uring, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 8/9] block/file-posix: extends to use with io_uring, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 7/9] blockdev: accept io_uring as option, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 6/9] block/io_uring: implements interfaces for io_uring, Aarushi Mehta, 2019/05/21
- [Qemu-block] [RFC PATCH 1/9] qapi/block-core: add option for io_uring, Aarushi Mehta, 2019/05/21