minor cleanups around IORING_RW_ATTR_FLAG_PI
Hi Jens,
this series has two little cleanups around IORING_RW_ATTR_FLAG_PI handling.
Diffstat:
include/uapi/linux/io_uring.h | 15 ++++++++------- io_uring/rw.c | 20 +++++++------------- 2 files changed, 15 insertions(+), 20 deletions(-)
PATCH 1/2 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 <[email protected]>
--- io_uring/rw.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
io_uring/rw.c +7 -13
@@ -248,7 +248,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))
@@ -281,19 +280,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)
Signature · 1 line
2.53.0
PATCH 2/2 io_uring: cleanup the io_uring_attr_pi definition
In reply to Christoph HellwigRemove double-tabs for the members, and make the comment describing the struct a bit more detailed.
Signed-off-by Christoph Hellwig <[email protected]>
--- include/uapi/linux/io_uring.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
include/uapi/linux/io_uring.h +8 -7
@@ -121,14 +121,15 @@ struct io_uring_sqe {/* sqe->attr_type_mask flags */ #define IORING_RW_ATTR_FLAG_PI (1U << 0) -/* PI attribute information */ + +/* PI attribute information in sqe->attr_ptr for IORING_RW_ATTR_FLAG_PI: */ struct io_uring_attr_pi { -__u16 flags; -__u16 app_tag; -__u32 len; -__u64 addr; -__u64 seed; -__u64 rsvd; +__u16 flags; +__u16 app_tag; +__u32 len; +__u64 addr; +__u64 seed; +__u64 rsvd; };/*
Signature · 1 line
2.53.0
Quoted 9 lines · Christoph Hellwig
this series has two little cleanups around
IORING_RW_ATTR_FLAG_PIhandling.Diffstat:
include/uapi/linux/io_uring.h | 15 ++++++++------- io_uring/rw.c | 20 +++++++------------- 2 files changed, 15 insertions(+), 20 deletions(-)[...]
Applied, thanks!
[1/2] io_uring: cleanup __io_prep_rw
commit: 7e3d3ed4c2e9e6c6aaf2be44f9651ae6d54cbf92
[2/2] io_uring: cleanup the io_uring_attr_pi definition
commit: 37c3cab82dd6d3d315dc76d0eeeefdbc97a75f92Best regards,
Signature · 1 line
Jens Axboe