From: Jens Axboe <axboe@kernel.dk>
To: Vincent Fu <vincentfu@gmail.com>,
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 13:23:28 -0600 [thread overview]
Message-ID: <3493cb8e-5978-4c6b-b9f5-cc565f3dfa3c@kernel.dk> (raw)
In-Reply-To: <0f56a2e4-81a9-4e4c-9120-b88e9cd1c0c6@gmail.com>
On 7/23/25 12:28 PM, Vincent Fu wrote:
> 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?
You can do that if you want, that'd be fine too. I did io_ops->prep
compare, which is a bit annoying in that it's a double deref to get
there. But at least it's not a strcmp! If you check the repo now, some
cleanups done too, last couple of feature additions to the io_uring
engine have not really been up to snuff imho.
--
Jens Axboe
next prev parent reply other threads:[~2025-07-23 19:23 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
2025-07-23 19:23 ` Jens Axboe [this message]
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=3493cb8e-5978-4c6b-b9f5-cc565f3dfa3c@kernel.dk \
--to=axboe@kernel.dk \
--cc=anuj1072538@gmail.com \
--cc=anuj20.g@samsung.com \
--cc=fio@vger.kernel.org \
--cc=hch@infradead.org \
--cc=joshi.k@samsung.com \
--cc=vincent.fu@samsung.com \
--cc=vincentfu@gmail.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