[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230424072339.GB13287@lst.de>
Date: Mon, 24 Apr 2023 09:23:39 +0200
From: Christoph Hellwig <hch@....de>
To: Breno Leitao <leitao@...ian.org>
Cc: io-uring@...r.kernel.org, linux-nvme@...ts.infradead.org,
asml.silence@...il.com, axboe@...nel.dk, leit@...com,
linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
sagi@...mberg.me, hch@....de, kbusch@...nel.org,
ming.lei@...hat.com
Subject: Re: [PATCH v2 2/3] io_uring: Pass whole sqe to commands
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.
Powered by blists - more mailing lists