提交 3eb28bfd 编写于 作者: J Jens Axboe 提交者: Cheng Jian

io_uring: change io_ring_ctx bool fields into bit fields

mainline inclusion
from mainline-5.6-rc1
commit 69b3e546
category: feature
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27
CVE: NA
---------------------------

In preparation for adding another one, which would make us spill into
another long (and hence bump the size of the ctx), change them to
bit fields.
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 18a913b8
...@@ -202,10 +202,10 @@ struct io_ring_ctx { ...@@ -202,10 +202,10 @@ struct io_ring_ctx {
struct { struct {
unsigned int flags; unsigned int flags;
bool compat; int compat: 1;
bool account_mem; int account_mem: 1;
bool cq_overflow_flushed; int cq_overflow_flushed: 1;
bool drain_next; int drain_next: 1;
/* /*
* Ring buffer of indices into array of io_uring_sqe, which is * Ring buffer of indices into array of io_uring_sqe, which is
...@@ -993,7 +993,7 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force) ...@@ -993,7 +993,7 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force)
/* if force is set, the ring is going away. always drop after that */ /* if force is set, the ring is going away. always drop after that */
if (force) if (force)
ctx->cq_overflow_flushed = true; ctx->cq_overflow_flushed = 1;
cqe = NULL; cqe = NULL;
while (!list_empty(&ctx->cq_overflow_list)) { while (!list_empty(&ctx->cq_overflow_list)) {
...@@ -4486,9 +4486,9 @@ static void io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -4486,9 +4486,9 @@ static void io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe)
if (unlikely(req->ctx->drain_next)) { if (unlikely(req->ctx->drain_next)) {
req->flags |= REQ_F_IO_DRAIN; req->flags |= REQ_F_IO_DRAIN;
req->ctx->drain_next = false; req->ctx->drain_next = 0;
} }
req->ctx->drain_next = (req->flags & REQ_F_DRAIN_LINK); req->ctx->drain_next = (req->flags & REQ_F_DRAIN_LINK) != 0;
ret = io_req_defer(req, sqe); ret = io_req_defer(req, sqe);
if (ret) { if (ret) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册