[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 73/76] block: replace bdrv_states iteration with bdrv
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 73/76] block: replace bdrv_states iteration with bdrv_next() |
Date: |
Tue, 28 Apr 2015 17:00:55 +0200 |
From: Stefan Hajnoczi <address@hidden>
The bdrv_states list is a static variable in block.c.
bdrv_drain_all() and bdrv_flush_all() use this variable to iterate over
all drives.
The next patch will move bdrv_drain_all() and bdrv_flush_all() out of
block.c so it's necessary to switch to the public bdrv_next() interface.
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/block.c b/block.c
index ec23594..1f0a4e2 100644
--- a/block.c
+++ b/block.c
@@ -2051,9 +2051,9 @@ void bdrv_drain_all(void)
{
/* Always run first iteration so any pending completion BHs run */
bool busy = true;
- BlockDriverState *bs;
+ BlockDriverState *bs = NULL;
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
@@ -2065,8 +2065,9 @@ void bdrv_drain_all(void)
while (busy) {
busy = false;
+ bs = NULL;
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
@@ -2075,7 +2076,8 @@ void bdrv_drain_all(void)
}
}
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ bs = NULL;
+ while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
@@ -4015,10 +4017,10 @@ int bdrv_get_flags(BlockDriverState *bs)
int bdrv_flush_all(void)
{
- BlockDriverState *bs;
+ BlockDriverState *bs = NULL;
int result = 0;
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ while ((bs = bdrv_next(bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
int ret;
--
1.8.3.1
- [Qemu-devel] [PULL 60/76] qmp: Add dirty bitmap status field in query-block, (continued)
- [Qemu-devel] [PULL 60/76] qmp: Add dirty bitmap status field in query-block, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 61/76] block: add BdrvDirtyBitmap documentation, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 62/76] block: Ensure consistent bitmap function prototypes, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 63/76] block: Resize bitmaps on bdrv_truncate, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 64/76] hbitmap: truncate tests, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 65/76] iotests: add invalid input incremental backup tests, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 68/76] iotests: add incremental backup failure recovery test, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 69/76] iotests: add incremental backup granularity tests, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 71/76] block/dmg: make it modular, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 70/76] block/mirror: Always call block_job_sleep_ns(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 73/76] block: replace bdrv_states iteration with bdrv_next(),
Kevin Wolf <=
- [Qemu-devel] [PULL 67/76] iotests: add simple incremental backup case, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 72/76] vmdk: Widen before shifting 32 bit header field, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 74/76] block: add bdrv_set_dirty()/bdrv_reset_dirty() to block_int.h, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 75/76] block: extract bdrv_setup_io_funcs(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 76/76] block: move I/O request processing to block/io.c, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 66/76] iotests: add QMP event waiting queue, Kevin Wolf, 2015/04/28
- Re: [Qemu-devel] [PULL 00/76] Block patches, Peter Maydell, 2015/04/28