• Home
  • Raw
  • Download

Lines Matching refs:acb

506     QCowAIOCB *acb = container_of(blockacb, QCowAIOCB, common);  in qcow_aio_cancel()  local
507 if (acb->hd_aiocb) in qcow_aio_cancel()
508 bdrv_aio_cancel(acb->hd_aiocb); in qcow_aio_cancel()
509 qemu_aio_release(acb); in qcow_aio_cancel()
521 QCowAIOCB *acb; in qcow_aio_setup() local
523 acb = qemu_aio_get(&qcow_aio_pool, bs, cb, opaque); in qcow_aio_setup()
524 if (!acb) in qcow_aio_setup()
526 acb->hd_aiocb = NULL; in qcow_aio_setup()
527 acb->sector_num = sector_num; in qcow_aio_setup()
528 acb->qiov = qiov; in qcow_aio_setup()
530 acb->buf = acb->orig_buf = qemu_blockalign(bs, qiov->size); in qcow_aio_setup()
532 qemu_iovec_to_buffer(qiov, acb->buf); in qcow_aio_setup()
534 acb->buf = (uint8_t *)qiov->iov->iov_base; in qcow_aio_setup()
536 acb->nb_sectors = nb_sectors; in qcow_aio_setup()
537 acb->n = 0; in qcow_aio_setup()
538 acb->cluster_offset = 0; in qcow_aio_setup()
539 return acb; in qcow_aio_setup()
544 QCowAIOCB *acb = opaque; in qcow_aio_read_cb() local
545 BlockDriverState *bs = acb->common.bs; in qcow_aio_read_cb()
549 acb->hd_aiocb = NULL; in qcow_aio_read_cb()
555 if (!acb->cluster_offset) { in qcow_aio_read_cb()
557 } else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) { in qcow_aio_read_cb()
561 encrypt_sectors(s, acb->sector_num, acb->buf, acb->buf, in qcow_aio_read_cb()
562 acb->n, 0, in qcow_aio_read_cb()
567 acb->nb_sectors -= acb->n; in qcow_aio_read_cb()
568 acb->sector_num += acb->n; in qcow_aio_read_cb()
569 acb->buf += acb->n * 512; in qcow_aio_read_cb()
571 if (acb->nb_sectors == 0) { in qcow_aio_read_cb()
578 acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, in qcow_aio_read_cb()
580 index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); in qcow_aio_read_cb()
581 acb->n = s->cluster_sectors - index_in_cluster; in qcow_aio_read_cb()
582 if (acb->n > acb->nb_sectors) in qcow_aio_read_cb()
583 acb->n = acb->nb_sectors; in qcow_aio_read_cb()
585 if (!acb->cluster_offset) { in qcow_aio_read_cb()
588 acb->hd_iov.iov_base = (void *)acb->buf; in qcow_aio_read_cb()
589 acb->hd_iov.iov_len = acb->n * 512; in qcow_aio_read_cb()
590 qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); in qcow_aio_read_cb()
591 acb->hd_aiocb = bdrv_aio_readv(bs->backing_hd, acb->sector_num, in qcow_aio_read_cb()
592 &acb->hd_qiov, acb->n, qcow_aio_read_cb, acb); in qcow_aio_read_cb()
593 if (acb->hd_aiocb == NULL) in qcow_aio_read_cb()
597 memset(acb->buf, 0, 512 * acb->n); in qcow_aio_read_cb()
600 } else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) { in qcow_aio_read_cb()
602 if (decompress_cluster(bs, acb->cluster_offset) < 0) in qcow_aio_read_cb()
604 memcpy(acb->buf, in qcow_aio_read_cb()
605 s->cluster_cache + index_in_cluster * 512, 512 * acb->n); in qcow_aio_read_cb()
608 if ((acb->cluster_offset & 511) != 0) { in qcow_aio_read_cb()
612 acb->hd_iov.iov_base = (void *)acb->buf; in qcow_aio_read_cb()
613 acb->hd_iov.iov_len = acb->n * 512; in qcow_aio_read_cb()
614 qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); in qcow_aio_read_cb()
615 acb->hd_aiocb = bdrv_aio_readv(bs->file, in qcow_aio_read_cb()
616 (acb->cluster_offset >> 9) + index_in_cluster, in qcow_aio_read_cb()
617 &acb->hd_qiov, acb->n, qcow_aio_read_cb, acb); in qcow_aio_read_cb()
618 if (acb->hd_aiocb == NULL) in qcow_aio_read_cb()
625 if (acb->qiov->niov > 1) { in qcow_aio_read_cb()
626 qemu_iovec_from_buffer(acb->qiov, acb->orig_buf, acb->qiov->size); in qcow_aio_read_cb()
627 qemu_vfree(acb->orig_buf); in qcow_aio_read_cb()
629 acb->common.cb(acb->common.opaque, ret); in qcow_aio_read_cb()
630 qemu_aio_release(acb); in qcow_aio_read_cb()
637 QCowAIOCB *acb; in qcow_aio_readv() local
639 acb = qcow_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0); in qcow_aio_readv()
640 if (!acb) in qcow_aio_readv()
643 qcow_aio_read_cb(acb, 0); in qcow_aio_readv()
644 return &acb->common; in qcow_aio_readv()
649 QCowAIOCB *acb = opaque; in qcow_aio_write_cb() local
650 BlockDriverState *bs = acb->common.bs; in qcow_aio_write_cb()
656 acb->hd_aiocb = NULL; in qcow_aio_write_cb()
661 acb->nb_sectors -= acb->n; in qcow_aio_write_cb()
662 acb->sector_num += acb->n; in qcow_aio_write_cb()
663 acb->buf += acb->n * 512; in qcow_aio_write_cb()
665 if (acb->nb_sectors == 0) { in qcow_aio_write_cb()
671 index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); in qcow_aio_write_cb()
672 acb->n = s->cluster_sectors - index_in_cluster; in qcow_aio_write_cb()
673 if (acb->n > acb->nb_sectors) in qcow_aio_write_cb()
674 acb->n = acb->nb_sectors; in qcow_aio_write_cb()
675 cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 1, 0, in qcow_aio_write_cb()
677 index_in_cluster + acb->n); in qcow_aio_write_cb()
683 if (!acb->cluster_data) { in qcow_aio_write_cb()
684 acb->cluster_data = qemu_mallocz(s->cluster_size); in qcow_aio_write_cb()
685 if (!acb->cluster_data) { in qcow_aio_write_cb()
690 encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf, in qcow_aio_write_cb()
691 acb->n, 1, &s->aes_encrypt_key); in qcow_aio_write_cb()
692 src_buf = acb->cluster_data; in qcow_aio_write_cb()
694 src_buf = acb->buf; in qcow_aio_write_cb()
697 acb->hd_iov.iov_base = (void *)src_buf; in qcow_aio_write_cb()
698 acb->hd_iov.iov_len = acb->n * 512; in qcow_aio_write_cb()
699 qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); in qcow_aio_write_cb()
700 acb->hd_aiocb = bdrv_aio_writev(bs->file, in qcow_aio_write_cb()
702 &acb->hd_qiov, acb->n, in qcow_aio_write_cb()
703 qcow_aio_write_cb, acb); in qcow_aio_write_cb()
704 if (acb->hd_aiocb == NULL) in qcow_aio_write_cb()
709 if (acb->qiov->niov > 1) in qcow_aio_write_cb()
710 qemu_vfree(acb->orig_buf); in qcow_aio_write_cb()
711 acb->common.cb(acb->common.opaque, ret); in qcow_aio_write_cb()
712 qemu_aio_release(acb); in qcow_aio_write_cb()
720 QCowAIOCB *acb; in qcow_aio_writev() local
724 acb = qcow_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 1); in qcow_aio_writev()
725 if (!acb) in qcow_aio_writev()
729 qcow_aio_write_cb(acb, 0); in qcow_aio_writev()
730 return &acb->common; in qcow_aio_writev()