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 madvise/fadvise to use io_cmd_type

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

+12 -10
+12 -10
io_uring/io_uring.c
··· 980 980 struct file *file; 981 981 struct io_cmd_data cmd; 982 982 struct io_rsrc_update rsrc_update; 983 - struct io_fadvise fadvise; 984 - struct io_madvise madvise; 985 983 struct io_epoll epoll; 986 984 struct io_splice splice; 987 985 struct io_provide_buf pbuf; ··· 5627 5629 static int io_madvise_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 5628 5630 { 5629 5631 #if defined(CONFIG_ADVISE_SYSCALLS) && defined(CONFIG_MMU) 5632 + struct io_madvise *ma = io_kiocb_to_cmd(req); 5633 + 5630 5634 if (sqe->buf_index || sqe->off || sqe->splice_fd_in) 5631 5635 return -EINVAL; 5632 5636 5633 - req->madvise.addr = READ_ONCE(sqe->addr); 5634 - req->madvise.len = READ_ONCE(sqe->len); 5635 - req->madvise.advice = READ_ONCE(sqe->fadvise_advice); 5637 + ma->addr = READ_ONCE(sqe->addr); 5638 + ma->len = READ_ONCE(sqe->len); 5639 + ma->advice = READ_ONCE(sqe->fadvise_advice); 5636 5640 return 0; 5637 5641 #else 5638 5642 return -EOPNOTSUPP; ··· 5644 5644 static int io_madvise(struct io_kiocb *req, unsigned int issue_flags) 5645 5645 { 5646 5646 #if defined(CONFIG_ADVISE_SYSCALLS) && defined(CONFIG_MMU) 5647 - struct io_madvise *ma = &req->madvise; 5647 + struct io_madvise *ma = io_kiocb_to_cmd(req); 5648 5648 int ret; 5649 5649 5650 5650 if (issue_flags & IO_URING_F_NONBLOCK) ··· 5660 5660 5661 5661 static int io_fadvise_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 5662 5662 { 5663 + struct io_fadvise *fa = io_kiocb_to_cmd(req); 5664 + 5663 5665 if (sqe->buf_index || sqe->addr || sqe->splice_fd_in) 5664 5666 return -EINVAL; 5665 5667 5666 - req->fadvise.offset = READ_ONCE(sqe->off); 5667 - req->fadvise.len = READ_ONCE(sqe->len); 5668 - req->fadvise.advice = READ_ONCE(sqe->fadvise_advice); 5668 + fa->offset = READ_ONCE(sqe->off); 5669 + fa->len = READ_ONCE(sqe->len); 5670 + fa->advice = READ_ONCE(sqe->fadvise_advice); 5669 5671 return 0; 5670 5672 } 5671 5673 5672 5674 static int io_fadvise(struct io_kiocb *req, unsigned int issue_flags) 5673 5675 { 5674 - struct io_fadvise *fa = &req->fadvise; 5676 + struct io_fadvise *fa = io_kiocb_to_cmd(req); 5675 5677 int ret; 5676 5678 5677 5679 if (issue_flags & IO_URING_F_NONBLOCK) {