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: convert rsrc_update to io_cmd_type

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

+19 -16
+19 -16
io_uring/io_uring.c
··· 979 979 */ 980 980 struct file *file; 981 981 struct io_cmd_data cmd; 982 - struct io_rsrc_update rsrc_update; 983 982 struct io_xattr xattr; 984 983 struct io_uring_cmd uring_cmd; 985 984 }; ··· 7799 7800 static int io_files_update_prep(struct io_kiocb *req, 7800 7801 const struct io_uring_sqe *sqe) 7801 7802 { 7803 + struct io_rsrc_update *up = io_kiocb_to_cmd(req); 7804 + 7802 7805 if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) 7803 7806 return -EINVAL; 7804 7807 if (sqe->rw_flags || sqe->splice_fd_in) 7805 7808 return -EINVAL; 7806 7809 7807 - req->rsrc_update.offset = READ_ONCE(sqe->off); 7808 - req->rsrc_update.nr_args = READ_ONCE(sqe->len); 7809 - if (!req->rsrc_update.nr_args) 7810 + up->offset = READ_ONCE(sqe->off); 7811 + up->nr_args = READ_ONCE(sqe->len); 7812 + if (!up->nr_args) 7810 7813 return -EINVAL; 7811 - req->rsrc_update.arg = READ_ONCE(sqe->addr); 7814 + up->arg = READ_ONCE(sqe->addr); 7812 7815 return 0; 7813 7816 } 7814 7817 7815 7818 static int io_files_update_with_index_alloc(struct io_kiocb *req, 7816 7819 unsigned int issue_flags) 7817 7820 { 7818 - __s32 __user *fds = u64_to_user_ptr(req->rsrc_update.arg); 7821 + struct io_rsrc_update *up = io_kiocb_to_cmd(req); 7822 + __s32 __user *fds = u64_to_user_ptr(up->arg); 7819 7823 unsigned int done; 7820 7824 struct file *file; 7821 7825 int ret, fd; ··· 7826 7824 if (!req->ctx->file_data) 7827 7825 return -ENXIO; 7828 7826 7829 - for (done = 0; done < req->rsrc_update.nr_args; done++) { 7827 + for (done = 0; done < up->nr_args; done++) { 7830 7828 if (copy_from_user(&fd, &fds[done], sizeof(fd))) { 7831 7829 ret = -EFAULT; 7832 7830 break; ··· 7855 7853 7856 7854 static int io_files_update(struct io_kiocb *req, unsigned int issue_flags) 7857 7855 { 7856 + struct io_rsrc_update *up = io_kiocb_to_cmd(req); 7858 7857 struct io_ring_ctx *ctx = req->ctx; 7859 - struct io_uring_rsrc_update2 up; 7858 + struct io_uring_rsrc_update2 up2; 7860 7859 int ret; 7861 7860 7862 - up.offset = req->rsrc_update.offset; 7863 - up.data = req->rsrc_update.arg; 7864 - up.nr = 0; 7865 - up.tags = 0; 7866 - up.resv = 0; 7867 - up.resv2 = 0; 7861 + up2.offset = up->offset; 7862 + up2.data = up->arg; 7863 + up2.nr = 0; 7864 + up2.tags = 0; 7865 + up2.resv = 0; 7866 + up2.resv2 = 0; 7868 7867 7869 - if (req->rsrc_update.offset == IORING_FILE_INDEX_ALLOC) { 7868 + if (up->offset == IORING_FILE_INDEX_ALLOC) { 7870 7869 ret = io_files_update_with_index_alloc(req, issue_flags); 7871 7870 } else { 7872 7871 io_ring_submit_lock(ctx, issue_flags); 7873 7872 ret = __io_register_rsrc_update(ctx, IORING_RSRC_FILE, 7874 - &up, req->rsrc_update.nr_args); 7873 + &up2, up->nr_args); 7875 7874 io_ring_submit_unlock(ctx, issue_flags); 7876 7875 } 7877 7876