mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 19:14:58 -06:00
block: replace bdrv_states iteration with bdrv_next()
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 <berto@igalia.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
7237aecd7e
commit
4f5472cb2d
1 changed files with 8 additions and 6 deletions
14
block.c
14
block.c
|
@ -2051,9 +2051,9 @@ void bdrv_drain_all(void)
|
||||||
{
|
{
|
||||||
/* Always run first iteration so any pending completion BHs run */
|
/* Always run first iteration so any pending completion BHs run */
|
||||||
bool busy = true;
|
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);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
||||||
aio_context_acquire(aio_context);
|
aio_context_acquire(aio_context);
|
||||||
|
@ -2065,8 +2065,9 @@ void bdrv_drain_all(void)
|
||||||
|
|
||||||
while (busy) {
|
while (busy) {
|
||||||
busy = false;
|
busy = false;
|
||||||
|
bs = NULL;
|
||||||
|
|
||||||
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
|
while ((bs = bdrv_next(bs))) {
|
||||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
||||||
aio_context_acquire(aio_context);
|
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);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
||||||
aio_context_acquire(aio_context);
|
aio_context_acquire(aio_context);
|
||||||
|
@ -4015,10 +4017,10 @@ int bdrv_get_flags(BlockDriverState *bs)
|
||||||
|
|
||||||
int bdrv_flush_all(void)
|
int bdrv_flush_all(void)
|
||||||
{
|
{
|
||||||
BlockDriverState *bs;
|
BlockDriverState *bs = NULL;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
|
while ((bs = bdrv_next(bs))) {
|
||||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue