mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
io_uring: cleanup __io_prep_rw
Switch on attr_type_mask once, and also do away with the local variable for attr_ptr. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261005141954.1353351-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
68477e4c56
commit
7e3d3ed4c2
|
|
@ -249,7 +249,6 @@ static int __io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
|
|||
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
|
||||
struct io_async_rw *io;
|
||||
unsigned ioprio;
|
||||
u64 attr_type_mask;
|
||||
int ret;
|
||||
|
||||
if (io_rw_alloc_async(req))
|
||||
|
|
@ -282,19 +281,14 @@ static int __io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
|
|||
rw->addr = READ_ONCE(sqe->addr);
|
||||
rw->len = READ_ONCE(sqe->len);
|
||||
rw->flags = (__force rwf_t) READ_ONCE(sqe->rw_flags);
|
||||
|
||||
attr_type_mask = READ_ONCE(sqe->attr_type_mask);
|
||||
if (attr_type_mask) {
|
||||
u64 attr_ptr;
|
||||
|
||||
/* only PI attribute is supported currently */
|
||||
if (attr_type_mask != IORING_RW_ATTR_FLAG_PI)
|
||||
return -EINVAL;
|
||||
|
||||
attr_ptr = READ_ONCE(sqe->attr_ptr);
|
||||
return io_prep_rw_pi(req, rw, ddir, attr_ptr);
|
||||
switch (READ_ONCE(sqe->attr_type_mask)) {
|
||||
case 0:
|
||||
return 0;
|
||||
case IORING_RW_ATTR_FLAG_PI:
|
||||
return io_prep_rw_pi(req, rw, ddir, READ_ONCE(sqe->attr_ptr));
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int io_rw_do_import(struct io_kiocb *req, int ddir)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user