static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)

{

    BlockRequest *blkreq;

    uint64_t sector;



    sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector);



    bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE);



    trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512);



    if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) {

        virtio_blk_rw_complete(req, -EIO);

        return;

    }



    if (mrb->num_writes == 32) {

        virtio_submit_multiwrite(req->dev->bs, mrb);

    }



    blkreq = &mrb->blkreq[mrb->num_writes];

    blkreq->sector = sector;

    blkreq->nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE;

    blkreq->qiov = &req->qiov;

    blkreq->cb = virtio_blk_rw_complete;

    blkreq->opaque = req;

    blkreq->error = 0;



    mrb->num_writes++;

}

static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)

{

    BlockRequest *blkreq;

    uint64_t sector;



    sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector);



    bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE);



    trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512);



    if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) {

        virtio_blk_rw_complete(req, -EIO);

        return;

    }



    if (mrb->num_writes == 32) {

        virtio_submit_multiwrite(req->dev->bs, mrb);

    }



    blkreq = &mrb->blkreq[mrb->num_writes];

    blkreq->sector = sector;

    blkreq->nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE;

    blkreq->qiov = &req->qiov;

    blkreq->cb = virtio_blk_rw_complete;

    blkreq->opaque = req;

    blkreq->error = 0;



    mrb->num_writes++;

}

    bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE);         virtio_blk_rw_complete(req, -EIO);         virtio_blk_rw_complete(req, -EIO);
static void FUNC_0(VirtIOBlockReq *VAR_0, MultiReqBuffer *VAR_1)

{

    BlockRequest *blkreq;

    uint64_t sector;



    sector = virtio_ldq_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.sector);



    bdrv_acct_start(VAR_0->dev->bs, &VAR_0->acct, VAR_0->qiov.size, BDRV_ACCT_WRITE);



    trace_virtio_blk_handle_write(VAR_0, sector, VAR_0->qiov.size / 512);



    if (!virtio_blk_sect_range_ok(VAR_0->dev, sector, VAR_0->qiov.size)) {

        virtio_blk_rw_complete(VAR_0, -EIO);

        return;

    }



    if (VAR_1->num_writes == 32) {

        virtio_submit_multiwrite(VAR_0->dev->bs, VAR_1);

    }



    blkreq = &VAR_1->blkreq[VAR_1->num_writes];

    blkreq->sector = sector;

    blkreq->nb_sectors = VAR_0->qiov.size / BDRV_SECTOR_SIZE;

    blkreq->qiov = &VAR_0->qiov;

    blkreq->cb = virtio_blk_rw_complete;

    blkreq->opaque = VAR_0;

    blkreq->error = 0;



    VAR_1->num_writes++;

}

static void FUNC_0(VirtIOBlockReq *VAR_0, MultiReqBuffer *VAR_1)
{ BlockRequest *blkreq; uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.sector); bdrv_acct_start(VAR_0->dev->bs, &VAR_0->acct, VAR_0->qiov.size, BDRV_ACCT_WRITE); trace_virtio_blk_handle_write(VAR_0, sector, VAR_0->qiov.size / 512); if (!virtio_blk_sect_range_ok(VAR_0->dev, sector, VAR_0->qiov.size)) { virtio_blk_rw_complete(VAR_0, -EIO); return; } if (VAR_1->num_writes == 32) { virtio_submit_multiwrite(VAR_0->dev->bs, VAR_1); } blkreq = &VAR_1->blkreq[VAR_1->num_writes]; blkreq->sector = sector; blkreq->nb_sectors = VAR_0->qiov.size / BDRV_SECTOR_SIZE; blkreq->qiov = &VAR_0->qiov; blkreq->cb = virtio_blk_rw_complete; blkreq->opaque = VAR_0; blkreq->error = 0; VAR_1->num_writes++; }