Lines Matching refs:req

44 void __user *io_buffer_select(struct io_kiocb *req, size_t *len,
48 int io_remove_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
49 int io_remove_buffers(struct io_kiocb *req, unsigned int issue_flags);
51 int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
52 int io_provide_buffers(struct io_kiocb *req, unsigned int issue_flags);
59 unsigned int __io_put_kbuf(struct io_kiocb *req, unsigned issue_flags);
61 void io_kbuf_recycle_legacy(struct io_kiocb *req, unsigned issue_flags);
65 static inline void io_kbuf_recycle_ring(struct io_kiocb *req)
74 if (req->buf_list) {
75 if (req->flags & REQ_F_PARTIAL_IO) {
80 * req->buf_list when the buffer was retrieved,
83 req->buf_list->head++;
84 req->buf_list = NULL;
86 req->buf_index = req->buf_list->bgid;
87 req->flags &= ~REQ_F_BUFFER_RING;
92 static inline bool io_do_buffer_select(struct io_kiocb *req)
94 if (!(req->flags & REQ_F_BUFFER_SELECT))
96 return !(req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING));
99 static inline void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
101 if (req->flags & REQ_F_BUFFER_SELECTED)
102 io_kbuf_recycle_legacy(req, issue_flags);
103 if (req->flags & REQ_F_BUFFER_RING)
104 io_kbuf_recycle_ring(req);
107 static inline unsigned int __io_put_kbuf_list(struct io_kiocb *req,
110 unsigned int ret = IORING_CQE_F_BUFFER | (req->buf_index << IORING_CQE_BUFFER_SHIFT);
112 if (req->flags & REQ_F_BUFFER_RING) {
113 if (req->buf_list) {
114 req->buf_index = req->buf_list->bgid;
115 req->buf_list->head++;
117 req->flags &= ~REQ_F_BUFFER_RING;
119 req->buf_index = req->kbuf->bgid;
120 list_add(&req->kbuf->list, list);
121 req->flags &= ~REQ_F_BUFFER_SELECTED;
127 static inline unsigned int io_put_kbuf_comp(struct io_kiocb *req)
129 lockdep_assert_held(&req->ctx->completion_lock);
131 if (!(req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)))
133 return __io_put_kbuf_list(req, &req->ctx->io_buffers_comp);
136 static inline unsigned int io_put_kbuf(struct io_kiocb *req,
140 if (!(req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)))
142 return __io_put_kbuf(req, issue_flags);