Re: [PATCH v2 2/3] io_uring: Pass whole sqe to commands

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

 



On Fri, Apr 21, 2023 at 04:44:39AM -0700, Breno Leitao wrote:
> -	struct ublksrv_io_cmd *ub_cmd = (struct ublksrv_io_cmd *)cmd->cmd;
> +	struct ublksrv_io_cmd *ub_cmd = (struct ublksrv_io_cmd *)cmd->sqe->cmd;

As mentioned in my (late) reply to the previous series, please
add a helper like:

static inline const void *io_uring_sqe_cmd(struct io_uring_sqe *sqe)
{
	return sqe->cmd;
}

and then avoid all these casts.

>  int io_uring_cmd_prep_async(struct io_kiocb *req)
>  {
>  	struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
> +	size_t size = uring_sqe_size(req->ctx);
>  
>  	BUILD_BUG_ON(uring_cmd_pdu_size(0) != 16);
>  	BUILD_BUG_ON(uring_cmd_pdu_size(1) != 80);
>  
> +	memcpy(req->async_data, ioucmd->sqe, size);
> +	ioucmd->sqe = req->async_data;

This can skip the size local variable now.



[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