* [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename"
@ 2022-10-28 23:38 Alberto Faria
2022-10-29 6:05 ` Markus Armbruster
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Alberto Faria @ 2022-10-28 23:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eric Blake, Markus Armbruster, Kevin Wolf, qemu-block,
Hanna Reitz, Stefan Hajnoczi, Alberto Faria
The nvme-io_uring driver expects a character special file such as
/dev/ng0n1. Follow the convention of having a "filename" option when a
regular file is expected, and a "path" option otherwise.
This makes io_uring the only libblkio-based driver with a "filename"
option, as it accepts a regular file (even though it can also take a
block special file).
Signed-off-by: Alberto Faria <afaria@redhat.com>
---
block/blkio.c | 12 ++++++++----
qapi/block-core.json | 4 ++--
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/block/blkio.c b/block/blkio.c
index 82f26eedd2..5f600e5e9e 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -639,12 +639,17 @@ static int blkio_io_uring_open(BlockDriverState *bs, QDict *options, int flags,
static int blkio_nvme_io_uring(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
- const char *filename = qdict_get_str(options, "filename");
+ const char *path = qdict_get_try_str(options, "path");
BDRVBlkioState *s = bs->opaque;
int ret;
- ret = blkio_set_str(s->blkio, "path", filename);
- qdict_del(options, "filename");
+ if (!path) {
+ error_setg(errp, "missing 'path' option");
+ return -EINVAL;
+ }
+
+ ret = blkio_set_str(s->blkio, "path", path);
+ qdict_del(options, "path");
if (ret < 0) {
error_setg_errno(errp, -ret, "failed to set path: %s",
blkio_get_error_msg());
@@ -986,7 +991,6 @@ static BlockDriver bdrv_io_uring = BLKIO_DRIVER(
static BlockDriver bdrv_nvme_io_uring = BLKIO_DRIVER(
DRIVER_NVME_IO_URING,
- .bdrv_needs_filename = true,
);
static BlockDriver bdrv_virtio_blk_vhost_user = BLKIO_DRIVER(
diff --git a/qapi/block-core.json b/qapi/block-core.json
index cb5079e645..6d36c0ed8b 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -3703,12 +3703,12 @@
#
# Driver specific block device options for the nvme-io_uring backend.
#
-# @filename: path to the image file
+# @path: path to the image file
#
# Since: 7.2
##
{ 'struct': 'BlockdevOptionsNvmeIoUring',
- 'data': { 'filename': 'str' },
+ 'data': { 'path': 'str' },
'if': 'CONFIG_BLKIO' }
##
--
2.38.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename"
2022-10-28 23:38 [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename" Alberto Faria
@ 2022-10-29 6:05 ` Markus Armbruster
2022-10-29 9:50 ` Alberto Faria
2022-10-31 18:35 ` Stefan Hajnoczi
2022-11-02 9:21 ` Stefano Garzarella
2 siblings, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2022-10-29 6:05 UTC (permalink / raw)
To: Alberto Faria
Cc: qemu-devel, Eric Blake, Kevin Wolf, qemu-block, Hanna Reitz,
Stefan Hajnoczi
Alberto Faria <afaria@redhat.com> writes:
> The nvme-io_uring driver expects a character special file such as
> /dev/ng0n1. Follow the convention of having a "filename" option when a
> regular file is expected, and a "path" option otherwise.
I suspect this is by accident, not by design. Is it desirable?
> This makes io_uring the only libblkio-based driver with a "filename"
> option, as it accepts a regular file (even though it can also take a
> block special file).
>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
Patch does not apply to master (344744e148e). What's your base?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename"
2022-10-29 6:05 ` Markus Armbruster
@ 2022-10-29 9:50 ` Alberto Faria
2022-10-31 18:23 ` Stefan Hajnoczi
0 siblings, 1 reply; 6+ messages in thread
From: Alberto Faria @ 2022-10-29 9:50 UTC (permalink / raw)
To: Markus Armbruster
Cc: qemu-devel, Eric Blake, Kevin Wolf, qemu-block, Hanna Reitz,
Stefan Hajnoczi
On Sat, Oct 29, 2022 at 7:05 AM Markus Armbruster <armbru@redhat.com> wrote:
> Alberto Faria <afaria@redhat.com> writes:
>
> > The nvme-io_uring driver expects a character special file such as
> > /dev/ng0n1. Follow the convention of having a "filename" option when a
> > regular file is expected, and a "path" option otherwise.
>
> I suspect this is by accident, not by design. Is it desirable?
I'm not sure. Naturally I'd be happier if either "filename" or "path"
was used everywhere. Maybe we should settle on a single one for all
the libblkio drivers? Or maybe we should just leave things as is?
> > This makes io_uring the only libblkio-based driver with a "filename"
> > option, as it accepts a regular file (even though it can also take a
> > block special file).
> >
> > Signed-off-by: Alberto Faria <afaria@redhat.com>
>
> Patch does not apply to master (344744e148e). What's your base?
I forgot to mention this is based on Stefan's block tree:
https://gitlab.com/stefanha/qemu/-/commits/block
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename"
2022-10-29 9:50 ` Alberto Faria
@ 2022-10-31 18:23 ` Stefan Hajnoczi
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2022-10-31 18:23 UTC (permalink / raw)
To: Alberto Faria
Cc: Markus Armbruster, qemu-devel, Eric Blake, Kevin Wolf, qemu-block,
Hanna Reitz
[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]
On Sat, Oct 29, 2022 at 10:50:40AM +0100, Alberto Faria wrote:
> On Sat, Oct 29, 2022 at 7:05 AM Markus Armbruster <armbru@redhat.com> wrote:
> > Alberto Faria <afaria@redhat.com> writes:
> >
> > > The nvme-io_uring driver expects a character special file such as
> > > /dev/ng0n1. Follow the convention of having a "filename" option when a
> > > regular file is expected, and a "path" option otherwise.
> >
> > I suspect this is by accident, not by design. Is it desirable?
>
> I'm not sure. Naturally I'd be happier if either "filename" or "path"
> was used everywhere. Maybe we should settle on a single one for all
> the libblkio drivers? Or maybe we should just leave things as is?
It wasn't an accident but maybe it was still a bad idea on my part.
My thinking was that io_uring takes regular files and therefore the
"filename" option name is appropriate. UNIX domain sockets and special
devices usually have the "path" option name (e.g. --chardev socket,path=
for AF_UNIX).
I agree with changing the option to "path" for nvme-io_uring.
The overall naming strategy is debatable. I think we can keep it, but if
the majority wants everything to be "filename" or "path" I'd be okay
with that.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename"
2022-10-28 23:38 [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename" Alberto Faria
2022-10-29 6:05 ` Markus Armbruster
@ 2022-10-31 18:35 ` Stefan Hajnoczi
2022-11-02 9:21 ` Stefano Garzarella
2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2022-10-31 18:35 UTC (permalink / raw)
To: Alberto Faria
Cc: qemu-devel, Eric Blake, Markus Armbruster, Kevin Wolf, qemu-block,
Hanna Reitz
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
On Sat, Oct 29, 2022 at 12:38:54AM +0100, Alberto Faria wrote:
> The nvme-io_uring driver expects a character special file such as
> /dev/ng0n1. Follow the convention of having a "filename" option when a
> regular file is expected, and a "path" option otherwise.
>
> This makes io_uring the only libblkio-based driver with a "filename"
> option, as it accepts a regular file (even though it can also take a
> block special file).
>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
> ---
> block/blkio.c | 12 ++++++++----
> qapi/block-core.json | 4 ++--
> 2 files changed, 10 insertions(+), 6 deletions(-)
I have applied this so I can prepare a final pull request for QEMU 7.2.
If we decide to follow a different naming strategy in the next day (QEMU
soft freeze) then I'll drop the patch, but for now I think this is the
most likely way forward.
Thanks, applied to my block tree:
https://gitlab.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename"
2022-10-28 23:38 [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename" Alberto Faria
2022-10-29 6:05 ` Markus Armbruster
2022-10-31 18:35 ` Stefan Hajnoczi
@ 2022-11-02 9:21 ` Stefano Garzarella
2 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2022-11-02 9:21 UTC (permalink / raw)
To: Alberto Faria
Cc: qemu-devel, Eric Blake, Markus Armbruster, Kevin Wolf, qemu-block,
Hanna Reitz, Stefan Hajnoczi
On Sat, Oct 29, 2022 at 12:38:54AM +0100, Alberto Faria wrote:
>The nvme-io_uring driver expects a character special file such as
>/dev/ng0n1. Follow the convention of having a "filename" option when a
>regular file is expected, and a "path" option otherwise.
>
>This makes io_uring the only libblkio-based driver with a "filename"
>option, as it accepts a regular file (even though it can also take a
>block special file).
>
>Signed-off-by: Alberto Faria <afaria@redhat.com>
>---
> block/blkio.c | 12 ++++++++----
> qapi/block-core.json | 4 ++--
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
>diff --git a/block/blkio.c b/block/blkio.c
>index 82f26eedd2..5f600e5e9e 100644
>--- a/block/blkio.c
>+++ b/block/blkio.c
>@@ -639,12 +639,17 @@ static int blkio_io_uring_open(BlockDriverState *bs, QDict *options, int flags,
> static int blkio_nvme_io_uring(BlockDriverState *bs, QDict *options, int flags,
> Error **errp)
> {
>- const char *filename = qdict_get_str(options, "filename");
>+ const char *path = qdict_get_try_str(options, "path");
> BDRVBlkioState *s = bs->opaque;
> int ret;
>
>- ret = blkio_set_str(s->blkio, "path", filename);
>- qdict_del(options, "filename");
>+ if (!path) {
>+ error_setg(errp, "missing 'path' option");
>+ return -EINVAL;
>+ }
>+
>+ ret = blkio_set_str(s->blkio, "path", path);
>+ qdict_del(options, "path");
> if (ret < 0) {
> error_setg_errno(errp, -ret, "failed to set path: %s",
> blkio_get_error_msg());
>@@ -986,7 +991,6 @@ static BlockDriver bdrv_io_uring = BLKIO_DRIVER(
>
> static BlockDriver bdrv_nvme_io_uring = BLKIO_DRIVER(
> DRIVER_NVME_IO_URING,
>- .bdrv_needs_filename = true,
> );
>
> static BlockDriver bdrv_virtio_blk_vhost_user = BLKIO_DRIVER(
>diff --git a/qapi/block-core.json b/qapi/block-core.json
>index cb5079e645..6d36c0ed8b 100644
>--- a/qapi/block-core.json
>+++ b/qapi/block-core.json
>@@ -3703,12 +3703,12 @@
> #
> # Driver specific block device options for the nvme-io_uring backend.
> #
>-# @filename: path to the image file
>+# @path: path to the image file
Maybe we can update the "path" description with something similar to
what we have in the libblkio docs:
path to the NVMe namespace's character device (e.g., `/dev/ng0n1`).
Thanks,
Stefano
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-02 9:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-28 23:38 [PATCH] block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename" Alberto Faria
2022-10-29 6:05 ` Markus Armbruster
2022-10-29 9:50 ` Alberto Faria
2022-10-31 18:23 ` Stefan Hajnoczi
2022-10-31 18:35 ` Stefan Hajnoczi
2022-11-02 9:21 ` Stefano Garzarella
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).