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