static void qemu_aio_complete(void *opaque, int ret)

{

    struct ioreq *ioreq = opaque;



    if (ret != 0) {

        xen_be_printf(&ioreq->blkdev->xendev, 0, "%s I/O error\n",

                      ioreq->req.operation == BLKIF_OP_READ ? "read" : "write");

        ioreq->aio_errors++;

    }



    ioreq->aio_inflight--;

    if (ioreq->presync) {

        ioreq->presync = 0;

        ioreq_runio_qemu_aio(ioreq);

        return;

    }

    if (ioreq->aio_inflight > 0) {

        return;

    }

    if (ioreq->postsync) {

        ioreq->postsync = 0;

        ioreq->aio_inflight++;

        bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq);

        return;

    }



    ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;

    ioreq_unmap(ioreq);

    ioreq_finish(ioreq);

    switch (ioreq->req.operation) {

    case BLKIF_OP_WRITE:

    case BLKIF_OP_FLUSH_DISKCACHE:

        if (!ioreq->req.nr_segments) {

            break;

        }

    case BLKIF_OP_READ:

        block_acct_done(bdrv_get_stats(ioreq->blkdev->bs), &ioreq->acct);

        break;

    case BLKIF_OP_DISCARD:

    default:

        break;

    }

    qemu_bh_schedule(ioreq->blkdev->bh);

}

static void qemu_aio_complete(void *opaque, int ret)

{

    struct ioreq *ioreq = opaque;



    if (ret != 0) {

        xen_be_printf(&ioreq->blkdev->xendev, 0, "%s I/O error\n",

                      ioreq->req.operation == BLKIF_OP_READ ? "read" : "write");

        ioreq->aio_errors++;

    }



    ioreq->aio_inflight--;

    if (ioreq->presync) {

        ioreq->presync = 0;

        ioreq_runio_qemu_aio(ioreq);

        return;

    }

    if (ioreq->aio_inflight > 0) {

        return;

    }

    if (ioreq->postsync) {

        ioreq->postsync = 0;

        ioreq->aio_inflight++;

        bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq);

        return;

    }



    ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;

    ioreq_unmap(ioreq);

    ioreq_finish(ioreq);

    switch (ioreq->req.operation) {

    case BLKIF_OP_WRITE:

    case BLKIF_OP_FLUSH_DISKCACHE:

        if (!ioreq->req.nr_segments) {

            break;

        }

    case BLKIF_OP_READ:

        block_acct_done(bdrv_get_stats(ioreq->blkdev->bs), &ioreq->acct);

        break;

    case BLKIF_OP_DISCARD:

    default:

        break;

    }

    qemu_bh_schedule(ioreq->blkdev->bh);

}

static void FUNC_0(void *VAR_0, int VAR_1)

{

    struct VAR_2 *VAR_2 = VAR_0;



    if (VAR_1 != 0) {

        xen_be_printf(&VAR_2->blkdev->xendev, 0, "%s I/O error\n",

                      VAR_2->req.operation == BLKIF_OP_READ ? "read" : "write");

        VAR_2->aio_errors++;

    }



    VAR_2->aio_inflight--;

    if (VAR_2->presync) {

        VAR_2->presync = 0;

        ioreq_runio_qemu_aio(VAR_2);

        return;

    }

    if (VAR_2->aio_inflight > 0) {

        return;

    }

    if (VAR_2->postsync) {

        VAR_2->postsync = 0;

        VAR_2->aio_inflight++;

        bdrv_aio_flush(VAR_2->blkdev->bs, FUNC_0, VAR_2);

        return;

    }



    VAR_2->status = VAR_2->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;

    ioreq_unmap(VAR_2);

    ioreq_finish(VAR_2);

    switch (VAR_2->req.operation) {

    case BLKIF_OP_WRITE:

    case BLKIF_OP_FLUSH_DISKCACHE:

        if (!VAR_2->req.nr_segments) {

            break;

        }

    case BLKIF_OP_READ:

        block_acct_done(bdrv_get_stats(VAR_2->blkdev->bs), &VAR_2->acct);

        break;

    case BLKIF_OP_DISCARD:

    default:

        break;

    }

    qemu_bh_schedule(VAR_2->blkdev->bh);

}

static void FUNC_0(void *VAR_0, int VAR_1)
{ struct VAR_2 *VAR_2 = VAR_0; if (VAR_1 != 0) { xen_be_printf(&VAR_2->blkdev->xendev, 0, "%s I/O error\n",
VAR_2->req.operation == BLKIF_OP_READ ? "read" : "write"); VAR_2->aio_errors++; } VAR_2->aio_inflight--; if (VAR_2->presync) { VAR_2->presync = 0; ioreq_runio_qemu_aio(VAR_2); return; } if (VAR_2->aio_inflight > 0) { return; } if (VAR_2->postsync) { VAR_2->postsync = 0; VAR_2->aio_inflight++; bdrv_aio_flush(VAR_2->blkdev->bs, FUNC_0, VAR_2); return; } VAR_2->status = VAR_2->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY; ioreq_unmap(VAR_2); ioreq_finish(VAR_2); switch (VAR_2->req.operation) { case BLKIF_OP_WRITE:
case BLKIF_OP_FLUSH_DISKCACHE:
if (!VAR_2->req.nr_segments) { break; } case BLKIF_OP_READ:
block_acct_done(bdrv_get_stats(VAR_2->blkdev->bs), &VAR_2->acct); break; case BLKIF_OP_DISCARD:
default:
break; } qemu_bh_schedule(VAR_2->blkdev->bh); }