1
The following changes since commit d47a851caeda96d5979bf48d4bae6a87784ad91d:
1
The following changes since commit 063833a6ec2a6747e27c5f9866bb44c7e8de1265:
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/mcayland/tags/qemu-sparc-signed' into staging (2017-10-19 18:42:51 +0100)
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
git://github.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 e947d47da0b16e80d237c510e9d2e80799578c7f:
10
10
11
gluster: add support for PREALLOC_MODE_FALLOC (2017-06-02 10:51:47 -0400)
11
oslib-posix: Fix compiler warning and some data types (2017-10-20 11:16:27 +0200)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Gluster patch(es)
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
16
17
Niels de Vos (1):
17
Stefan Weil (1):
18
gluster: add support for PREALLOC_MODE_FALLOC
18
oslib-posix: Fix compiler warning and some data types
19
19
20
block/gluster.c | 78 ++++++++++++++++++++++++++++++---------------------------
20
util/oslib-posix.c | 15 ++++++++-------
21
configure | 6 +++++
21
1 file changed, 8 insertions(+), 7 deletions(-)
22
2 files changed, 47 insertions(+), 37 deletions(-)
23
22
24
--
23
--
25
2.9.3
24
2.13.6
26
25
27
26
diff view generated by jsdifflib
1
From: Niels de Vos <ndevos@redhat.com>
1
From: Stefan Weil <sw@weilnetz.de>
2
2
3
Add missing support for "preallocation=falloc" to the Gluster block
3
gcc warning:
4
driver. This change bases its logic on that of block/file-posix.c and
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
4
9
Both glfs_zerofill() and glfs_fallocate() have been introduced with
5
/qemu/util/oslib-posix.c:304:11: error:
10
GlusterFS 3.5.0 (pkg-config glusterfs-api = 6). A #define for the
6
variable ‘addr’ might be clobbered by ‘longjmp’ or ‘vfork’
11
availability of glfs_fallocate() has been added to ./configure.
7
[-Werror=clobbered]
12
8
13
Reported-by: Satheesaran Sundaramoorthi <sasundar@redhat.com>
9
Fix also some related data types:
14
Signed-off-by: Niels de Vos <ndevos@redhat.com>
10
15
Message-id: 20170528063114.28691-1-ndevos@redhat.com
11
numpages, hpagesize are used as pointer offset.
16
URL: https://bugzilla.redhat.com/1450759
12
Always use size_t for them and also for the derived
17
Signed-off-by: Niels de Vos <ndevos@redhat.com>
13
numpages_per_thread and size_per_thread.
18
Signed-off-by: Jeff Cody <jcody@redhat.com>
14
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Signed-off-by: Stefan Weil <sw@weilnetz.de>
17
Message-id: 20171016202912.1117-1-sw@weilnetz.de
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
---
19
---
20
block/gluster.c | 78 ++++++++++++++++++++++++++++++---------------------------
20
util/oslib-posix.c | 15 ++++++++-------
21
configure | 6 +++++
21
1 file changed, 8 insertions(+), 7 deletions(-)
22
2 files changed, 47 insertions(+), 37 deletions(-)
23
22
24
diff --git a/block/gluster.c b/block/gluster.c
23
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
25
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
26
--- a/block/gluster.c
25
--- a/util/oslib-posix.c
27
+++ b/block/gluster.c
26
+++ b/util/oslib-posix.c
28
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
27
@@ -XXX,XX +XXX,XX @@
29
qemu_coroutine_yield();
28
30
return acb.ret;
29
struct MemsetThread {
31
}
30
char *addr;
32
-
31
- uint64_t numpages;
33
-static inline bool gluster_supports_zerofill(void)
32
- uint64_t hpagesize;
34
-{
33
+ size_t numpages;
35
- return 1;
34
+ size_t hpagesize;
36
-}
35
QemuThread pgthread;
37
-
36
sigjmp_buf env;
38
-static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
37
};
39
- int64_t size)
38
@@ -XXX,XX +XXX,XX @@ static void sigbus_handler(int signal)
40
-{
39
static void *do_touch_pages(void *arg)
41
- return glfs_zerofill(fd, offset, size);
40
{
42
-}
41
MemsetThread *memset_args = (MemsetThread *)arg;
43
-
42
- char *addr = memset_args->addr;
44
-#else
43
- uint64_t numpages = memset_args->numpages;
45
-static inline bool gluster_supports_zerofill(void)
44
- uint64_t hpagesize = memset_args->hpagesize;
46
-{
45
sigset_t set, oldset;
47
- return 0;
46
- int i = 0;
48
-}
47
49
-
48
/* unblock SIGBUS */
50
-static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
49
sigemptyset(&set);
51
- int64_t size)
50
@@ -XXX,XX +XXX,XX @@ static void *do_touch_pages(void *arg)
52
-{
51
if (sigsetjmp(memset_args->env, 1)) {
53
- return 0;
52
memset_thread_failed = true;
54
-}
53
} else {
55
#endif
54
+ char *addr = memset_args->addr;
56
55
+ size_t numpages = memset_args->numpages;
57
static int qemu_gluster_create(const char *filename,
56
+ size_t hpagesize = memset_args->hpagesize;
58
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename,
57
+ size_t i;
59
struct glfs *glfs;
58
for (i = 0; i < numpages; i++) {
60
struct glfs_fd *fd;
59
/*
61
int ret = 0;
60
* Read & write back the same value, so we don't
62
- int prealloc = 0;
61
@@ -XXX,XX +XXX,XX @@ static inline int get_memset_num_threads(int smp_cpus)
63
+ PreallocMode prealloc;
62
static bool touch_all_pages(char *area, size_t hpagesize, size_t numpages,
64
int64_t total_size = 0;
63
int smp_cpus)
65
char *tmp = NULL;
64
{
66
+ Error *local_err = NULL;
65
- uint64_t numpages_per_thread, size_per_thread;
67
66
+ size_t numpages_per_thread;
68
gconf = g_new0(BlockdevOptionsGluster, 1);
67
+ size_t size_per_thread;
69
gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
68
char *addr = area;
70
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename,
69
int i = 0;
71
BDRV_SECTOR_SIZE);
70
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
}
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
+ }
97
+
98
+ switch (prealloc) {
99
+#ifdef CONFIG_GLUSTERFS_FALLOCATE
100
+ case PREALLOC_MODE_FALLOC:
101
+ if (glfs_fallocate(fd, 0, 0, total_size)) {
102
+ error_setg(errp, "Could not preallocate data for the new file");
103
+ ret = -errno;
104
+ }
105
+ break;
106
+#endif /* CONFIG_GLUSTERFS_FALLOCATE */
107
+#ifdef CONFIG_GLUSTERFS_ZEROFILL
108
+ case PREALLOC_MODE_FULL:
109
if (!glfs_ftruncate(fd, total_size)) {
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
}
140
out:
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
--
71
--
177
2.9.3
72
2.13.6
178
73
179
74
diff view generated by jsdifflib