io_uring: simplify io_alloc_req()
Get rid of a label in io_alloc_req(), it's cleaner to do return directly. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Родитель
888aae2eed
Коммит
85bcb6c67e
|
@ -1988,7 +1988,7 @@ static struct io_kiocb *io_alloc_req(struct io_ring_ctx *ctx,
|
||||||
if (unlikely(ret <= 0)) {
|
if (unlikely(ret <= 0)) {
|
||||||
state->reqs[0] = kmem_cache_alloc(req_cachep, gfp);
|
state->reqs[0] = kmem_cache_alloc(req_cachep, gfp);
|
||||||
if (!state->reqs[0])
|
if (!state->reqs[0])
|
||||||
goto fallback;
|
return io_get_fallback_req(ctx);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
state->free_reqs = ret;
|
state->free_reqs = ret;
|
||||||
|
@ -1996,8 +1996,6 @@ static struct io_kiocb *io_alloc_req(struct io_ring_ctx *ctx,
|
||||||
|
|
||||||
state->free_reqs--;
|
state->free_reqs--;
|
||||||
return state->reqs[state->free_reqs];
|
return state->reqs[state->free_reqs];
|
||||||
fallback:
|
|
||||||
return io_get_fallback_req(ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void io_put_file(struct io_kiocb *req, struct file *file,
|
static inline void io_put_file(struct io_kiocb *req, struct file *file,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче