Skip to content

Commit 3b2a443

Browse files
committed
io_uring: get rid of kiocb_wait_page_queue_init()
The 5.9 merge moved this function io_uring, which means that we don't need to retain the generic nature of it. Clean up this part by removing redundant checks, and just inlining the small remainder in io_rw_should_retry(). No functional changes in this patch. Signed-off-by: Jens Axboe <[email protected]>
1 parent b711d4e commit 3b2a443

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

fs/io_uring.c

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,27 +3074,6 @@ static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode,
30743074
return 1;
30753075
}
30763076

3077-
static inline int kiocb_wait_page_queue_init(struct kiocb *kiocb,
3078-
struct wait_page_queue *wait,
3079-
wait_queue_func_t func,
3080-
void *data)
3081-
{
3082-
/* Can't support async wakeup with polled IO */
3083-
if (kiocb->ki_flags & IOCB_HIPRI)
3084-
return -EINVAL;
3085-
if (kiocb->ki_filp->f_mode & FMODE_BUF_RASYNC) {
3086-
wait->wait.func = func;
3087-
wait->wait.private = data;
3088-
wait->wait.flags = 0;
3089-
INIT_LIST_HEAD(&wait->wait.entry);
3090-
kiocb->ki_flags |= IOCB_WAITQ;
3091-
kiocb->ki_waitq = wait;
3092-
return 0;
3093-
}
3094-
3095-
return -EOPNOTSUPP;
3096-
}
3097-
30983077
/*
30993078
* This controls whether a given IO request should be armed for async page
31003079
* based retry. If we return false here, the request is handed to the async
@@ -3109,31 +3088,33 @@ static inline int kiocb_wait_page_queue_init(struct kiocb *kiocb,
31093088
*/
31103089
static bool io_rw_should_retry(struct io_kiocb *req)
31113090
{
3091+
struct wait_page_queue *wait = &req->io->rw.wpq;
31123092
struct kiocb *kiocb = &req->rw.kiocb;
3113-
int ret;
31143093

31153094
/* never retry for NOWAIT, we just complete with -EAGAIN */
31163095
if (req->flags & REQ_F_NOWAIT)
31173096
return false;
31183097

31193098
/* Only for buffered IO */
3120-
if (kiocb->ki_flags & IOCB_DIRECT)
3099+
if (kiocb->ki_flags & (IOCB_DIRECT | IOCB_HIPRI))
31213100
return false;
3101+
31223102
/*
31233103
* just use poll if we can, and don't attempt if the fs doesn't
31243104
* support callback based unlocks
31253105
*/
31263106
if (file_can_poll(req->file) || !(req->file->f_mode & FMODE_BUF_RASYNC))
31273107
return false;
31283108

3129-
ret = kiocb_wait_page_queue_init(kiocb, &req->io->rw.wpq,
3130-
io_async_buf_func, req);
3131-
if (!ret) {
3132-
io_get_req_task(req);
3133-
return true;
3134-
}
3109+
wait->wait.func = io_async_buf_func;
3110+
wait->wait.private = req;
3111+
wait->wait.flags = 0;
3112+
INIT_LIST_HEAD(&wait->wait.entry);
3113+
kiocb->ki_flags |= IOCB_WAITQ;
3114+
kiocb->ki_waitq = wait;
31353115

3136-
return false;
3116+
io_get_req_task(req);
3117+
return true;
31373118
}
31383119

31393120
static int io_iter_do_read(struct io_kiocb *req, struct iov_iter *iter)

0 commit comments

Comments
 (0)