@@ -300,7 +300,7 @@ static void qed_unplug_allocating_write_reqs(BDRVQEDState *s)
s->allocating_write_reqs_plugged = false;
- acb = QSIMPLEQ_FIRST(&s->allocating_write_reqs);
+ acb = QTAILQ_FIRST(&s->allocating_write_reqs);
if (acb) {
qed_aio_next_io(acb, 0);
}
@@ -339,7 +339,7 @@ static void qed_need_check_timer_cb(void *opaque)
BDRVQEDState *s = opaque;
/* The timer should only fire when allocating writes have drained */
- assert(!QSIMPLEQ_FIRST(&s->allocating_write_reqs));
+ assert(!QTAILQ_FIRST(&s->allocating_write_reqs));
trace_qed_need_check_timer_cb(s);
@@ -375,7 +375,7 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
int ret;
s->bs = bs;
- QSIMPLEQ_INIT(&s->allocating_write_reqs);
+ QTAILQ_INIT(&s->allocating_write_reqs);
ret = bdrv_pread(bs->file, 0, &le_header, sizeof(le_header));
if (ret < 0) {
@@ -886,9 +886,9 @@ static void qed_aio_complete(QEDAIOCB *acb, int ret)
* next request in the queue. This ensures that we don't cycle through
* requests multiple times but rather finish one at a time completely.
*/
- if (acb == QSIMPLEQ_FIRST(&s->allocating_write_reqs)) {
- QSIMPLEQ_REMOVE_HEAD(&s->allocating_write_reqs, next);
- acb = QSIMPLEQ_FIRST(&s->allocating_write_reqs);
+ if (acb == QTAILQ_FIRST(&s->allocating_write_reqs)) {
+ QTAILQ_REMOVE(&s->allocating_write_reqs, acb, next);
+ acb = QTAILQ_FIRST(&s->allocating_write_reqs);
if (acb) {
qed_aio_next_io(acb, 0);
} else if (s->header.features & QED_F_NEED_CHECK) {
@@ -1094,15 +1094,15 @@ static void qed_aio_write_alloc(QEDAIOCB *acb, size_t len)
BDRVQEDState *s = acb_to_s(acb);
/* Cancel timer when the first allocating request comes in */
- if (QSIMPLEQ_EMPTY(&s->allocating_write_reqs)) {
+ if (QTAILQ_EMPTY(&s->allocating_write_reqs)) {
qed_cancel_need_check_timer(s);
}
/* Freeze this request if another allocating write is in progress */
- if (acb != QSIMPLEQ_FIRST(&s->allocating_write_reqs)) {
- QSIMPLEQ_INSERT_TAIL(&s->allocating_write_reqs, acb, next);
+ if (acb != QTAILQ_FIRST(&s->allocating_write_reqs)) {
+ QTAILQ_INSERT_TAIL(&s->allocating_write_reqs, acb, next);
}
- if (acb != QSIMPLEQ_FIRST(&s->allocating_write_reqs) ||
+ if (acb != QTAILQ_FIRST(&s->allocating_write_reqs) ||
s->allocating_write_reqs_plugged) {
return; /* wait for existing request to finish */
}
@@ -127,7 +127,7 @@ typedef struct QEDAIOCB {
BlockDriverAIOCB common;
QEMUBH *bh;
int bh_ret; /* final return status for completion bh */
- QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */
+ QTAILQ_ENTRY(QEDAIOCB) next; /* next request */
bool is_write; /* false - read, true - write */
bool *finished; /* signal for cancel completion */
uint64_t end_pos; /* request end on block device, in bytes */
@@ -159,7 +159,7 @@ typedef struct {
uint32_t l2_mask;
/* Allocating write request queue */
- QSIMPLEQ_HEAD(, QEDAIOCB) allocating_write_reqs;
+ QTAILQ_HEAD(, QEDAIOCB) allocating_write_reqs;
bool allocating_write_reqs_plugged;
/* Periodic flush and clear need check flag */
QED needs to insert at tail. Use a QTAILQ, even though the double links are strictly not necessary. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- block/qed.c | 20 ++++++++++---------- block/qed.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-)