Skip to content

Commit b7a7317

Browse files
committed
Merge branch 'for-7.1/io_uring' into for-next
* for-7.1/io_uring: io_uring: avoid req->ctx reload in io_req_put_rsrc_nodes() io_uring/rw: use cached file rather than req->file io_uring/net: use 'ctx' consistently io_uring/poll: cache req->apoll_events io_uring/kbuf: use 'ctx' consistently
2 parents 7745de3 + f41b075 commit b7a7317

5 files changed

Lines changed: 13 additions & 9 deletions

File tree

io_uring/io_uring.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,12 +1073,14 @@ void io_queue_next(struct io_kiocb *req)
10731073

10741074
static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
10751075
{
1076+
struct io_ring_ctx *ctx = req->ctx;
1077+
10761078
if (req->file_node) {
1077-
io_put_rsrc_node(req->ctx, req->file_node);
1079+
io_put_rsrc_node(ctx, req->file_node);
10781080
req->file_node = NULL;
10791081
}
10801082
if (req->flags & REQ_F_BUF_NODE)
1081-
io_put_rsrc_node(req->ctx, req->buf_node);
1083+
io_put_rsrc_node(ctx, req->buf_node);
10821084
}
10831085

10841086
static void io_free_batch_list(struct io_ring_ctx *ctx,

io_uring/kbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct io_br_sel io_buffer_select(struct io_kiocb *req, size_t *len,
225225
struct io_br_sel sel = { };
226226
struct io_buffer_list *bl;
227227

228-
io_ring_submit_lock(req->ctx, issue_flags);
228+
io_ring_submit_lock(ctx, issue_flags);
229229

230230
bl = io_buffer_get_list(ctx, buf_group);
231231
if (likely(bl)) {
@@ -234,7 +234,7 @@ struct io_br_sel io_buffer_select(struct io_kiocb *req, size_t *len,
234234
else
235235
sel.addr = io_provided_buffer_select(req, len, bl);
236236
}
237-
io_ring_submit_unlock(req->ctx, issue_flags);
237+
io_ring_submit_unlock(ctx, issue_flags);
238238
return sel;
239239
}
240240

io_uring/net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
13751375
if (zc->msg_flags & MSG_DONTWAIT)
13761376
req->flags |= REQ_F_NOWAIT;
13771377

1378-
if (io_is_compat(req->ctx))
1378+
if (io_is_compat(ctx))
13791379
zc->msg_flags |= MSG_CMSG_COMPAT;
13801380

13811381
iomsg = io_msg_alloc_async(req);

io_uring/poll.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
277277

278278
/* the mask was stashed in __io_poll_execute */
279279
if (!req->cqe.res) {
280-
struct poll_table_struct pt = { ._key = req->apoll_events };
281-
req->cqe.res = vfs_poll(req->file, &pt) & req->apoll_events;
280+
__poll_t events = req->apoll_events;
281+
struct poll_table_struct pt = { ._key = events };
282+
283+
req->cqe.res = vfs_poll(req->file, &pt) & events;
282284
/*
283285
* We got woken with a mask, but someone else got to
284286
* it first. The above vfs_poll() doesn't add us back
@@ -287,7 +289,7 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
287289
*/
288290
if (unlikely(!req->cqe.res)) {
289291
/* Multishot armed need not reissue */
290-
if (!(req->apoll_events & EPOLLONESHOT))
292+
if (!(events & EPOLLONESHOT))
291293
continue;
292294
return IOU_POLL_REISSUE;
293295
}

io_uring/rw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
900900
* We have a union of meta fields with wpq used for buffered-io
901901
* in io_async_rw, so fail it here.
902902
*/
903-
if (!(req->file->f_flags & O_DIRECT))
903+
if (!(file->f_flags & O_DIRECT))
904904
return -EOPNOTSUPP;
905905
kiocb->ki_flags |= IOCB_HAS_METADATA;
906906
kiocb->private = &io->meta;

0 commit comments

Comments
 (0)