qed.c (ae2b87341b5ddb0dcb1b3f2d4f586ef18de75873) qed.c (6d47eb0c8bf2d50682c7dccae74d24104076fe23)
1/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 * Anthony Liguori <aliguori@us.ibm.com>

--- 268 unchanged lines hidden (view full) ---

277{
278 qemu_co_mutex_lock(&s->table_lock);
279 assert(s->allocating_write_reqs_plugged);
280 s->allocating_write_reqs_plugged = false;
281 qemu_co_queue_next(&s->allocating_write_reqs);
282 qemu_co_mutex_unlock(&s->table_lock);
283}
284
1/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 * Anthony Liguori <aliguori@us.ibm.com>

--- 268 unchanged lines hidden (view full) ---

277{
278 qemu_co_mutex_lock(&s->table_lock);
279 assert(s->allocating_write_reqs_plugged);
280 s->allocating_write_reqs_plugged = false;
281 qemu_co_queue_next(&s->allocating_write_reqs);
282 qemu_co_mutex_unlock(&s->table_lock);
283}
284
285static void coroutine_fn qed_need_check_timer_entry(void *opaque)
285static void coroutine_fn qed_need_check_timer(BDRVQEDState *s)
286{
286{
287 BDRVQEDState *s = opaque;
288 int ret;
289
290 trace_qed_need_check_timer_cb(s);
291
292 if (!qed_plug_allocating_write_reqs(s)) {
293 return;
294 }
295

--- 9 unchanged lines hidden (view full) ---

305 (void) ret;
306
307 qed_unplug_allocating_write_reqs(s);
308
309 ret = bdrv_co_flush(s->bs);
310 (void) ret;
311}
312
287 int ret;
288
289 trace_qed_need_check_timer_cb(s);
290
291 if (!qed_plug_allocating_write_reqs(s)) {
292 return;
293 }
294

--- 9 unchanged lines hidden (view full) ---

304 (void) ret;
305
306 qed_unplug_allocating_write_reqs(s);
307
308 ret = bdrv_co_flush(s->bs);
309 (void) ret;
310}
311
312static void coroutine_fn qed_need_check_timer_entry(void *opaque)
313{
314 BDRVQEDState *s = opaque;
315
316 qed_need_check_timer(opaque);
317 bdrv_dec_in_flight(s->bs);
318}
319
313static void qed_need_check_timer_cb(void *opaque)
314{
320static void qed_need_check_timer_cb(void *opaque)
321{
322 BDRVQEDState *s = opaque;
315 Coroutine *co = qemu_coroutine_create(qed_need_check_timer_entry, opaque);
323 Coroutine *co = qemu_coroutine_create(qed_need_check_timer_entry, opaque);
324
325 bdrv_inc_in_flight(s->bs);
316 qemu_coroutine_enter(co);
317}
318
319static void qed_start_need_check_timer(BDRVQEDState *s)
320{
321 trace_qed_start_need_check_timer(s);
322
323 /* Use QEMU_CLOCK_VIRTUAL so we don't alter the image file while suspended for

--- 34 unchanged lines hidden (view full) ---

358static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs)
359{
360 BDRVQEDState *s = bs->opaque;
361
362 /* Fire the timer immediately in order to start doing I/O as soon as the
363 * header is flushed.
364 */
365 if (s->need_check_timer && timer_pending(s->need_check_timer)) {
326 qemu_coroutine_enter(co);
327}
328
329static void qed_start_need_check_timer(BDRVQEDState *s)
330{
331 trace_qed_start_need_check_timer(s);
332
333 /* Use QEMU_CLOCK_VIRTUAL so we don't alter the image file while suspended for

--- 34 unchanged lines hidden (view full) ---

368static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs)
369{
370 BDRVQEDState *s = bs->opaque;
371
372 /* Fire the timer immediately in order to start doing I/O as soon as the
373 * header is flushed.
374 */
375 if (s->need_check_timer && timer_pending(s->need_check_timer)) {
376 Coroutine *co;
377
366 qed_cancel_need_check_timer(s);
378 qed_cancel_need_check_timer(s);
367 qed_need_check_timer_entry(s);
379 co = qemu_coroutine_create(qed_need_check_timer_entry, s);
380 bdrv_inc_in_flight(bs);
381 aio_co_enter(bdrv_get_aio_context(bs), co);
368 }
369}
370
371static void bdrv_qed_init_state(BlockDriverState *bs)
372{
373 BDRVQEDState *s = bs->opaque;
374
375 memset(s, 0, sizeof(BDRVQEDState));

--- 1283 unchanged lines hidden ---
382 }
383}
384
385static void bdrv_qed_init_state(BlockDriverState *bs)
386{
387 BDRVQEDState *s = bs->opaque;
388
389 memset(s, 0, sizeof(BDRVQEDState));

--- 1283 unchanged lines hidden ---