1
The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4:
1
The following changes since commit f90ea7ba7c5ae7010ee0ce062207ae42530f57d6:
2
2
3
arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100)
3
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171012' into staging (2017-10-12 17:06:50 +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 56faeb9bb6872b3f926b3b3e0452a70beea10af2:
9
for you to fetch changes up to b867eaa17b3940760f51134e409cb0580dd3dde3:
10
10
11
block/gluster.c: Handle qdict_array_entries() failure (2017-06-09 08:41:29 -0400)
11
block/throttle.c: add bdrv_co_drain_begin/end callbacks (2017-10-13 12:38:41 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Gluster patch
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
16
17
Peter Maydell (1):
17
Manos Pitsidianakis (3):
18
block/gluster.c: Handle qdict_array_entries() failure
18
block: add bdrv_co_drain_end callback
19
block: rename bdrv_co_drain to bdrv_co_drain_begin
20
block/throttle.c: add bdrv_co_drain_begin/end callbacks
19
21
20
block/gluster.c | 3 +--
22
include/block/block_int.h | 13 ++++++++++---
21
1 file changed, 1 insertion(+), 2 deletions(-)
23
block/io.c | 48 +++++++++++++++++++++++++++++++++--------------
24
block/qed.c | 6 +++---
25
block/throttle.c | 18 ++++++++++++++++++
26
4 files changed, 65 insertions(+), 20 deletions(-)
22
27
23
--
28
--
24
2.9.3
29
2.13.6
25
30
26
31
diff view generated by jsdifflib
New patch
1
From: Manos Pitsidianakis <el13635@mail.ntua.gr>
1
2
3
BlockDriverState has a bdrv_co_drain() callback but no equivalent for
4
the end of the drain. The throttle driver (block/throttle.c) needs a way
5
to mark the end of the drain in order to toggle io_limits_disabled
6
correctly, thus bdrv_co_drain_end is needed.
7
8
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
9
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
10
Reviewed-by: Fam Zheng <famz@redhat.com>
11
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
---
13
include/block/block_int.h | 11 +++++++++--
14
block/io.c | 48 +++++++++++++++++++++++++++++++++--------------
15
2 files changed, 43 insertions(+), 16 deletions(-)
16
17
diff --git a/include/block/block_int.h b/include/block/block_int.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/block/block_int.h
20
+++ b/include/block/block_int.h
21
@@ -XXX,XX +XXX,XX @@ struct BlockDriver {
22
int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
23
24
/**
25
- * Drain and stop any internal sources of requests in the driver, and
26
- * remain so until next I/O callback (e.g. bdrv_co_writev) is called.
27
+ * bdrv_co_drain is called if implemented in the beginning of a
28
+ * drain operation to drain and stop any internal sources of requests in
29
+ * the driver.
30
+ * bdrv_co_drain_end is called if implemented at the end of the drain.
31
+ *
32
+ * They should be used by the driver to e.g. manage scheduled I/O
33
+ * requests, or toggle an internal state. After the end of the drain new
34
+ * requests will continue normally.
35
*/
36
void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs);
37
+ void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs);
38
39
void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child,
40
Error **errp);
41
diff --git a/block/io.c b/block/io.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/block/io.c
44
+++ b/block/io.c
45
@@ -XXX,XX +XXX,XX @@ typedef struct {
46
Coroutine *co;
47
BlockDriverState *bs;
48
bool done;
49
+ bool begin;
50
} BdrvCoDrainData;
51
52
static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
53
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
54
BdrvCoDrainData *data = opaque;
55
BlockDriverState *bs = data->bs;
56
57
- bs->drv->bdrv_co_drain(bs);
58
+ if (data->begin) {
59
+ bs->drv->bdrv_co_drain(bs);
60
+ } else {
61
+ bs->drv->bdrv_co_drain_end(bs);
62
+ }
63
64
/* Set data->done before reading bs->wakeup. */
65
atomic_mb_set(&data->done, true);
66
bdrv_wakeup(bs);
67
}
68
69
-static void bdrv_drain_invoke(BlockDriverState *bs)
70
+static void bdrv_drain_invoke(BlockDriverState *bs, bool begin)
71
{
72
- BdrvCoDrainData data = { .bs = bs, .done = false };
73
+ BdrvCoDrainData data = { .bs = bs, .done = false, .begin = begin};
74
75
- if (!bs->drv || !bs->drv->bdrv_co_drain) {
76
+ if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) ||
77
+ (!begin && !bs->drv->bdrv_co_drain_end)) {
78
return;
79
}
80
81
@@ -XXX,XX +XXX,XX @@ static void bdrv_drain_invoke(BlockDriverState *bs)
82
BDRV_POLL_WHILE(bs, !data.done);
83
}
84
85
-static bool bdrv_drain_recurse(BlockDriverState *bs)
86
+static bool bdrv_drain_recurse(BlockDriverState *bs, bool begin)
87
{
88
BdrvChild *child, *tmp;
89
bool waited;
90
91
- waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
92
-
93
/* Ensure any pending metadata writes are submitted to bs->file. */
94
- bdrv_drain_invoke(bs);
95
+ bdrv_drain_invoke(bs, begin);
96
+
97
+ /* Wait for drained requests to finish */
98
+ waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
99
100
QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) {
101
BlockDriverState *bs = child->bs;
102
@@ -XXX,XX +XXX,XX @@ static bool bdrv_drain_recurse(BlockDriverState *bs)
103
*/
104
bdrv_ref(bs);
105
}
106
- waited |= bdrv_drain_recurse(bs);
107
+ waited |= bdrv_drain_recurse(bs, begin);
108
if (in_main_loop) {
109
bdrv_unref(bs);
110
}
111
@@ -XXX,XX +XXX,XX @@ static void bdrv_co_drain_bh_cb(void *opaque)
112
BlockDriverState *bs = data->bs;
113
114
bdrv_dec_in_flight(bs);
115
- bdrv_drained_begin(bs);
116
+ if (data->begin) {
117
+ bdrv_drained_begin(bs);
118
+ } else {
119
+ bdrv_drained_end(bs);
120
+ }
121
+
122
data->done = true;
123
aio_co_wake(co);
124
}
125
126
-static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs)
127
+static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
128
+ bool begin)
129
{
130
BdrvCoDrainData data;
131
132
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs)
133
.co = qemu_coroutine_self(),
134
.bs = bs,
135
.done = false,
136
+ .begin = begin,
137
};
138
bdrv_inc_in_flight(bs);
139
aio_bh_schedule_oneshot(bdrv_get_aio_context(bs),
140
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs)
141
void bdrv_drained_begin(BlockDriverState *bs)
142
{
143
if (qemu_in_coroutine()) {
144
- bdrv_co_yield_to_drain(bs);
145
+ bdrv_co_yield_to_drain(bs, true);
146
return;
147
}
148
149
@@ -XXX,XX +XXX,XX @@ void bdrv_drained_begin(BlockDriverState *bs)
150
bdrv_parent_drained_begin(bs);
151
}
152
153
- bdrv_drain_recurse(bs);
154
+ bdrv_drain_recurse(bs, true);
155
}
156
157
void bdrv_drained_end(BlockDriverState *bs)
158
{
159
+ if (qemu_in_coroutine()) {
160
+ bdrv_co_yield_to_drain(bs, false);
161
+ return;
162
+ }
163
assert(bs->quiesce_counter > 0);
164
if (atomic_fetch_dec(&bs->quiesce_counter) > 1) {
165
return;
166
}
167
168
bdrv_parent_drained_end(bs);
169
+ bdrv_drain_recurse(bs, false);
170
aio_enable_external(bdrv_get_aio_context(bs));
171
}
172
173
@@ -XXX,XX +XXX,XX @@ void bdrv_drain_all_begin(void)
174
aio_context_acquire(aio_context);
175
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
176
if (aio_context == bdrv_get_aio_context(bs)) {
177
- waited |= bdrv_drain_recurse(bs);
178
+ waited |= bdrv_drain_recurse(bs, true);
179
}
180
}
181
aio_context_release(aio_context);
182
@@ -XXX,XX +XXX,XX @@ void bdrv_drain_all_end(void)
183
aio_context_acquire(aio_context);
184
aio_enable_external(aio_context);
185
bdrv_parent_drained_end(bs);
186
+ bdrv_drain_recurse(bs, false);
187
aio_context_release(aio_context);
188
}
189
190
--
191
2.13.6
192
193
diff view generated by jsdifflib
New patch
1
From: Manos Pitsidianakis <el13635@mail.ntua.gr>
1
2
3
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
Reviewed-by: Fam Zheng <famz@redhat.com>
5
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
6
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
---
9
include/block/block_int.h | 4 ++--
10
block/io.c | 4 ++--
11
block/qed.c | 6 +++---
12
3 files changed, 7 insertions(+), 7 deletions(-)
13
14
diff --git a/include/block/block_int.h b/include/block/block_int.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/include/block/block_int.h
17
+++ b/include/block/block_int.h
18
@@ -XXX,XX +XXX,XX @@ struct BlockDriver {
19
int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
20
21
/**
22
- * bdrv_co_drain is called if implemented in the beginning of a
23
+ * bdrv_co_drain_begin is called if implemented in the beginning of a
24
* drain operation to drain and stop any internal sources of requests in
25
* the driver.
26
* bdrv_co_drain_end is called if implemented at the end of the drain.
27
@@ -XXX,XX +XXX,XX @@ struct BlockDriver {
28
* requests, or toggle an internal state. After the end of the drain new
29
* requests will continue normally.
30
*/
31
- void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs);
32
+ void coroutine_fn (*bdrv_co_drain_begin)(BlockDriverState *bs);
33
void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs);
34
35
void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child,
36
diff --git a/block/io.c b/block/io.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/block/io.c
39
+++ b/block/io.c
40
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
41
BlockDriverState *bs = data->bs;
42
43
if (data->begin) {
44
- bs->drv->bdrv_co_drain(bs);
45
+ bs->drv->bdrv_co_drain_begin(bs);
46
} else {
47
bs->drv->bdrv_co_drain_end(bs);
48
}
49
@@ -XXX,XX +XXX,XX @@ static void bdrv_drain_invoke(BlockDriverState *bs, bool begin)
50
{
51
BdrvCoDrainData data = { .bs = bs, .done = false, .begin = begin};
52
53
- if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) ||
54
+ if (!bs->drv || (begin && !bs->drv->bdrv_co_drain_begin) ||
55
(!begin && !bs->drv->bdrv_co_drain_end)) {
56
return;
57
}
58
diff --git a/block/qed.c b/block/qed.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/block/qed.c
61
+++ b/block/qed.c
62
@@ -XXX,XX +XXX,XX @@ static bool qed_plug_allocating_write_reqs(BDRVQEDState *s)
63
assert(!s->allocating_write_reqs_plugged);
64
if (s->allocating_acb != NULL) {
65
/* Another allocating write came concurrently. This cannot happen
66
- * from bdrv_qed_co_drain, but it can happen when the timer runs.
67
+ * from bdrv_qed_co_drain_begin, but it can happen when the timer runs.
68
*/
69
qemu_co_mutex_unlock(&s->table_lock);
70
return false;
71
@@ -XXX,XX +XXX,XX @@ static void bdrv_qed_attach_aio_context(BlockDriverState *bs,
72
}
73
}
74
75
-static void coroutine_fn bdrv_qed_co_drain(BlockDriverState *bs)
76
+static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs)
77
{
78
BDRVQEDState *s = bs->opaque;
79
80
@@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_qed = {
81
.bdrv_check = bdrv_qed_check,
82
.bdrv_detach_aio_context = bdrv_qed_detach_aio_context,
83
.bdrv_attach_aio_context = bdrv_qed_attach_aio_context,
84
- .bdrv_co_drain = bdrv_qed_co_drain,
85
+ .bdrv_co_drain_begin = bdrv_qed_co_drain_begin,
86
};
87
88
static void bdrv_qed_init(void)
89
--
90
2.13.6
91
92
diff view generated by jsdifflib
1
From: Peter Maydell <peter.maydell@linaro.org>
1
From: Manos Pitsidianakis <el13635@mail.ntua.gr>
2
2
3
In qemu_gluster_parse_json(), the call to qdict_array_entries()
3
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
could return a negative error code, which we were ignoring
4
Reviewed-by: Fam Zheng <famz@redhat.com>
5
because we assigned the result to an unsigned variable.
5
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
6
Fix this by using the 'int' type instead, which matches the
6
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7
return type of qdict_array_entries() and also the type
7
---
8
we use for the loop enumeration variable 'i'.
8
block/throttle.c | 18 ++++++++++++++++++
9
1 file changed, 18 insertions(+)
9
10
10
(Spotted by Coverity, CID 1360960.)
11
diff --git a/block/throttle.c b/block/throttle.c
11
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Eric Blake <eblake@redhat.com>
14
Reviewed-by: Jeff Cody <jcody@redhat.com>
15
Message-id: 1496682098-1540-1-git-send-email-peter.maydell@linaro.org
16
Signed-off-by: Jeff Cody <jcody@redhat.com>
17
---
18
block/gluster.c | 3 +--
19
1 file changed, 1 insertion(+), 2 deletions(-)
20
21
diff --git a/block/gluster.c b/block/gluster.c
22
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
23
--- a/block/gluster.c
13
--- a/block/throttle.c
24
+++ b/block/gluster.c
14
+++ b/block/throttle.c
25
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
15
@@ -XXX,XX +XXX,XX @@ static bool throttle_recurse_is_first_non_filter(BlockDriverState *bs,
26
Error *local_err = NULL;
16
return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
27
char *str = NULL;
17
}
28
const char *ptr;
18
29
- size_t num_servers;
19
+static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs)
30
- int i, type;
20
+{
31
+ int i, type, num_servers;
21
+ ThrottleGroupMember *tgm = bs->opaque;
32
22
+ if (atomic_fetch_inc(&tgm->io_limits_disabled) == 0) {
33
/* create opts info from runtime_json_opts list */
23
+ throttle_group_restart_tgm(tgm);
34
opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);
24
+ }
25
+}
26
+
27
+static void coroutine_fn throttle_co_drain_end(BlockDriverState *bs)
28
+{
29
+ ThrottleGroupMember *tgm = bs->opaque;
30
+ assert(tgm->io_limits_disabled);
31
+ atomic_dec(&tgm->io_limits_disabled);
32
+}
33
+
34
static BlockDriver bdrv_throttle = {
35
.format_name = "throttle",
36
.protocol_name = "throttle",
37
@@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_throttle = {
38
.bdrv_reopen_abort = throttle_reopen_abort,
39
.bdrv_co_get_block_status = bdrv_co_get_block_status_from_file,
40
41
+ .bdrv_co_drain_begin = throttle_co_drain_begin,
42
+ .bdrv_co_drain_end = throttle_co_drain_end,
43
+
44
.is_filter = true,
45
};
46
35
--
47
--
36
2.9.3
48
2.13.6
37
49
38
50
diff view generated by jsdifflib