[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 16/17] block: Use bdrv_next() instead of bdrv_sta
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v4 16/17] block: Use bdrv_next() instead of bdrv_states |
Date: |
Wed, 16 Mar 2016 19:54:44 +0100 |
There is no point in manually iterating through the bdrv_states list
when there is bdrv_next().
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
block.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/block.c b/block.c
index 8f700f1..5d848fb 100644
--- a/block.c
+++ b/block.c
@@ -3293,10 +3293,10 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error
**errp)
void bdrv_invalidate_cache_all(Error **errp)
{
- BlockDriverState *bs;
+ BlockDriverState *bs = NULL;
Error *local_err = NULL;
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ while ((bs = bdrv_next(bs)) != NULL) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
@@ -3326,10 +3326,10 @@ static int bdrv_inactivate(BlockDriverState *bs)
int bdrv_inactivate_all(void)
{
- BlockDriverState *bs;
+ BlockDriverState *bs = NULL;
int ret;
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ while ((bs = bdrv_next(bs)) != NULL) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
@@ -3835,10 +3835,10 @@ bool bdrv_recurse_is_first_non_filter(BlockDriverState
*bs,
*/
bool bdrv_is_first_non_filter(BlockDriverState *candidate)
{
- BlockDriverState *bs;
+ BlockDriverState *bs = NULL;
/* walk down the bs forest recursively */
- QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+ while ((bs = bdrv_next(bs)) != NULL) {
bool perm;
/* try to recurse in this top level bs */
--
2.7.3
- [Qemu-devel] [PATCH v4 07/17] blockdev: Rename blk_backends, (continued)
- [Qemu-devel] [PATCH v4 07/17] blockdev: Rename blk_backends, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 08/17] blockdev: Add list of all BlockBackends, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 09/17] blockdev: Separate BB name management, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 05/17] qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 13/17] block: Add bdrv_next_monitor_owned(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 10/17] blockdev: Split monitor reference from BB creation, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 11/17] blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 14/17] block: Add blk_next_root_bs(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 12/17] block: Move some bdrv_*_all() functions to BB, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 15/17] block: Rewrite bdrv_next(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 16/17] block: Use bdrv_next() instead of bdrv_states,
Max Reitz <=
- [Qemu-devel] [PATCH v4 17/17] block: Remove bdrv_states list, Max Reitz, 2016/03/16
- Re: [Qemu-devel] [PATCH v4 00/17] blockdev: Further BlockBackend work, Kevin Wolf, 2016/03/17