From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com,
qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org,
jsnow@redhat.com
Subject: [Qemu-devel] [PATCH v4 01/10] block: switch reopen queue from QSIMPLEQ to QTAILQ
Date: Wed, 7 Aug 2019 17:12:17 +0300 [thread overview]
Message-ID: <20190807141226.193501-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20190807141226.193501-1-vsementsov@virtuozzo.com>
We'll need reverse-foreach in the following commit, QTAILQ support it,
so move to QTAILQ.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
include/block/block.h | 2 +-
block.c | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/block/block.h b/include/block/block.h
index 50a07c1c33..3d84b2a2c9 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -192,7 +192,7 @@ typedef struct HDGeometry {
#define BDRV_BLOCK_RECURSE 0x40
#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK
-typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
+typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
typedef struct BDRVReopenState {
BlockDriverState *bs;
diff --git a/block.c b/block.c
index cbd8da5f3b..696162cd7a 100644
--- a/block.c
+++ b/block.c
@@ -1718,7 +1718,7 @@ typedef struct BlockReopenQueueEntry {
bool prepared;
bool perms_checked;
BDRVReopenState state;
- QSIMPLEQ_ENTRY(BlockReopenQueueEntry) entry;
+ QTAILQ_ENTRY(BlockReopenQueueEntry) entry;
} BlockReopenQueueEntry;
/*
@@ -1731,7 +1731,7 @@ static int bdrv_reopen_get_flags(BlockReopenQueue *q, BlockDriverState *bs)
BlockReopenQueueEntry *entry;
if (q != NULL) {
- QSIMPLEQ_FOREACH(entry, q, entry) {
+ QTAILQ_FOREACH(entry, q, entry) {
if (entry->state.bs == bs) {
return entry->state.flags;
}
@@ -3280,7 +3280,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
if (bs_queue == NULL) {
bs_queue = g_new0(BlockReopenQueue, 1);
- QSIMPLEQ_INIT(bs_queue);
+ QTAILQ_INIT(bs_queue);
}
if (!options) {
@@ -3288,7 +3288,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
}
/* Check if this BlockDriverState is already in the queue */
- QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
+ QTAILQ_FOREACH(bs_entry, bs_queue, entry) {
if (bs == bs_entry->state.bs) {
break;
}
@@ -3344,7 +3344,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
if (!bs_entry) {
bs_entry = g_new0(BlockReopenQueueEntry, 1);
- QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
+ QTAILQ_INSERT_TAIL(bs_queue, bs_entry, entry);
} else {
qobject_unref(bs_entry->state.options);
qobject_unref(bs_entry->state.explicit_options);
@@ -3445,7 +3445,7 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp)
assert(bs_queue != NULL);
- QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
+ QTAILQ_FOREACH(bs_entry, bs_queue, entry) {
assert(bs_entry->state.bs->quiesce_counter > 0);
if (bdrv_reopen_prepare(&bs_entry->state, bs_queue, errp)) {
goto cleanup;
@@ -3453,7 +3453,7 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp)
bs_entry->prepared = true;
}
- QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
+ QTAILQ_FOREACH(bs_entry, bs_queue, entry) {
BDRVReopenState *state = &bs_entry->state;
ret = bdrv_check_perm(state->bs, bs_queue, state->perm,
state->shared_perm, NULL, NULL, errp);
@@ -3479,13 +3479,13 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp)
/* If we reach this point, we have success and just need to apply the
* changes
*/
- QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
+ QTAILQ_FOREACH(bs_entry, bs_queue, entry) {
bdrv_reopen_commit(&bs_entry->state);
}
ret = 0;
cleanup_perm:
- QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
+ QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
BDRVReopenState *state = &bs_entry->state;
if (!bs_entry->perms_checked) {
@@ -3502,7 +3502,7 @@ cleanup_perm:
}
}
cleanup:
- QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
+ QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
if (ret) {
if (bs_entry->prepared) {
bdrv_reopen_abort(&bs_entry->state);
@@ -3542,7 +3542,7 @@ static BlockReopenQueueEntry *find_parent_in_reopen_queue(BlockReopenQueue *q,
{
BlockReopenQueueEntry *entry;
- QSIMPLEQ_FOREACH(entry, q, entry) {
+ QTAILQ_FOREACH(entry, q, entry) {
BlockDriverState *bs = entry->state.bs;
BdrvChild *child;
--
2.18.0
next prev parent reply other threads:[~2019-08-07 14:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 14:12 [Qemu-devel] [PATCH v4 00/10] qcow2-bitmaps: rewrite reopening logic Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` Vladimir Sementsov-Ogievskiy [this message]
2019-09-24 9:50 ` [PATCH v4 01/10] block: switch reopen queue from QSIMPLEQ to QTAILQ Max Reitz
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 02/10] block: reverse order for reopen commits Vladimir Sementsov-Ogievskiy
2019-09-24 10:12 ` Max Reitz
2019-09-26 23:10 ` John Snow
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 03/10] iotests: add test-case to 165 to test reopening qcow2 bitmaps to RW Vladimir Sementsov-Ogievskiy
2019-09-26 22:57 ` John Snow
2019-09-27 7:28 ` Vladimir Sementsov-Ogievskiy
2019-09-27 10:22 ` Vladimir Sementsov-Ogievskiy
2019-09-27 10:29 ` Vladimir Sementsov-Ogievskiy
2019-09-27 18:30 ` John Snow
2019-09-27 19:54 ` Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 04/10] iotests.py: add event_wait_log and events_wait_log helpers Vladimir Sementsov-Ogievskiy
2019-09-26 23:05 ` John Snow
2019-09-27 7:31 ` Vladimir Sementsov-Ogievskiy
2019-09-27 10:38 ` Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 05/10] block/qcow2-bitmap: get rid of bdrv_has_changed_persistent_bitmaps Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 06/10] block/qcow2-bitmap: drop qcow2_reopen_bitmaps_rw_hint() Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 07/10] block/qcow2-bitmap: do not remove bitmaps on reopen-ro Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 08/10] iotests: add test 260 to check bitmap life after snapshot + commit Vladimir Sementsov-Ogievskiy
2019-09-26 23:09 ` John Snow
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 09/10] block/qcow2-bitmap: fix and improve qcow2_reopen_bitmaps_rw Vladimir Sementsov-Ogievskiy
2019-09-26 23:21 ` John Snow
2019-09-27 7:52 ` Vladimir Sementsov-Ogievskiy
2019-09-27 18:59 ` John Snow
2019-09-27 19:57 ` Vladimir Sementsov-Ogievskiy
2019-08-07 14:12 ` [Qemu-devel] [PATCH v4 10/10] qcow2-bitmap: move bitmap reopen-rw code to qcow2_reopen_commit Vladimir Sementsov-Ogievskiy
2019-09-26 23:24 ` John Snow
2019-09-27 9:13 ` Max Reitz
2019-09-05 9:54 ` [Qemu-devel] [PATCH v4 00/10] qcow2-bitmaps: rewrite reopening logic Vladimir Sementsov-Ogievskiy
2019-09-19 18:24 ` bugfix ping " Vladimir Sementsov-Ogievskiy
2019-09-26 23:25 ` [Qemu-devel] " John Snow
2019-09-27 7:53 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190807141226.193501-2-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=den@openvz.org \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).