1 | The following changes since commit d47a851caeda96d5979bf48d4bae6a87784ad91d: | 1 | The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170601' into staging (2017-06-02 14:07:53 +0100) | 3 | Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -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 1cc7eada97914f090125e588497986f6f7900514: |
10 | 10 | ||
11 | gluster: add support for PREALLOC_MODE_FALLOC (2017-06-02 10:51:47 -0400) | 11 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Gluster patch(es) | 14 | Pull request |
15 | |||
15 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
16 | 17 | ||
17 | Niels de Vos (1): | 18 | Stefano Garzarella (2): |
18 | gluster: add support for PREALLOC_MODE_FALLOC | 19 | iothread: rename PollParamInfo to IOThreadParamInfo |
20 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() | ||
19 | 21 | ||
20 | block/gluster.c | 78 ++++++++++++++++++++++++++++++--------------------------- | 22 | iothread.c | 28 +++++++++++++++------------- |
21 | configure | 6 +++++ | 23 | 1 file changed, 15 insertions(+), 13 deletions(-) |
22 | 2 files changed, 47 insertions(+), 37 deletions(-) | ||
23 | 24 | ||
24 | -- | 25 | -- |
25 | 2.9.3 | 26 | 2.31.1 |
26 | 27 | ||
27 | 28 | ||
29 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Stefano Garzarella <sgarzare@redhat.com> | ||
1 | 2 | ||
3 | Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added | ||
4 | a new parameter (aio-max-batch) to IOThread and used PollParamInfo | ||
5 | structure to handle it. | ||
6 | |||
7 | Since it is not a parameter of the polling mechanism, we rename the | ||
8 | structure to a more generic IOThreadParamInfo. | ||
9 | |||
10 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20210727145936.147032-2-sgarzare@redhat.com | ||
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
15 | --- | ||
16 | iothread.c | 14 +++++++------- | ||
17 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
18 | |||
19 | diff --git a/iothread.c b/iothread.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/iothread.c | ||
22 | +++ b/iothread.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp) | ||
24 | typedef struct { | ||
25 | const char *name; | ||
26 | ptrdiff_t offset; /* field's byte offset in IOThread struct */ | ||
27 | -} PollParamInfo; | ||
28 | +} IOThreadParamInfo; | ||
29 | |||
30 | -static PollParamInfo poll_max_ns_info = { | ||
31 | +static IOThreadParamInfo poll_max_ns_info = { | ||
32 | "poll-max-ns", offsetof(IOThread, poll_max_ns), | ||
33 | }; | ||
34 | -static PollParamInfo poll_grow_info = { | ||
35 | +static IOThreadParamInfo poll_grow_info = { | ||
36 | "poll-grow", offsetof(IOThread, poll_grow), | ||
37 | }; | ||
38 | -static PollParamInfo poll_shrink_info = { | ||
39 | +static IOThreadParamInfo poll_shrink_info = { | ||
40 | "poll-shrink", offsetof(IOThread, poll_shrink), | ||
41 | }; | ||
42 | -static PollParamInfo aio_max_batch_info = { | ||
43 | +static IOThreadParamInfo aio_max_batch_info = { | ||
44 | "aio-max-batch", offsetof(IOThread, aio_max_batch), | ||
45 | }; | ||
46 | |||
47 | @@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v, | ||
48 | const char *name, void *opaque, Error **errp) | ||
49 | { | ||
50 | IOThread *iothread = IOTHREAD(obj); | ||
51 | - PollParamInfo *info = opaque; | ||
52 | + IOThreadParamInfo *info = opaque; | ||
53 | int64_t *field = (void *)iothread + info->offset; | ||
54 | |||
55 | visit_type_int64(v, name, field, errp); | ||
56 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, | ||
57 | const char *name, void *opaque, Error **errp) | ||
58 | { | ||
59 | IOThread *iothread = IOTHREAD(obj); | ||
60 | - PollParamInfo *info = opaque; | ||
61 | + IOThreadParamInfo *info = opaque; | ||
62 | int64_t *field = (void *)iothread + info->offset; | ||
63 | int64_t value; | ||
64 | |||
65 | -- | ||
66 | 2.31.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
1 | From: Niels de Vos <ndevos@redhat.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Add missing support for "preallocation=falloc" to the Gluster block | 3 | Commit 0445409d74 ("iothread: generalize |
4 | driver. This change bases its logic on that of block/file-posix.c and | 4 | iothread_set_param/iothread_get_param") moved common code to set and |
5 | removed the gluster_supports_zerofill() and qemu_gluster_zerofill() | 5 | get IOThread parameters in two new functions. |
6 | functions in favour of #ifdef checks in an easy to read | ||
7 | switch-statement. | ||
8 | 6 | ||
9 | Both glfs_zerofill() and glfs_fallocate() have been introduced with | 7 | These functions are called inside callbacks, so we don't need to use an |
10 | GlusterFS 3.5.0 (pkg-config glusterfs-api = 6). A #define for the | 8 | opaque pointer. Let's replace `void *opaque` parameter with |
11 | availability of glfs_fallocate() has been added to ./configure. | 9 | `IOThreadParamInfo *info`. |
12 | 10 | ||
13 | Reported-by: Satheesaran Sundaramoorthi <sasundar@redhat.com> | 11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> |
14 | Signed-off-by: Niels de Vos <ndevos@redhat.com> | 12 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
15 | Message-id: 20170528063114.28691-1-ndevos@redhat.com | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
16 | URL: https://bugzilla.redhat.com/1450759 | 14 | Message-id: 20210727145936.147032-3-sgarzare@redhat.com |
17 | Signed-off-by: Niels de Vos <ndevos@redhat.com> | 15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
18 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
19 | --- | 16 | --- |
20 | block/gluster.c | 78 ++++++++++++++++++++++++++++++--------------------------- | 17 | iothread.c | 18 ++++++++++-------- |
21 | configure | 6 +++++ | 18 | 1 file changed, 10 insertions(+), 8 deletions(-) |
22 | 2 files changed, 47 insertions(+), 37 deletions(-) | ||
23 | 19 | ||
24 | diff --git a/block/gluster.c b/block/gluster.c | 20 | diff --git a/iothread.c b/iothread.c |
25 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/block/gluster.c | 22 | --- a/iothread.c |
27 | +++ b/block/gluster.c | 23 | +++ b/iothread.c |
28 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, | 24 | @@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = { |
29 | qemu_coroutine_yield(); | 25 | }; |
30 | return acb.ret; | 26 | |
27 | static void iothread_get_param(Object *obj, Visitor *v, | ||
28 | - const char *name, void *opaque, Error **errp) | ||
29 | + const char *name, IOThreadParamInfo *info, Error **errp) | ||
30 | { | ||
31 | IOThread *iothread = IOTHREAD(obj); | ||
32 | - IOThreadParamInfo *info = opaque; | ||
33 | int64_t *field = (void *)iothread + info->offset; | ||
34 | |||
35 | visit_type_int64(v, name, field, errp); | ||
31 | } | 36 | } |
32 | - | 37 | |
33 | -static inline bool gluster_supports_zerofill(void) | 38 | static bool iothread_set_param(Object *obj, Visitor *v, |
34 | -{ | 39 | - const char *name, void *opaque, Error **errp) |
35 | - return 1; | 40 | + const char *name, IOThreadParamInfo *info, Error **errp) |
36 | -} | 41 | { |
37 | - | 42 | IOThread *iothread = IOTHREAD(obj); |
38 | -static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset, | 43 | - IOThreadParamInfo *info = opaque; |
39 | - int64_t size) | 44 | int64_t *field = (void *)iothread + info->offset; |
40 | -{ | 45 | int64_t value; |
41 | - return glfs_zerofill(fd, offset, size); | 46 | |
42 | -} | 47 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, |
43 | - | 48 | static void iothread_get_poll_param(Object *obj, Visitor *v, |
44 | -#else | 49 | const char *name, void *opaque, Error **errp) |
45 | -static inline bool gluster_supports_zerofill(void) | 50 | { |
46 | -{ | 51 | + IOThreadParamInfo *info = opaque; |
47 | - return 0; | 52 | |
48 | -} | 53 | - iothread_get_param(obj, v, name, opaque, errp); |
49 | - | 54 | + iothread_get_param(obj, v, name, info, errp); |
50 | -static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset, | 55 | } |
51 | - int64_t size) | 56 | |
52 | -{ | 57 | static void iothread_set_poll_param(Object *obj, Visitor *v, |
53 | - return 0; | 58 | const char *name, void *opaque, Error **errp) |
54 | -} | 59 | { |
55 | #endif | 60 | IOThread *iothread = IOTHREAD(obj); |
56 | 61 | + IOThreadParamInfo *info = opaque; | |
57 | static int qemu_gluster_create(const char *filename, | 62 | |
58 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename, | 63 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { |
59 | struct glfs *glfs; | 64 | + if (!iothread_set_param(obj, v, name, info, errp)) { |
60 | struct glfs_fd *fd; | 65 | return; |
61 | int ret = 0; | ||
62 | - int prealloc = 0; | ||
63 | + PreallocMode prealloc; | ||
64 | int64_t total_size = 0; | ||
65 | char *tmp = NULL; | ||
66 | + Error *local_err = NULL; | ||
67 | |||
68 | gconf = g_new0(BlockdevOptionsGluster, 1); | ||
69 | gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG, | ||
70 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename, | ||
71 | BDRV_SECTOR_SIZE); | ||
72 | |||
73 | tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC); | ||
74 | - if (!tmp || !strcmp(tmp, "off")) { | ||
75 | - prealloc = 0; | ||
76 | - } else if (!strcmp(tmp, "full") && gluster_supports_zerofill()) { | ||
77 | - prealloc = 1; | ||
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 | } | 66 | } |
90 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename, | 67 | |
91 | O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); | 68 | @@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v, |
92 | if (!fd) { | 69 | static void iothread_get_aio_param(Object *obj, Visitor *v, |
93 | ret = -errno; | 70 | const char *name, void *opaque, Error **errp) |
94 | - } else { | 71 | { |
95 | + goto out; | 72 | + IOThreadParamInfo *info = opaque; |
96 | + } | 73 | |
97 | + | 74 | - iothread_get_param(obj, v, name, opaque, errp); |
98 | + switch (prealloc) { | 75 | + iothread_get_param(obj, v, name, info, errp); |
99 | +#ifdef CONFIG_GLUSTERFS_FALLOCATE | 76 | } |
100 | + case PREALLOC_MODE_FALLOC: | 77 | |
101 | + if (glfs_fallocate(fd, 0, 0, total_size)) { | 78 | static void iothread_set_aio_param(Object *obj, Visitor *v, |
102 | + error_setg(errp, "Could not preallocate data for the new file"); | 79 | const char *name, void *opaque, Error **errp) |
103 | + ret = -errno; | 80 | { |
104 | + } | 81 | IOThread *iothread = IOTHREAD(obj); |
105 | + break; | 82 | + IOThreadParamInfo *info = opaque; |
106 | +#endif /* CONFIG_GLUSTERFS_FALLOCATE */ | 83 | |
107 | +#ifdef CONFIG_GLUSTERFS_ZEROFILL | 84 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { |
108 | + case PREALLOC_MODE_FULL: | 85 | + if (!iothread_set_param(obj, v, name, info, errp)) { |
109 | if (!glfs_ftruncate(fd, total_size)) { | 86 | return; |
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 | } | 87 | } |
140 | out: | 88 | |
141 | - g_free(tmp); | ||
142 | qapi_free_BlockdevOptionsGluster(gconf); | ||
143 | glfs_clear_preopened(glfs); | ||
144 | return ret; | ||
145 | diff --git a/configure b/configure | ||
146 | index XXXXXXX..XXXXXXX 100755 | ||
147 | --- a/configure | ||
148 | +++ b/configure | ||
149 | @@ -XXX,XX +XXX,XX @@ seccomp="" | ||
150 | glusterfs="" | ||
151 | glusterfs_xlator_opt="no" | ||
152 | glusterfs_discard="no" | ||
153 | +glusterfs_fallocate="no" | ||
154 | glusterfs_zerofill="no" | ||
155 | gtk="" | ||
156 | gtkabi="" | ||
157 | @@ -XXX,XX +XXX,XX @@ if test "$glusterfs" != "no" ; then | ||
158 | glusterfs_discard="yes" | ||
159 | fi | ||
160 | if $pkg_config --atleast-version=6 glusterfs-api; then | ||
161 | + glusterfs_fallocate="yes" | ||
162 | glusterfs_zerofill="yes" | ||
163 | fi | ||
164 | else | ||
165 | @@ -XXX,XX +XXX,XX @@ if test "$glusterfs_discard" = "yes" ; then | ||
166 | echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak | ||
167 | fi | ||
168 | |||
169 | +if test "$glusterfs_fallocate" = "yes" ; then | ||
170 | + echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak | ||
171 | +fi | ||
172 | + | ||
173 | if test "$glusterfs_zerofill" = "yes" ; then | ||
174 | echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak | ||
175 | fi | ||
176 | -- | 89 | -- |
177 | 2.9.3 | 90 | 2.31.1 |
178 | 91 | ||
179 | 92 | diff view generated by jsdifflib |