From: "Marco Cavenati" <Marco.Cavenati@eurecom.fr>
To: "Prasad Pandit" <ppandit@redhat.com>
Cc: "Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
qemu-devel@nongnu.org
Subject: Re: [PATCH] migration: add FEATURE_SEEKABLE to QIOChannelBlock
Date: Tue, 08 Apr 2025 17:03:15 +0200 [thread overview]
Message-ID: <483a7-67f53a80-989-1b9677a0@18488120> (raw)
In-Reply-To: <CAE8KmOyL_HJ6p2AZPedYbiDpeNH2LKj+wodF-nX3OgcH8Aq4jA@mail.gmail.com>
On Tuesday, April 08, 2025 07:25 CEST, Prasad Pandit <ppandit@redhat.com> wrote:
> * _channel_preadv/_writev functions are generic. They are independent
> of whether the underlying channel is file or socket or memory or
> something else. They are called if and when they are defined and they
> in turn call channel specific preadv/pwritev functions.
>
> if (!klass->io_pwritev) {
> error_setg(errp, "Channel does not support pwritev");
> return -1;
> }
They also require QIO_CHANNEL_FEATURE_SEEKABLE.
if (!qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_SEEKABLE)) {
error_setg_errno(errp, EINVAL, "Requested channel is not seekable");
return -1;
}
> * io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file
> -> https://gitlab.com/qemu-project/qemu/-/commit/401e311ff72e0a62c834bfe466de68a82cfd90cb
>
> This commit sets the *_FEATURE_SEEKABLE flag for the file channel
> when the lseek(2) call succeeds.
The QIOChannelBlock io_seek (qio_channel_block_seek) function
cannot fail for SEEK_CUR, no need to check.
> * ie. 'file' OR 'fd' channel is seekable when lseek(2) call works.
> Similarly Block channel would be seekable when ->io_seek() method is
> defined and it works. And ->io_seek() method is also called if and
> when it is defined
>
> qio_channel_io_seek
> if (!klass->io_seek) {
> error_setg(errp, "Channel does not support random
> access");
> return -1;
> }
>
> Setting '*_FEATURE_SEEKABLE' for the block channel does not ensure
> that ->io_seek() is defined and works.
QIOChannelBlock io_seek is always implemented and works
(except for SEEK_END).
> It seems redundant that way.
I'm not sure I understand what you mean here.
TLDR: QIOChannelBlock is already always seekable, this patch just adds
the capability explicitly so that it will work with mapped-ram.
Best
Marco
next prev parent reply other threads:[~2025-04-08 15:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 14:14 [PATCH] migration: add FEATURE_SEEKABLE to QIOChannelBlock Marco Cavenati
2025-04-04 8:19 ` Prasad Pandit
2025-04-04 9:04 ` Marco Cavenati
2025-04-04 10:14 ` Prasad Pandit
2025-04-04 12:05 ` Marco Cavenati
2025-04-07 6:47 ` Prasad Pandit
2025-04-07 9:00 ` Marco Cavenati
2025-04-08 5:25 ` Prasad Pandit
2025-04-08 15:03 ` Marco Cavenati [this message]
2025-04-15 10:21 ` Daniel P. Berrangé
2025-04-15 10:44 ` Prasad Pandit
2025-04-15 11:03 ` Daniel P. Berrangé
2025-04-15 11:57 ` Prasad Pandit
2025-04-15 12:03 ` Daniel P. Berrangé
2025-04-10 19:52 ` Fabiano Rosas
2025-04-11 8:48 ` Marco Cavenati
2025-04-11 12:24 ` Fabiano Rosas
2025-04-15 10:15 ` Marco Cavenati
2025-04-15 13:50 ` Fabiano Rosas
2025-04-17 9:10 ` Marco Cavenati
2025-04-17 15:12 ` Fabiano Rosas
2025-04-24 13:44 ` Marco Cavenati
2025-05-08 20:23 ` Peter Xu
2025-05-09 12:51 ` Marco Cavenati
2025-05-09 16:21 ` Peter Xu
2025-05-09 21:14 ` Marco Cavenati
2025-05-09 22:04 ` Peter Xu
2025-09-16 16:06 ` Marco Cavenati
2025-09-19 21:24 ` Fabiano Rosas
2025-09-22 15:51 ` Marco Cavenati
2025-09-30 20:12 ` Fabiano Rosas
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=483a7-67f53a80-989-1b9677a0@18488120 \
--to=marco.cavenati@eurecom.fr \
--cc=farosas@suse.de \
--cc=peterx@redhat.com \
--cc=ppandit@redhat.com \
--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).