Re: [PATCH 1/3] io_uring: add IOSQE_MULTI_CQES/REQ_F_MULTI_CQES for multishot requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/04/2021 12:23, Hao Xu wrote:
> Since we now have requests that may generate multiple cqes, we need a
> new flag to mark them, so that we can maintain features like drain io
> easily for them.
> 
> Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx>
> ---
>  fs/io_uring.c                 | 5 ++++-
>  include/uapi/linux/io_uring.h | 3 +++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 81e5d156af1c..192463bb977a 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -102,7 +102,7 @@
>  
>  #define SQE_VALID_FLAGS	(IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK|	\
>  				IOSQE_IO_HARDLINK | IOSQE_ASYNC | \
> -				IOSQE_BUFFER_SELECT)
> +				IOSQE_BUFFER_SELECT | IOSQE_MULTI_CQES)
>  
>  struct io_uring {
>  	u32 head ____cacheline_aligned_in_smp;
> @@ -700,6 +700,7 @@ enum {
>  	REQ_F_HARDLINK_BIT	= IOSQE_IO_HARDLINK_BIT,
>  	REQ_F_FORCE_ASYNC_BIT	= IOSQE_ASYNC_BIT,
>  	REQ_F_BUFFER_SELECT_BIT	= IOSQE_BUFFER_SELECT_BIT,
> +	REQ_F_MULTI_CQES_BIT	= IOSQE_MULTI_CQES_BIT,
>  
>  	REQ_F_FAIL_LINK_BIT,
>  	REQ_F_INFLIGHT_BIT,
> @@ -766,6 +767,8 @@ enum {
>  	REQ_F_ASYNC_WRITE	= BIT(REQ_F_ASYNC_WRITE_BIT),
>  	/* regular file */
>  	REQ_F_ISREG		= BIT(REQ_F_ISREG_BIT),
> +	/* a request can generate multiple cqes */
> +	REQ_F_MULTI_CQES	= BIT(REQ_F_MULTI_CQES_BIT),
>  };
>  
>  struct async_poll {
> diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
> index 5beaa6bbc6db..303ac8005572 100644
> --- a/include/uapi/linux/io_uring.h
> +++ b/include/uapi/linux/io_uring.h
> @@ -70,6 +70,7 @@ enum {
>  	IOSQE_IO_HARDLINK_BIT,
>  	IOSQE_ASYNC_BIT,
>  	IOSQE_BUFFER_SELECT_BIT,
> +	IOSQE_MULTI_CQES_BIT,
>  };

It's user API flags, I doubt you want to touch them.
1) there are not much of bits left
2) it almost always means you add overhead in generic path,
even for those who don't care about multishots or drains.

Let's keep out of it

>  
>  /*
> @@ -87,6 +88,8 @@ enum {
>  #define IOSQE_ASYNC		(1U << IOSQE_ASYNC_BIT)
>  /* select buffer from sqe->buf_group */
>  #define IOSQE_BUFFER_SELECT	(1U << IOSQE_BUFFER_SELECT_BIT)
> +/* may generate multiple cqes */
> +#define IOSQE_MULTI_CQES	(1U << IOSQE_MULTI_CQES_BIT)
>  
>  /*
>   * io_uring_setup() flags
> 

-- 
Pavel Begunkov



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux