1 | The following changes since commit d47a851caeda96d5979bf48d4bae6a87784ad91d: | 1 | The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170601' into staging (2017-06-02 14:07:53 +0100) | 3 | Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to df3a429ae82c0f45becdfab105617701d75e0f05: | 9 | for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0: |
10 | 10 | ||
11 | gluster: add support for PREALLOC_MODE_FALLOC (2017-06-02 10:51:47 -0400) | 11 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Gluster patch(es) | 14 | Pull request |
15 | |||
16 | Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd | ||
17 | improvements. | ||
18 | |||
15 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
16 | 20 | ||
17 | Niels de Vos (1): | 21 | Liu Yiding (1): |
18 | gluster: add support for PREALLOC_MODE_FALLOC | 22 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option |
19 | 23 | ||
20 | block/gluster.c | 78 ++++++++++++++++++++++++++++++--------------------------- | 24 | Sakshi Kaushik (1): |
21 | configure | 6 +++++ | 25 | Implements Backend Program conventions for vhost-user-scsi |
22 | 2 files changed, 47 insertions(+), 37 deletions(-) | 26 | |
27 | Stefan Hajnoczi (1): | ||
28 | contrib/vhost-user-blk: add missing GOptionEntry NULL terminator | ||
29 | |||
30 | docs/tools/virtiofsd.rst | 5 ++ | ||
31 | contrib/vhost-user-blk/vhost-user-blk.c | 3 +- | ||
32 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- | ||
33 | tools/virtiofsd/helper.c | 3 + | ||
34 | 4 files changed, 62 insertions(+), 26 deletions(-) | ||
23 | 35 | ||
24 | -- | 36 | -- |
25 | 2.9.3 | 37 | 2.35.1 |
26 | |||
27 | diff view generated by jsdifflib |
1 | From: Niels de Vos <ndevos@redhat.com> | 1 | From: Sakshi Kaushik <sakshikaushik717@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Add missing support for "preallocation=falloc" to the Gluster block | 3 | Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com> |
4 | driver. This change bases its logic on that of block/file-posix.c and | 4 | Message-id: 20220406162410.8536-1-sakshikaushik717@gmail.com |
5 | removed the gluster_supports_zerofill() and qemu_gluster_zerofill() | ||
6 | functions in favour of #ifdef checks in an easy to read | ||
7 | switch-statement. | ||
8 | 5 | ||
9 | Both glfs_zerofill() and glfs_fallocate() have been introduced with | 6 | [Name the iSCSI URL long option --iscsi-uri instead of --iscsi_uri for |
10 | GlusterFS 3.5.0 (pkg-config glusterfs-api = 6). A #define for the | 7 | consistency, fix --fd which was rejected due to an outdated |
11 | availability of glfs_fallocate() has been added to ./configure. | 8 | --socket-path check, and add missing entries[] terminator. |
9 | --Stefan] | ||
12 | 10 | ||
13 | Reported-by: Satheesaran Sundaramoorthi <sasundar@redhat.com> | 11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
14 | Signed-off-by: Niels de Vos <ndevos@redhat.com> | ||
15 | Message-id: 20170528063114.28691-1-ndevos@redhat.com | ||
16 | URL: https://bugzilla.redhat.com/1450759 | ||
17 | Signed-off-by: Niels de Vos <ndevos@redhat.com> | ||
18 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
19 | --- | 12 | --- |
20 | block/gluster.c | 78 ++++++++++++++++++++++++++++++--------------------------- | 13 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- |
21 | configure | 6 +++++ | 14 | 1 file changed, 52 insertions(+), 25 deletions(-) |
22 | 2 files changed, 47 insertions(+), 37 deletions(-) | ||
23 | 15 | ||
24 | diff --git a/block/gluster.c b/block/gluster.c | 16 | diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c |
25 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/block/gluster.c | 18 | --- a/contrib/vhost-user-scsi/vhost-user-scsi.c |
27 | +++ b/block/gluster.c | 19 | +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c |
28 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, | 20 | @@ -XXX,XX +XXX,XX @@ fail: |
29 | qemu_coroutine_yield(); | 21 | |
30 | return acb.ret; | 22 | /** vhost-user-scsi **/ |
31 | } | 23 | |
32 | - | 24 | +static int opt_fdnum = -1; |
33 | -static inline bool gluster_supports_zerofill(void) | 25 | +static char *opt_socket_path; |
34 | -{ | 26 | +static gboolean opt_print_caps; |
35 | - return 1; | 27 | +static char *iscsi_uri; |
36 | -} | 28 | + |
37 | - | 29 | +static GOptionEntry entries[] = { |
38 | -static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset, | 30 | + { "print-capabilities", 'c', 0, G_OPTION_ARG_NONE, &opt_print_caps, |
39 | - int64_t size) | 31 | + "Print capabilities", NULL }, |
40 | -{ | 32 | + { "fd", 'f', 0, G_OPTION_ARG_INT, &opt_fdnum, |
41 | - return glfs_zerofill(fd, offset, size); | 33 | + "Use inherited fd socket", "FDNUM" }, |
42 | -} | 34 | + { "iscsi-uri", 'i', 0, G_OPTION_ARG_FILENAME, &iscsi_uri, |
43 | - | 35 | + "iSCSI URI to connect to", "FDNUM" }, |
44 | -#else | 36 | + { "socket-path", 's', 0, G_OPTION_ARG_FILENAME, &opt_socket_path, |
45 | -static inline bool gluster_supports_zerofill(void) | 37 | + "Use UNIX socket path", "PATH" }, |
46 | -{ | 38 | + { NULL, } |
47 | - return 0; | 39 | +}; |
48 | -} | 40 | + |
49 | - | 41 | int main(int argc, char **argv) |
50 | -static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset, | 42 | { |
51 | - int64_t size) | 43 | VusDev *vdev_scsi = NULL; |
52 | -{ | 44 | - char *unix_fn = NULL; |
53 | - return 0; | 45 | - char *iscsi_uri = NULL; |
54 | -} | 46 | - int lsock = -1, csock = -1, opt, err = EXIT_SUCCESS; |
55 | #endif | 47 | + int lsock = -1, csock = -1, err = EXIT_SUCCESS; |
56 | 48 | ||
57 | static int qemu_gluster_create(const char *filename, | 49 | - while ((opt = getopt(argc, argv, "u:i:")) != -1) { |
58 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename, | 50 | - switch (opt) { |
59 | struct glfs *glfs; | 51 | - case 'h': |
60 | struct glfs_fd *fd; | 52 | - goto help; |
61 | int ret = 0; | 53 | - case 'u': |
62 | - int prealloc = 0; | 54 | - unix_fn = g_strdup(optarg); |
63 | + PreallocMode prealloc; | 55 | - break; |
64 | int64_t total_size = 0; | 56 | - case 'i': |
65 | char *tmp = NULL; | 57 | - iscsi_uri = g_strdup(optarg); |
66 | + Error *local_err = NULL; | 58 | - break; |
67 | 59 | - default: | |
68 | gconf = g_new0(BlockdevOptionsGluster, 1); | 60 | - goto help; |
69 | gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG, | 61 | - } |
70 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename, | 62 | + GError *error = NULL; |
71 | BDRV_SECTOR_SIZE); | 63 | + GOptionContext *context; |
72 | 64 | + | |
73 | tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC); | 65 | + context = g_option_context_new(NULL); |
74 | - if (!tmp || !strcmp(tmp, "off")) { | 66 | + g_option_context_add_main_entries(context, entries, NULL); |
75 | - prealloc = 0; | 67 | + if (!g_option_context_parse(context, &argc, &argv, &error)) { |
76 | - } else if (!strcmp(tmp, "full") && gluster_supports_zerofill()) { | 68 | + g_printerr("Option parsing failed: %s\n", error->message); |
77 | - prealloc = 1; | 69 | + exit(EXIT_FAILURE); |
78 | - } else { | ||
79 | - error_setg(errp, "Invalid preallocation mode: '%s'" | ||
80 | - " or GlusterFS doesn't support zerofill API", tmp); | ||
81 | + prealloc = qapi_enum_parse(PreallocMode_lookup, tmp, | ||
82 | + PREALLOC_MODE__MAX, PREALLOC_MODE_OFF, | ||
83 | + &local_err); | ||
84 | + g_free(tmp); | ||
85 | + if (local_err) { | ||
86 | + error_propagate(errp, local_err); | ||
87 | ret = -EINVAL; | ||
88 | goto out; | ||
89 | } | ||
90 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename, | ||
91 | O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); | ||
92 | if (!fd) { | ||
93 | ret = -errno; | ||
94 | - } else { | ||
95 | + goto out; | ||
96 | + } | 70 | + } |
97 | + | 71 | + |
98 | + switch (prealloc) { | 72 | + if (opt_print_caps) { |
99 | +#ifdef CONFIG_GLUSTERFS_FALLOCATE | 73 | + g_print("{\n"); |
100 | + case PREALLOC_MODE_FALLOC: | 74 | + g_print(" \"type\": \"scsi\"\n"); |
101 | + if (glfs_fallocate(fd, 0, 0, total_size)) { | 75 | + g_print("}\n"); |
102 | + error_setg(errp, "Could not preallocate data for the new file"); | 76 | + goto out; |
103 | + ret = -errno; | 77 | } |
78 | - if (!unix_fn || !iscsi_uri) { | ||
79 | + | ||
80 | + if (!iscsi_uri) { | ||
81 | goto help; | ||
82 | } | ||
83 | |||
84 | - lsock = unix_sock_new(unix_fn); | ||
85 | - if (lsock < 0) { | ||
86 | - goto err; | ||
87 | + if (opt_socket_path) { | ||
88 | + lsock = unix_sock_new(opt_socket_path); | ||
89 | + if (lsock < 0) { | ||
90 | + exit(EXIT_FAILURE); | ||
104 | + } | 91 | + } |
105 | + break; | 92 | + } else if (opt_fdnum < 0) { |
106 | +#endif /* CONFIG_GLUSTERFS_FALLOCATE */ | 93 | + g_print("%s\n", g_option_context_get_help(context, true, NULL)); |
107 | +#ifdef CONFIG_GLUSTERFS_ZEROFILL | 94 | + exit(EXIT_FAILURE); |
108 | + case PREALLOC_MODE_FULL: | 95 | + } else { |
109 | if (!glfs_ftruncate(fd, total_size)) { | 96 | + lsock = opt_fdnum; |
110 | - if (prealloc && qemu_gluster_zerofill(fd, 0, total_size)) { | ||
111 | + if (glfs_zerofill(fd, 0, total_size)) { | ||
112 | + error_setg(errp, "Could not zerofill the new file"); | ||
113 | ret = -errno; | ||
114 | } | ||
115 | } else { | ||
116 | + error_setg(errp, "Could not resize file"); | ||
117 | ret = -errno; | ||
118 | } | ||
119 | + break; | ||
120 | +#endif /* CONFIG_GLUSTERFS_ZEROFILL */ | ||
121 | + case PREALLOC_MODE_OFF: | ||
122 | + if (glfs_ftruncate(fd, total_size) != 0) { | ||
123 | + ret = -errno; | ||
124 | + error_setg(errp, "Could not resize file"); | ||
125 | + } | ||
126 | + break; | ||
127 | + default: | ||
128 | + ret = -EINVAL; | ||
129 | + error_setg(errp, "Unsupported preallocation mode: %s", | ||
130 | + PreallocMode_lookup[prealloc]); | ||
131 | + break; | ||
132 | + } | ||
133 | |||
134 | - if (glfs_close(fd) != 0) { | ||
135 | - ret = -errno; | ||
136 | - } | ||
137 | + if (glfs_close(fd) != 0) { | ||
138 | + ret = -errno; | ||
139 | } | 97 | } |
140 | out: | 98 | |
141 | - g_free(tmp); | 99 | csock = accept(lsock, NULL, NULL); |
142 | qapi_free_BlockdevOptionsGluster(gconf); | 100 | @@ -XXX,XX +XXX,XX @@ out: |
143 | glfs_clear_preopened(glfs); | 101 | if (vdev_scsi) { |
144 | return ret; | 102 | g_main_loop_unref(vdev_scsi->loop); |
145 | diff --git a/configure b/configure | 103 | g_free(vdev_scsi); |
146 | index XXXXXXX..XXXXXXX 100755 | 104 | - unlink(unix_fn); |
147 | --- a/configure | 105 | + unlink(opt_socket_path); |
148 | +++ b/configure | 106 | } |
149 | @@ -XXX,XX +XXX,XX @@ seccomp="" | 107 | if (csock >= 0) { |
150 | glusterfs="" | 108 | close(csock); |
151 | glusterfs_xlator_opt="no" | 109 | @@ -XXX,XX +XXX,XX @@ out: |
152 | glusterfs_discard="no" | 110 | if (lsock >= 0) { |
153 | +glusterfs_fallocate="no" | 111 | close(lsock); |
154 | glusterfs_zerofill="no" | 112 | } |
155 | gtk="" | 113 | - g_free(unix_fn); |
156 | gtkabi="" | 114 | + g_free(opt_socket_path); |
157 | @@ -XXX,XX +XXX,XX @@ if test "$glusterfs" != "no" ; then | 115 | g_free(iscsi_uri); |
158 | glusterfs_discard="yes" | 116 | |
159 | fi | 117 | return err; |
160 | if $pkg_config --atleast-version=6 glusterfs-api; then | 118 | @@ -XXX,XX +XXX,XX @@ err: |
161 | + glusterfs_fallocate="yes" | 119 | goto out; |
162 | glusterfs_zerofill="yes" | 120 | |
163 | fi | 121 | help: |
164 | else | 122 | - fprintf(stderr, "Usage: %s [ -u unix_sock_path -i iscsi_uri ] | [ -h ]\n", |
165 | @@ -XXX,XX +XXX,XX @@ if test "$glusterfs_discard" = "yes" ; then | 123 | + fprintf(stderr, "Usage: %s [ -s socket-path -i iscsi-uri -f fd -p print-capabilities ] | [ -h ]\n", |
166 | echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak | 124 | argv[0]); |
167 | fi | 125 | - fprintf(stderr, " -u path to unix socket\n"); |
168 | 126 | - fprintf(stderr, " -i iscsi uri for lun 0\n"); | |
169 | +if test "$glusterfs_fallocate" = "yes" ; then | 127 | + fprintf(stderr, " -s, --socket-path=SOCKET_PATH path to unix socket\n"); |
170 | + echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak | 128 | + fprintf(stderr, " -i, --iscsi-uri=ISCSI_URI iscsi uri for lun 0\n"); |
171 | +fi | 129 | + fprintf(stderr, " -f, --fd=FILE_DESCRIPTOR file-descriptor\n"); |
172 | + | 130 | + fprintf(stderr, " -p, --print-capabilities=PRINT_CAPABILITIES denotes print-capabilities\n"); |
173 | if test "$glusterfs_zerofill" = "yes" ; then | 131 | fprintf(stderr, " -h print help and quit\n"); |
174 | echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak | 132 | |
175 | fi | 133 | goto err; |
176 | -- | 134 | -- |
177 | 2.9.3 | 135 | 2.35.1 |
178 | |||
179 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The GLib documentation says "a NULL-terminated array of GOptionEntrys" | ||
2 | so we'd better make sure there is a terminator that lets | ||
3 | g_option_context_add_main_entries() know when the end of the array has | ||
4 | been reached. | ||
1 | 5 | ||
6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
7 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
8 | Message-id: 20220411150057.3009667-1-stefanha@redhat.com | ||
9 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
10 | --- | ||
11 | contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- | ||
12 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/contrib/vhost-user-blk/vhost-user-blk.c | ||
17 | +++ b/contrib/vhost-user-blk/vhost-user-blk.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static GOptionEntry entries[] = { | ||
19 | {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file, | ||
20 | "block device or file path", "PATH"}, | ||
21 | { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only, | ||
22 | - "Enable read-only", NULL } | ||
23 | + "Enable read-only", NULL }, | ||
24 | + { NULL, }, | ||
25 | }; | ||
26 | |||
27 | int main(int argc, char **argv) | ||
28 | -- | ||
29 | 2.35.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Liu Yiding <liuyd.fnst@fujitsu.com> | ||
1 | 2 | ||
3 | virtiofsd has introduced killpriv_v2/no_killpriv_v2 for a while. Add | ||
4 | description of it to docs/helper. | ||
5 | |||
6 | Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com> | ||
7 | Message-Id: <20220421095151.2231099-1-liuyd.fnst@fujitsu.com> | ||
8 | |||
9 | [Small documentation fixes: s/as client supports/as the client supports/ | ||
10 | and s/. /. /. | ||
11 | --Stefan] | ||
12 | |||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
14 | --- | ||
15 | docs/tools/virtiofsd.rst | 5 +++++ | ||
16 | tools/virtiofsd/helper.c | 3 +++ | ||
17 | 2 files changed, 8 insertions(+) | ||
18 | |||
19 | diff --git a/docs/tools/virtiofsd.rst b/docs/tools/virtiofsd.rst | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/docs/tools/virtiofsd.rst | ||
22 | +++ b/docs/tools/virtiofsd.rst | ||
23 | @@ -XXX,XX +XXX,XX @@ Options | ||
24 | label. Server will try to set that label on newly created file | ||
25 | atomically wherever possible. | ||
26 | |||
27 | + * killpriv_v2|no_killpriv_v2 - | ||
28 | + Enable/disable ``FUSE_HANDLE_KILLPRIV_V2`` support. KILLPRIV_V2 is enabled | ||
29 | + by default as long as the client supports it. Enabling this option helps | ||
30 | + with performance in write path. | ||
31 | + | ||
32 | .. option:: --socket-path=PATH | ||
33 | |||
34 | Listen on vhost-user UNIX domain socket at PATH. | ||
35 | diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/tools/virtiofsd/helper.c | ||
38 | +++ b/tools/virtiofsd/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ void fuse_cmdline_help(void) | ||
40 | " -o announce_submounts Announce sub-mount points to the guest\n" | ||
41 | " -o posix_acl/no_posix_acl Enable/Disable posix_acl. (default: disabled)\n" | ||
42 | " -o security_label/no_security_label Enable/Disable security label. (default: disabled)\n" | ||
43 | + " -o killpriv_v2/no_killpriv_v2\n" | ||
44 | + " Enable/Disable FUSE_HANDLE_KILLPRIV_V2.\n" | ||
45 | + " (default: enabled as long as client supports it)\n" | ||
46 | ); | ||
47 | } | ||
48 | |||
49 | -- | ||
50 | 2.35.1 | diff view generated by jsdifflib |