File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ const struct io_issue_def io_issue_defs[] = {
6666 .iopoll = 1 ,
6767 .iopoll_queue = 1 ,
6868 .vectored = 1 ,
69- .prep = io_prep_rw ,
69+ .prep = io_prep_rwv ,
7070 .issue = io_read ,
7171 },
7272 [IORING_OP_WRITEV ] = {
@@ -80,7 +80,7 @@ const struct io_issue_def io_issue_defs[] = {
8080 .iopoll = 1 ,
8181 .iopoll_queue = 1 ,
8282 .vectored = 1 ,
83- .prep = io_prep_rw ,
83+ .prep = io_prep_rwv ,
8484 .issue = io_write ,
8585 },
8686 [IORING_OP_FSYNC ] = {
Original file line number Diff line number Diff line change @@ -110,15 +110,23 @@ int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe)
110110 rw -> addr = READ_ONCE (sqe -> addr );
111111 rw -> len = READ_ONCE (sqe -> len );
112112 rw -> flags = READ_ONCE (sqe -> rw_flags );
113+ return 0 ;
114+ }
113115
114- /* Have to do this validation here, as this is in io_read() rw->len might
115- * have chanaged due to buffer selection
116+ int io_prep_rwv (struct io_kiocb * req , const struct io_uring_sqe * sqe )
117+ {
118+ int ret ;
119+
120+ ret = io_prep_rw (req , sqe );
121+ if (unlikely (ret ))
122+ return ret ;
123+
124+ /*
125+ * Have to do this validation here, as this is in io_read() rw->len
126+ * might have chanaged due to buffer selection
116127 */
117- if (req -> opcode == IORING_OP_READV && req -> flags & REQ_F_BUFFER_SELECT ) {
118- ret = io_iov_buffer_select_prep (req );
119- if (ret )
120- return ret ;
121- }
128+ if (req -> flags & REQ_F_BUFFER_SELECT )
129+ return io_iov_buffer_select_prep (req );
122130
123131 return 0 ;
124132}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ struct io_async_rw {
1616};
1717
1818int io_prep_rw (struct io_kiocb * req , const struct io_uring_sqe * sqe );
19+ int io_prep_rwv (struct io_kiocb * req , const struct io_uring_sqe * sqe );
1920int io_read (struct io_kiocb * req , unsigned int issue_flags );
2021int io_readv_prep_async (struct io_kiocb * req );
2122int io_write (struct io_kiocb * req , unsigned int issue_flags );
You can’t perform that action at this time.
0 commit comments