From: Vincent Fu <vincentfu@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
anuj1072538@gmail.com, hch@infradead.org, joshi.k@samsung.com,
anuj20.g@samsung.com, fio@vger.kernel.org
Cc: Vincent Fu <vincent.fu@samsung.com>
Subject: Re: [PATCH 1/2] engines/io_uring: support r/w with metadata
Date: Wed, 23 Jul 2025 14:28:53 -0400 [thread overview]
Message-ID: <0f56a2e4-81a9-4e4c-9120-b88e9cd1c0c6@gmail.com> (raw)
In-Reply-To: <e548d5f8-9ebe-46cf-9f43-79be601d2057@kernel.dk>
On 7/23/25 1:37 PM, Jens Axboe wrote:
>>> + if (!strcmp(td->io_ops->name, "io_uring") && o->md_per_io_size) {
>>> + struct nvme_data *data = FILE_ENG_DATA(io_u->file);
>>> + struct nvme_cmd_ext_io_opts ext_opts = {0};
>>> +
>>> + if (data->pi_type) {
>>> + if (o->pi_act)
>>> + ext_opts.io_flags |= NVME_IO_PRINFO_PRACT;
>>> +
>>> + ext_opts.io_flags |= o->prchk;
>>> + ext_opts.apptag = o->apptag;
>>> + ext_opts.apptag_mask = o->apptag_mask;
>>> + }
>>> + fio_nvme_generate_guard(io_u, &ext_opts);
>>> + }
>>
>> Ehh a strcmp() in the hot path?! First of all, that's a big no-no.
>> Secondly, if this really was required, you'd add something to put that
>> strcmp() in the slow path and flag it. Lastly, thankfully this should be
>> much better as:
>>
>> if (td->io_ops == &ioengine_uring ...)
>>
>> instead.
>
> Eh I guess dynamically loaded engines would need special treatment. I'll
> take a look. In any case, strcmp() is just too ugly to live, actually
> quite a few in there and the io_uring engine is the only one that thinks
> this is necessary.
>
Thanks for the feedback. How about doing a strcmp at ioengine init time
and setting a flag that we can check in the hot path?
Vincent
next prev parent reply other threads:[~2025-07-23 18:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 17:04 [PATCH 0/2] io_uring r/w with metadata Vincent Fu
2025-07-23 17:04 ` [PATCH 1/2] engines/io_uring: support " Vincent Fu
2025-07-23 17:23 ` Jens Axboe
2025-07-23 17:37 ` Jens Axboe
2025-07-23 18:28 ` Vincent Fu [this message]
2025-07-23 19:23 ` Jens Axboe
2025-07-23 17:04 ` [PATCH 2/2] t/io_uring_pi: test script for io_uring PI Vincent Fu
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=0f56a2e4-81a9-4e4c-9120-b88e9cd1c0c6@gmail.com \
--to=vincentfu@gmail.com \
--cc=anuj1072538@gmail.com \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=fio@vger.kernel.org \
--cc=hch@infradead.org \
--cc=joshi.k@samsung.com \
--cc=vincent.fu@samsung.com \
/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