From: Stefan Hajnoczi <stefanha@redhat.com>
To: Prasad Pandit <ppandit@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
Prasad Pandit <pjp@fedoraproject.org>
Subject: Re: [PATCH v2] linux-aio: add IO_CMD_FDSYNC command support
Date: Tue, 12 Mar 2024 10:45:43 -0400 [thread overview]
Message-ID: <20240312144543.GA411413@fedora> (raw)
In-Reply-To: <CAE8KmOwpnVyFQKguQAAg3Y0oQCb8-G1vg_qL9Q_YaQqJC1i2MQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]
On Tue, Mar 12, 2024 at 07:07:04PM +0530, Prasad Pandit wrote:
> Hello,
>
> On Tue, 12 Mar 2024 at 15:15, Kevin Wolf <kwolf@redhat.com> wrote:
> > Am 11.03.2024 um 20:36 hat Stefan Hajnoczi geschrieben:
> > > > > That can be avoided with a variable that keeps track of whether -EINVAL was seen before and skips Linux AIO in that
> > > > > case.
> > > > >
> > > > > Fallback should be very rare, so I don't think it needs to be optimized:
> > You're right. I missed that io_submit() returns failure only if the
> > first request in the queue is invalid, and returns a "short submission"
> > for errors in later entries.
>
> ===
> +bool laio_has_fdsync(int fd)
> +{
> + AioContext *ctx = qemu_get_current_aio_context();
> + struct qemu_laiocb cb = {
> + .co = qemu_coroutine_self(),
> + .ctx = aio_get_linux_aio(ctx),
> + };
> + struct iocb *iocbs[] = {&cb.iocb, NULL};
> +
> + /* check if host kernel supports IO_CMD_FDSYNC */
> + io_prep_fdsync(&cb.iocb, fd);
> + int ret = io_submit(cb.ctx->ctx, 1, iocbs);
> +
> + return ret != -EINVAL;
> +}
> ===
>
> To confirm:
> * Do we need a revised patch V3? I'm testing one with the above
> function to check if IO_CMD_FDSYNC is supported. If it returns true we
> call laio_co_submit(..., QEMU_AIO_FLUSH, ), else fallback to
> thread-pool.
If you are already developing and testing it then I think a v3 with
laio_has_fdsync() would be great.
Thanks,
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2024-03-12 14:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 5:43 [PATCH v2] linux-aio: add IO_CMD_FDSYNC command support Prasad Pandit
2024-03-11 13:09 ` Stefan Hajnoczi
2024-03-11 15:40 ` Kevin Wolf
2024-03-11 19:36 ` Stefan Hajnoczi
2024-03-12 9:45 ` Kevin Wolf
2024-03-12 13:37 ` Prasad Pandit
2024-03-12 14:45 ` Stefan Hajnoczi [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=20240312144543.GA411413@fedora \
--to=stefanha@redhat.com \
--cc=kwolf@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=ppandit@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).