From: Jens Axboe <axboe@kernel.dk>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] block: only read from sqe on initial invocation of blkdev_uring_cmd()
Date: Tue, 5 May 2026 01:20:34 -0600 [thread overview]
Message-ID: <ccd71c69-05db-407d-817b-e43fff3f3525@kernel.dk> (raw)
In-Reply-To: <CADUfDZqw6P1a5Q55cEgAPbULxJatEXNL6UXyn=ftS_dqBBqq9A@mail.gmail.com>
On 5/4/26 11:40 AM, Caleb Sander Mateos wrote:
> On Mon, May 4, 2026 at 7:39 AM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> This passthrough helper currently only supports discards. Part of that
>> command is the start and length, which is read from the SQE. It does
>> so on every invocation, where it really should just make it stable
>> on the first invocation. This avoids needing to copy the SQE upfront,
>> as we only really need those two 8b values stored in our per-req
>> payload.
>>
>> Cc: stable@vger.kernel.org # 6.17+
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>> ---
>>
>> diff --git a/block/ioctl.c b/block/ioctl.c
>> index fc3be0549aa7..6aa02575e08d 100644
>> --- a/block/ioctl.c
>> +++ b/block/ioctl.c
>> @@ -857,6 +857,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
>> #endif
>>
>> struct blk_iou_cmd {
>> + u64 start;
>> + u64 len;
>> int res;
>> bool nowait;
>> };
>> @@ -946,23 +948,27 @@ int blkdev_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
>> {
>> struct block_device *bdev = I_BDEV(cmd->file->f_mapping->host);
>> struct blk_iou_cmd *bic = io_uring_cmd_to_pdu(cmd, struct blk_iou_cmd);
>> - const struct io_uring_sqe *sqe = cmd->sqe;
>> u32 cmd_op = cmd->cmd_op;
>> - uint64_t start, len;
>>
>> - if (unlikely(sqe->ioprio || sqe->__pad1 || sqe->len ||
>> - sqe->rw_flags || sqe->file_index))
>> - return -EINVAL;
>> + /* Read what we need from the SQE on the first issue */
>> + if (issue_flags & IO_URING_F_INLINE) {
>
> I don't think IO_URING_F_INLINE is guaranteed to be set on the first
> issue? For example, a subsequent command in a linked chain, or one
> that sets REQ_F_FORCE_ASYNC or REQ_F_IO_DRAIN will be issued
> asynchronously originally. Could you check !(issue_flags &
> IORING_URING_CMD_REISSUE) instead?
Good point, that is more self-explanatory too (and correct). I'll
make the change.
--
Jens Axboe
prev parent reply other threads:[~2026-05-05 7:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 14:37 [PATCH] block: only read from sqe on initial invocation of blkdev_uring_cmd() Jens Axboe
2026-05-04 17:40 ` Caleb Sander Mateos
2026-05-05 7:20 ` Jens Axboe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ccd71c69-05db-407d-817b-e43fff3f3525@kernel.dk \
--to=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox