static void ioq_submit(LinuxAioState *s)

{

    int ret, len;

    struct qemu_laiocb *aiocb;

    struct iocb *iocbs[MAX_QUEUED_IO];

    QSIMPLEQ_HEAD(, qemu_laiocb) completed;



    do {

        len = 0;

        QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) {

            iocbs[len++] = &aiocb->iocb;

            if (len == MAX_QUEUED_IO) {

                break;

            }

        }



        ret = io_submit(s->ctx, len, iocbs);

        if (ret == -EAGAIN) {

            break;

        }

        if (ret < 0) {

            abort();

        }



        s->io_q.n -= ret;

        aiocb = container_of(iocbs[ret - 1], struct qemu_laiocb, iocb);

        QSIMPLEQ_SPLIT_AFTER(&s->io_q.pending, aiocb, next, &completed);

    } while (ret == len && !QSIMPLEQ_EMPTY(&s->io_q.pending));

    s->io_q.blocked = (s->io_q.n > 0);

}

static void ioq_submit(LinuxAioState *s)

{

    int ret, len;

    struct qemu_laiocb *aiocb;

    struct iocb *iocbs[MAX_QUEUED_IO];

    QSIMPLEQ_HEAD(, qemu_laiocb) completed;



    do {

        len = 0;

        QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) {

            iocbs[len++] = &aiocb->iocb;

            if (len == MAX_QUEUED_IO) {

                break;

            }

        }



        ret = io_submit(s->ctx, len, iocbs);

        if (ret == -EAGAIN) {

            break;

        }

        if (ret < 0) {

            abort();

        }



        s->io_q.n -= ret;

        aiocb = container_of(iocbs[ret - 1], struct qemu_laiocb, iocb);

        QSIMPLEQ_SPLIT_AFTER(&s->io_q.pending, aiocb, next, &completed);

    } while (ret == len && !QSIMPLEQ_EMPTY(&s->io_q.pending));

    s->io_q.blocked = (s->io_q.n > 0);

}

static void FUNC_0(LinuxAioState *VAR_0)

{

    int VAR_1, VAR_2;

    struct qemu_laiocb *VAR_3;

    struct iocb *VAR_4[MAX_QUEUED_IO];

    QSIMPLEQ_HEAD(, qemu_laiocb) completed;



    do {

        VAR_2 = 0;

        QSIMPLEQ_FOREACH(VAR_3, &VAR_0->io_q.pending, next) {

            VAR_4[VAR_2++] = &VAR_3->iocb;

            if (VAR_2 == MAX_QUEUED_IO) {

                break;

            }

        }



        VAR_1 = io_submit(VAR_0->ctx, VAR_2, VAR_4);

        if (VAR_1 == -EAGAIN) {

            break;

        }

        if (VAR_1 < 0) {

            abort();

        }



        VAR_0->io_q.n -= VAR_1;

        VAR_3 = container_of(VAR_4[VAR_1 - 1], struct qemu_laiocb, iocb);

        QSIMPLEQ_SPLIT_AFTER(&VAR_0->io_q.pending, VAR_3, next, &completed);

    } while (VAR_1 == VAR_2 && !QSIMPLEQ_EMPTY(&VAR_0->io_q.pending));

    VAR_0->io_q.blocked = (VAR_0->io_q.n > 0);

}

static void FUNC_0(LinuxAioState *VAR_0)
{ int VAR_1, VAR_2; struct qemu_laiocb *VAR_3; struct iocb *VAR_4[MAX_QUEUED_IO]; QSIMPLEQ_HEAD(, qemu_laiocb) completed; do { VAR_2 = 0; QSIMPLEQ_FOREACH(VAR_3, &VAR_0->io_q.pending, next) { VAR_4[VAR_2++] = &VAR_3->iocb; if (VAR_2 == MAX_QUEUED_IO) { break; } } VAR_1 = io_submit(VAR_0->ctx, VAR_2, VAR_4); if (VAR_1 == -EAGAIN) { break; } if (VAR_1 < 0) { abort(); } VAR_0->io_q.n -= VAR_1; VAR_3 = container_of(VAR_4[VAR_1 - 1], struct qemu_laiocb, iocb); QSIMPLEQ_SPLIT_AFTER(&VAR_0->io_q.pending, VAR_3, next, &completed); } while (VAR_1 == VAR_2 && !QSIMPLEQ_EMPTY(&VAR_0->io_q.pending)); VAR_0->io_q.blocked = (VAR_0->io_q.n > 0); }