From: Stefan Hajnoczi <stefanha@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org
Subject: Re: [PATCH 2/2] block/blkio: use blkio_set_int("fd") to check fd support
Date: Tue, 25 Jul 2023 16:05:38 -0400 [thread overview]
Message-ID: <20230725200538.GC749269@fedora> (raw)
In-Reply-To: <20230724154611.178858-3-sgarzare@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]
On Mon, Jul 24, 2023 at 05:46:11PM +0200, Stefano Garzarella wrote:
> The way the virtio-blk driver is implemented in libblkio,
> it's much easier to use blkio_set_int() instead of blkio_get_int()
> and have it fail right away to see if `fd` is supported by the
> transport. See https://gitlab.com/libblkio/libblkio/-/merge_requests/208
The commit description is vague about what's going on here. My
understanding is:
Setting the `fd` property fails with virtio-blk-* libblkio drivers
that do not support fd passing since
https://gitlab.com/libblkio/libblkio/-/merge_requests/208.
Getting the `fd` property, on the other hand, always succeeds for
virtio-blk-* libblkio drivers even when they don't support fd passing.
This patch switches to setting the `fd` property because it is a
better mechanism for probing fd passing support than getting the `fd`
property.
Please update the commit description. Thanks!
>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
> block/blkio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/block/blkio.c b/block/blkio.c
> index ca1149042a..719b19324b 100644
> --- a/block/blkio.c
> +++ b/block/blkio.c
> @@ -665,7 +665,7 @@ static int blkio_virtio_blk_common_open(BlockDriverState *bs,
> const char *blkio_driver = bs->drv->protocol_name;
> BDRVBlkioState *s = bs->opaque;
> bool fd_supported = false;
> - int fd, ret;
> + int ret;
>
> if (!path) {
> error_setg(errp, "missing 'path' option");
> @@ -678,7 +678,7 @@ static int blkio_virtio_blk_common_open(BlockDriverState *bs,
> }
>
> if (strcmp(blkio_driver, "virtio-blk-vhost-vdpa") == 0 &&
> - blkio_get_int(s->blkio, "fd", &fd) == 0) {
> + blkio_set_int(s->blkio, "fd", -1) == 0) {
> fd_supported = true;
> }
>
> @@ -688,7 +688,7 @@ static int blkio_virtio_blk_common_open(BlockDriverState *bs,
> * layer through the "/dev/fdset/N" special path.
> */
> if (fd_supported) {
> - int open_flags;
> + int open_flags, fd;
>
> if (flags & BDRV_O_RDWR) {
> open_flags = O_RDWR;
> --
> 2.41.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-07-25 20:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 15:46 [PATCH 0/2] block/blkio: fix opening virtio-blk drivers Stefano Garzarella
2023-07-24 15:46 ` [PATCH 1/2] " Stefano Garzarella
2023-07-25 20:00 ` Stefan Hajnoczi
2023-07-26 7:26 ` Stefano Garzarella
2023-07-26 15:32 ` Stefan Hajnoczi
2023-07-26 15:45 ` Stefano Garzarella
2023-07-24 15:46 ` [PATCH 2/2] block/blkio: use blkio_set_int("fd") to check fd support Stefano Garzarella
2023-07-25 20:05 ` Stefan Hajnoczi [this message]
2023-07-26 7:28 ` Stefano Garzarella
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=20230725200538.GC749269@fedora \
--to=stefanha@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.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;
as well as URLs for NNTP newsgroup(s).