* [PATCH] gluster: stop using .bdrv_needs_filename
@ 2022-08-11 16:49 Stefan Hajnoczi
2022-09-22 16:09 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2022-08-11 16:49 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, hreitz, integration, Kevin Wolf, Stefan Hajnoczi,
Prasanna Kumar Kalever
The gluster protocol driver used to parse URIs (filenames) but was
extended with a richer JSON syntax in commit 6c7189bb29de
("block/gluster: add support for multiple gluster servers"). The gluster
drivers that have JSON parsing set .bdrv_needs_filename to false.
The gluster+unix and gluster+rdma drivers still to require a filename
even though the JSON parser is equipped to parse the same
volume/path/sockaddr details as the URI parser. Let's allow JSON parsing
for these drivers too.
Note that the gluster+rdma driver actually uses TCP because RDMA support
is not available, so the JSON server.type field must be "inet".
Drop .bdrv_needs_filename since both the filename and the JSON parsers
can handle gluster+unix and gluster+rdma. This change is in preparation
for eventually removing .bdrv_needs_filename across the entire codebase.
Cc: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
My motivation was to remove .bdrv_needs_filename across the entire
codebase, but my confidence in avoiding regressions is too low so I gave
up. There is too much magic around the filename. Most drivers don't want
a "filename" QDict entry although .bdrv_parse_filename() places the
filename string there temporarily. But file-posix does want a "filename"
QDict entry so it breaks when we remove .bdrv_needs_filename. I'm pretty
sure it's accidental complexity but it's hard to simplify without
breaking block drivers.
This gluster patch can be merged though, so I'm sending it.
block/gluster.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
index b60213ab80..bb1144cf6a 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -1555,7 +1555,6 @@ static BlockDriver bdrv_gluster = {
.format_name = "gluster",
.protocol_name = "gluster",
.instance_size = sizeof(BDRVGlusterState),
- .bdrv_needs_filename = false,
.bdrv_file_open = qemu_gluster_open,
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
@@ -1585,7 +1584,6 @@ static BlockDriver bdrv_gluster_tcp = {
.format_name = "gluster",
.protocol_name = "gluster+tcp",
.instance_size = sizeof(BDRVGlusterState),
- .bdrv_needs_filename = false,
.bdrv_file_open = qemu_gluster_open,
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
@@ -1615,7 +1613,6 @@ static BlockDriver bdrv_gluster_unix = {
.format_name = "gluster",
.protocol_name = "gluster+unix",
.instance_size = sizeof(BDRVGlusterState),
- .bdrv_needs_filename = true,
.bdrv_file_open = qemu_gluster_open,
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
@@ -1651,7 +1648,6 @@ static BlockDriver bdrv_gluster_rdma = {
.format_name = "gluster",
.protocol_name = "gluster+rdma",
.instance_size = sizeof(BDRVGlusterState),
- .bdrv_needs_filename = true,
.bdrv_file_open = qemu_gluster_open,
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
--
2.37.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gluster: stop using .bdrv_needs_filename
2022-08-11 16:49 [PATCH] gluster: stop using .bdrv_needs_filename Stefan Hajnoczi
@ 2022-09-22 16:09 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2022-09-22 16:09 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-devel, qemu-block, hreitz, integration,
Prasanna Kumar Kalever
Am 11.08.2022 um 18:49 hat Stefan Hajnoczi geschrieben:
> The gluster protocol driver used to parse URIs (filenames) but was
> extended with a richer JSON syntax in commit 6c7189bb29de
> ("block/gluster: add support for multiple gluster servers"). The gluster
> drivers that have JSON parsing set .bdrv_needs_filename to false.
>
> The gluster+unix and gluster+rdma drivers still to require a filename
> even though the JSON parser is equipped to parse the same
> volume/path/sockaddr details as the URI parser. Let's allow JSON parsing
> for these drivers too.
>
> Note that the gluster+rdma driver actually uses TCP because RDMA support
> is not available, so the JSON server.type field must be "inet".
>
> Drop .bdrv_needs_filename since both the filename and the JSON parsers
> can handle gluster+unix and gluster+rdma. This change is in preparation
> for eventually removing .bdrv_needs_filename across the entire codebase.
>
> Cc: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-22 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-11 16:49 [PATCH] gluster: stop using .bdrv_needs_filename Stefan Hajnoczi
2022-09-22 16:09 ` Kevin Wolf
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).