Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: set completion results upfront

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+22 -12
+9 -12
io_uring/io_uring.c
··· 91 91 #include "io-wq.h" 92 92 93 93 #include "io_uring_types.h" 94 + #include "io_uring.h" 94 95 95 96 #define IORING_MAX_ENTRIES 32768 96 97 #define IORING_MAX_CQ_ENTRIES (2 * IORING_MAX_ENTRIES) ··· 1877 1876 io_cqring_ev_posted(ctx); 1878 1877 } 1879 1878 1880 - static inline void io_req_complete_state(struct io_kiocb *req, s32 res, 1881 - u32 cflags) 1882 - { 1883 - req->cqe.res = res; 1884 - req->cqe.flags = cflags; 1885 - req->flags |= REQ_F_COMPLETE_INLINE; 1886 - } 1887 - 1888 1879 static inline void __io_req_complete(struct io_kiocb *req, unsigned issue_flags, 1889 1880 s32 res, u32 cflags) 1890 1881 { 1891 - if (issue_flags & IO_URING_F_COMPLETE_DEFER) 1892 - io_req_complete_state(req, res, cflags); 1893 - else 1882 + if (issue_flags & IO_URING_F_COMPLETE_DEFER) { 1883 + io_req_set_res(req, res, cflags); 1884 + req->flags |= REQ_F_COMPLETE_INLINE; 1885 + } else { 1894 1886 io_req_complete_post(req, res, cflags); 1887 + } 1895 1888 } 1896 1889 1897 1890 static inline void io_req_complete(struct io_kiocb *req, s32 res) ··· 2744 2749 int res = req->cqe.res; 2745 2750 2746 2751 if (*locked) { 2747 - io_req_complete_state(req, res, io_put_kbuf(req, 0)); 2752 + io_req_set_res(req, res, io_put_kbuf(req, 0)); 2753 + req->flags |= REQ_F_COMPLETE_INLINE; 2748 2754 io_req_add_compl_list(req); 2749 2755 } else { 2750 2756 io_req_complete_post(req, res, ··· 4390 4394 if (ret < 0) 4391 4395 req_set_fail(req); 4392 4396 4397 + io_req_set_res(req, 0, ret); 4393 4398 if (req->ctx->flags & IORING_SETUP_CQE32) 4394 4399 io_req_set_cqe32_extra(req, res2, 0); 4395 4400 io_req_complete(req, ret);
+13
io_uring/io_uring.h
··· 1 + #ifndef IOU_CORE_H 2 + #define IOU_CORE_H 3 + 4 + #include <linux/errno.h> 5 + #include "io_uring_types.h" 6 + 7 + static inline void io_req_set_res(struct io_kiocb *req, s32 res, u32 cflags) 8 + { 9 + req->cqe.res = res; 10 + req->cqe.flags = cflags; 11 + } 12 + 13 + #endif