qcow2.c (ae5475e82fd1ebb24f4f77cf28f59ca6548c6136) | qcow2.c (061ca8a368165fae300748c17971824a089f521f) |
---|---|
1/* 2 * Block driver for the QCOW version 2 format 3 * 4 * Copyright (c) 2004-2006 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 2529 unchanged lines hidden (view full) --- 2538 * Returns: 0 on success, -errno on failure. 2539 */ 2540static void coroutine_fn preallocate_co(void *opaque) 2541{ 2542 PreallocCo *params = opaque; 2543 BlockDriverState *bs = params->bs; 2544 uint64_t offset = params->offset; 2545 uint64_t new_length = params->new_length; | 1/* 2 * Block driver for the QCOW version 2 format 3 * 4 * Copyright (c) 2004-2006 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 2529 unchanged lines hidden (view full) --- 2538 * Returns: 0 on success, -errno on failure. 2539 */ 2540static void coroutine_fn preallocate_co(void *opaque) 2541{ 2542 PreallocCo *params = opaque; 2543 BlockDriverState *bs = params->bs; 2544 uint64_t offset = params->offset; 2545 uint64_t new_length = params->new_length; |
2546 BDRVQcow2State *s = bs->opaque; | |
2547 uint64_t bytes; 2548 uint64_t host_offset = 0; 2549 unsigned int cur_bytes; 2550 int ret; 2551 QCowL2Meta *meta; 2552 | 2546 uint64_t bytes; 2547 uint64_t host_offset = 0; 2548 unsigned int cur_bytes; 2549 int ret; 2550 QCowL2Meta *meta; 2551 |
2553 qemu_co_mutex_lock(&s->lock); 2554 | |
2555 assert(offset <= new_length); 2556 bytes = new_length - offset; 2557 2558 while (bytes) { 2559 cur_bytes = MIN(bytes, INT_MAX); 2560 ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, 2561 &host_offset, &meta); 2562 if (ret < 0) { --- 36 unchanged lines hidden (view full) --- 2599 if (ret < 0) { 2600 goto done; 2601 } 2602 } 2603 2604 ret = 0; 2605 2606done: | 2552 assert(offset <= new_length); 2553 bytes = new_length - offset; 2554 2555 while (bytes) { 2556 cur_bytes = MIN(bytes, INT_MAX); 2557 ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, 2558 &host_offset, &meta); 2559 if (ret < 0) { --- 36 unchanged lines hidden (view full) --- 2596 if (ret < 0) { 2597 goto done; 2598 } 2599 } 2600 2601 ret = 0; 2602 2603done: |
2607 qemu_co_mutex_unlock(&s->lock); | |
2608 params->ret = ret; 2609} 2610 2611static int preallocate(BlockDriverState *bs, 2612 uint64_t offset, uint64_t new_length) 2613{ 2614 PreallocCo params = { 2615 .bs = bs, --- 420 unchanged lines hidden (view full) --- 3036 ret = qcow2_set_up_encryption(blk_bs(blk), qcow2_opts->encrypt, errp); 3037 if (ret < 0) { 3038 goto out; 3039 } 3040 } 3041 3042 /* And if we're supposed to preallocate metadata, do that now */ 3043 if (qcow2_opts->preallocation != PREALLOC_MODE_OFF) { | 2604 params->ret = ret; 2605} 2606 2607static int preallocate(BlockDriverState *bs, 2608 uint64_t offset, uint64_t new_length) 2609{ 2610 PreallocCo params = { 2611 .bs = bs, --- 420 unchanged lines hidden (view full) --- 3032 ret = qcow2_set_up_encryption(blk_bs(blk), qcow2_opts->encrypt, errp); 3033 if (ret < 0) { 3034 goto out; 3035 } 3036 } 3037 3038 /* And if we're supposed to preallocate metadata, do that now */ 3039 if (qcow2_opts->preallocation != PREALLOC_MODE_OFF) { |
3040 BDRVQcow2State *s = blk_bs(blk)->opaque; 3041 qemu_co_mutex_lock(&s->lock); |
|
3044 ret = preallocate(blk_bs(blk), 0, qcow2_opts->size); | 3042 ret = preallocate(blk_bs(blk), 0, qcow2_opts->size); |
3043 qemu_co_mutex_unlock(&s->lock); 3044 |
|
3045 if (ret < 0) { 3046 error_setg_errno(errp, -ret, "Could not preallocate metadata"); 3047 goto out; 3048 } 3049 } 3050 3051 blk_unref(blk); 3052 blk = NULL; --- 379 unchanged lines hidden (view full) --- 3432 qemu_co_mutex_unlock(&s->lock); 3433 3434 qemu_vfree(cluster_data); 3435 trace_qcow2_writev_done_req(qemu_coroutine_self(), ret); 3436 3437 return ret; 3438} 3439 | 3045 if (ret < 0) { 3046 error_setg_errno(errp, -ret, "Could not preallocate metadata"); 3047 goto out; 3048 } 3049 } 3050 3051 blk_unref(blk); 3052 blk = NULL; --- 379 unchanged lines hidden (view full) --- 3432 qemu_co_mutex_unlock(&s->lock); 3433 3434 qemu_vfree(cluster_data); 3435 trace_qcow2_writev_done_req(qemu_coroutine_self(), ret); 3436 3437 return ret; 3438} 3439 |
3440static int qcow2_truncate(BlockDriverState *bs, int64_t offset, 3441 PreallocMode prealloc, Error **errp) | 3440static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, 3441 PreallocMode prealloc, Error **errp) |
3442{ 3443 BDRVQcow2State *s = bs->opaque; 3444 uint64_t old_length; 3445 int64_t new_l1_size; 3446 int ret; 3447 3448 if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA && 3449 prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL) 3450 { 3451 error_setg(errp, "Unsupported preallocation mode '%s'", 3452 PreallocMode_str(prealloc)); 3453 return -ENOTSUP; 3454 } 3455 3456 if (offset & 511) { 3457 error_setg(errp, "The new size must be a multiple of 512"); 3458 return -EINVAL; 3459 } 3460 | 3442{ 3443 BDRVQcow2State *s = bs->opaque; 3444 uint64_t old_length; 3445 int64_t new_l1_size; 3446 int ret; 3447 3448 if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA && 3449 prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL) 3450 { 3451 error_setg(errp, "Unsupported preallocation mode '%s'", 3452 PreallocMode_str(prealloc)); 3453 return -ENOTSUP; 3454 } 3455 3456 if (offset & 511) { 3457 error_setg(errp, "The new size must be a multiple of 512"); 3458 return -EINVAL; 3459 } 3460 |
3461 qemu_co_mutex_lock(&s->lock); 3462 |
|
3461 /* cannot proceed if image has snapshots */ 3462 if (s->nb_snapshots) { 3463 error_setg(errp, "Can't resize an image which has snapshots"); | 3463 /* cannot proceed if image has snapshots */ 3464 if (s->nb_snapshots) { 3465 error_setg(errp, "Can't resize an image which has snapshots"); |
3464 return -ENOTSUP; | 3466 ret = -ENOTSUP; 3467 goto fail; |
3465 } 3466 3467 /* cannot proceed if image has bitmaps */ 3468 if (s->nb_bitmaps) { 3469 /* TODO: resize bitmaps in the image */ 3470 error_setg(errp, "Can't resize an image which has bitmaps"); | 3468 } 3469 3470 /* cannot proceed if image has bitmaps */ 3471 if (s->nb_bitmaps) { 3472 /* TODO: resize bitmaps in the image */ 3473 error_setg(errp, "Can't resize an image which has bitmaps"); |
3471 return -ENOTSUP; | 3474 ret = -ENOTSUP; 3475 goto fail; |
3472 } 3473 3474 old_length = bs->total_sectors * 512; 3475 new_l1_size = size_to_l1(s, offset); 3476 3477 if (offset < old_length) { 3478 int64_t last_cluster, old_file_size; 3479 if (prealloc != PREALLOC_MODE_OFF) { 3480 error_setg(errp, 3481 "Preallocation can't be used for shrinking an image"); | 3476 } 3477 3478 old_length = bs->total_sectors * 512; 3479 new_l1_size = size_to_l1(s, offset); 3480 3481 if (offset < old_length) { 3482 int64_t last_cluster, old_file_size; 3483 if (prealloc != PREALLOC_MODE_OFF) { 3484 error_setg(errp, 3485 "Preallocation can't be used for shrinking an image"); |
3482 return -EINVAL; | 3486 ret = -EINVAL; 3487 goto fail; |
3483 } 3484 3485 ret = qcow2_cluster_discard(bs, ROUND_UP(offset, s->cluster_size), 3486 old_length - ROUND_UP(offset, 3487 s->cluster_size), 3488 QCOW2_DISCARD_ALWAYS, true); 3489 if (ret < 0) { 3490 error_setg_errno(errp, -ret, "Failed to discard cropped clusters"); | 3488 } 3489 3490 ret = qcow2_cluster_discard(bs, ROUND_UP(offset, s->cluster_size), 3491 old_length - ROUND_UP(offset, 3492 s->cluster_size), 3493 QCOW2_DISCARD_ALWAYS, true); 3494 if (ret < 0) { 3495 error_setg_errno(errp, -ret, "Failed to discard cropped clusters"); |
3491 return ret; | 3496 goto fail; |
3492 } 3493 3494 ret = qcow2_shrink_l1_table(bs, new_l1_size); 3495 if (ret < 0) { 3496 error_setg_errno(errp, -ret, 3497 "Failed to reduce the number of L2 tables"); | 3497 } 3498 3499 ret = qcow2_shrink_l1_table(bs, new_l1_size); 3500 if (ret < 0) { 3501 error_setg_errno(errp, -ret, 3502 "Failed to reduce the number of L2 tables"); |
3498 return ret; | 3503 goto fail; |
3499 } 3500 3501 ret = qcow2_shrink_reftable(bs); 3502 if (ret < 0) { 3503 error_setg_errno(errp, -ret, 3504 "Failed to discard unused refblocks"); | 3504 } 3505 3506 ret = qcow2_shrink_reftable(bs); 3507 if (ret < 0) { 3508 error_setg_errno(errp, -ret, 3509 "Failed to discard unused refblocks"); |
3505 return ret; | 3510 goto fail; |
3506 } 3507 3508 old_file_size = bdrv_getlength(bs->file->bs); 3509 if (old_file_size < 0) { 3510 error_setg_errno(errp, -old_file_size, 3511 "Failed to inquire current file length"); | 3511 } 3512 3513 old_file_size = bdrv_getlength(bs->file->bs); 3514 if (old_file_size < 0) { 3515 error_setg_errno(errp, -old_file_size, 3516 "Failed to inquire current file length"); |
3512 return old_file_size; | 3517 ret = old_file_size; 3518 goto fail; |
3513 } 3514 last_cluster = qcow2_get_last_cluster(bs, old_file_size); 3515 if (last_cluster < 0) { 3516 error_setg_errno(errp, -last_cluster, 3517 "Failed to find the last cluster"); | 3519 } 3520 last_cluster = qcow2_get_last_cluster(bs, old_file_size); 3521 if (last_cluster < 0) { 3522 error_setg_errno(errp, -last_cluster, 3523 "Failed to find the last cluster"); |
3518 return last_cluster; | 3524 ret = last_cluster; 3525 goto fail; |
3519 } 3520 if ((last_cluster + 1) * s->cluster_size < old_file_size) { 3521 Error *local_err = NULL; 3522 | 3526 } 3527 if ((last_cluster + 1) * s->cluster_size < old_file_size) { 3528 Error *local_err = NULL; 3529 |
3523 bdrv_truncate(bs->file, (last_cluster + 1) * s->cluster_size, 3524 PREALLOC_MODE_OFF, &local_err); | 3530 bdrv_co_truncate(bs->file, (last_cluster + 1) * s->cluster_size, 3531 PREALLOC_MODE_OFF, &local_err); |
3525 if (local_err) { 3526 warn_reportf_err(local_err, 3527 "Failed to truncate the tail of the image: "); 3528 } 3529 } 3530 } else { 3531 ret = qcow2_grow_l1_table(bs, new_l1_size, true); 3532 if (ret < 0) { 3533 error_setg_errno(errp, -ret, "Failed to grow the L1 table"); | 3532 if (local_err) { 3533 warn_reportf_err(local_err, 3534 "Failed to truncate the tail of the image: "); 3535 } 3536 } 3537 } else { 3538 ret = qcow2_grow_l1_table(bs, new_l1_size, true); 3539 if (ret < 0) { 3540 error_setg_errno(errp, -ret, "Failed to grow the L1 table"); |
3534 return ret; | 3541 goto fail; |
3535 } 3536 } 3537 3538 switch (prealloc) { 3539 case PREALLOC_MODE_OFF: 3540 break; 3541 3542 case PREALLOC_MODE_METADATA: 3543 ret = preallocate(bs, old_length, offset); 3544 if (ret < 0) { 3545 error_setg_errno(errp, -ret, "Preallocation failed"); | 3542 } 3543 } 3544 3545 switch (prealloc) { 3546 case PREALLOC_MODE_OFF: 3547 break; 3548 3549 case PREALLOC_MODE_METADATA: 3550 ret = preallocate(bs, old_length, offset); 3551 if (ret < 0) { 3552 error_setg_errno(errp, -ret, "Preallocation failed"); |
3546 return ret; | 3553 goto fail; |
3547 } 3548 break; 3549 3550 case PREALLOC_MODE_FALLOC: 3551 case PREALLOC_MODE_FULL: 3552 { 3553 int64_t allocation_start, host_offset, guest_offset; 3554 int64_t clusters_allocated; 3555 int64_t old_file_size, new_file_size; 3556 uint64_t nb_new_data_clusters, nb_new_l2_tables; 3557 3558 old_file_size = bdrv_getlength(bs->file->bs); 3559 if (old_file_size < 0) { 3560 error_setg_errno(errp, -old_file_size, 3561 "Failed to inquire current file length"); | 3554 } 3555 break; 3556 3557 case PREALLOC_MODE_FALLOC: 3558 case PREALLOC_MODE_FULL: 3559 { 3560 int64_t allocation_start, host_offset, guest_offset; 3561 int64_t clusters_allocated; 3562 int64_t old_file_size, new_file_size; 3563 uint64_t nb_new_data_clusters, nb_new_l2_tables; 3564 3565 old_file_size = bdrv_getlength(bs->file->bs); 3566 if (old_file_size < 0) { 3567 error_setg_errno(errp, -old_file_size, 3568 "Failed to inquire current file length"); |
3562 return old_file_size; | 3569 ret = old_file_size; 3570 goto fail; |
3563 } 3564 old_file_size = ROUND_UP(old_file_size, s->cluster_size); 3565 3566 nb_new_data_clusters = DIV_ROUND_UP(offset - old_length, 3567 s->cluster_size); 3568 3569 /* This is an overestimation; we will not actually allocate space for 3570 * these in the file but just make sure the new refcount structures are --- 13 unchanged lines hidden (view full) --- 3584 3585 allocation_start = qcow2_refcount_area(bs, old_file_size, 3586 nb_new_data_clusters + 3587 nb_new_l2_tables, 3588 true, 0, 0); 3589 if (allocation_start < 0) { 3590 error_setg_errno(errp, -allocation_start, 3591 "Failed to resize refcount structures"); | 3571 } 3572 old_file_size = ROUND_UP(old_file_size, s->cluster_size); 3573 3574 nb_new_data_clusters = DIV_ROUND_UP(offset - old_length, 3575 s->cluster_size); 3576 3577 /* This is an overestimation; we will not actually allocate space for 3578 * these in the file but just make sure the new refcount structures are --- 13 unchanged lines hidden (view full) --- 3592 3593 allocation_start = qcow2_refcount_area(bs, old_file_size, 3594 nb_new_data_clusters + 3595 nb_new_l2_tables, 3596 true, 0, 0); 3597 if (allocation_start < 0) { 3598 error_setg_errno(errp, -allocation_start, 3599 "Failed to resize refcount structures"); |
3592 return allocation_start; | 3600 ret = allocation_start; 3601 goto fail; |
3593 } 3594 3595 clusters_allocated = qcow2_alloc_clusters_at(bs, allocation_start, 3596 nb_new_data_clusters); 3597 if (clusters_allocated < 0) { 3598 error_setg_errno(errp, -clusters_allocated, 3599 "Failed to allocate data clusters"); | 3602 } 3603 3604 clusters_allocated = qcow2_alloc_clusters_at(bs, allocation_start, 3605 nb_new_data_clusters); 3606 if (clusters_allocated < 0) { 3607 error_setg_errno(errp, -clusters_allocated, 3608 "Failed to allocate data clusters"); |
3600 return clusters_allocated; | 3609 ret = clusters_allocated; 3610 goto fail; |
3601 } 3602 3603 assert(clusters_allocated == nb_new_data_clusters); 3604 3605 /* Allocate the data area */ 3606 new_file_size = allocation_start + 3607 nb_new_data_clusters * s->cluster_size; | 3611 } 3612 3613 assert(clusters_allocated == nb_new_data_clusters); 3614 3615 /* Allocate the data area */ 3616 new_file_size = allocation_start + 3617 nb_new_data_clusters * s->cluster_size; |
3608 ret = bdrv_truncate(bs->file, new_file_size, prealloc, errp); | 3618 ret = bdrv_co_truncate(bs->file, new_file_size, prealloc, errp); |
3609 if (ret < 0) { 3610 error_prepend(errp, "Failed to resize underlying file: "); 3611 qcow2_free_clusters(bs, allocation_start, 3612 nb_new_data_clusters * s->cluster_size, 3613 QCOW2_DISCARD_OTHER); | 3619 if (ret < 0) { 3620 error_prepend(errp, "Failed to resize underlying file: "); 3621 qcow2_free_clusters(bs, allocation_start, 3622 nb_new_data_clusters * s->cluster_size, 3623 QCOW2_DISCARD_OTHER); |
3614 return ret; | 3624 goto fail; |
3615 } 3616 3617 /* Create the necessary L2 entries */ 3618 host_offset = allocation_start; 3619 guest_offset = old_length; 3620 while (nb_new_data_clusters) { 3621 int64_t nb_clusters = MIN( 3622 nb_new_data_clusters, --- 6 unchanged lines hidden (view full) --- 3629 qemu_co_queue_init(&allocation.dependent_requests); 3630 3631 ret = qcow2_alloc_cluster_link_l2(bs, &allocation); 3632 if (ret < 0) { 3633 error_setg_errno(errp, -ret, "Failed to update L2 tables"); 3634 qcow2_free_clusters(bs, host_offset, 3635 nb_new_data_clusters * s->cluster_size, 3636 QCOW2_DISCARD_OTHER); | 3625 } 3626 3627 /* Create the necessary L2 entries */ 3628 host_offset = allocation_start; 3629 guest_offset = old_length; 3630 while (nb_new_data_clusters) { 3631 int64_t nb_clusters = MIN( 3632 nb_new_data_clusters, --- 6 unchanged lines hidden (view full) --- 3639 qemu_co_queue_init(&allocation.dependent_requests); 3640 3641 ret = qcow2_alloc_cluster_link_l2(bs, &allocation); 3642 if (ret < 0) { 3643 error_setg_errno(errp, -ret, "Failed to update L2 tables"); 3644 qcow2_free_clusters(bs, host_offset, 3645 nb_new_data_clusters * s->cluster_size, 3646 QCOW2_DISCARD_OTHER); |
3637 return ret; | 3647 goto fail; |
3638 } 3639 3640 guest_offset += nb_clusters * s->cluster_size; 3641 host_offset += nb_clusters * s->cluster_size; 3642 nb_new_data_clusters -= nb_clusters; 3643 } 3644 break; 3645 } 3646 3647 default: 3648 g_assert_not_reached(); 3649 } 3650 3651 if (prealloc != PREALLOC_MODE_OFF) { 3652 /* Flush metadata before actually changing the image size */ | 3648 } 3649 3650 guest_offset += nb_clusters * s->cluster_size; 3651 host_offset += nb_clusters * s->cluster_size; 3652 nb_new_data_clusters -= nb_clusters; 3653 } 3654 break; 3655 } 3656 3657 default: 3658 g_assert_not_reached(); 3659 } 3660 3661 if (prealloc != PREALLOC_MODE_OFF) { 3662 /* Flush metadata before actually changing the image size */ |
3653 ret = bdrv_flush(bs); | 3663 ret = qcow2_write_caches(bs); |
3654 if (ret < 0) { 3655 error_setg_errno(errp, -ret, 3656 "Failed to flush the preallocated area to disk"); | 3664 if (ret < 0) { 3665 error_setg_errno(errp, -ret, 3666 "Failed to flush the preallocated area to disk"); |
3657 return ret; | 3667 goto fail; |
3658 } 3659 } 3660 3661 /* write updated header.size */ 3662 offset = cpu_to_be64(offset); 3663 ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), 3664 &offset, sizeof(uint64_t)); 3665 if (ret < 0) { 3666 error_setg_errno(errp, -ret, "Failed to update the image size"); | 3668 } 3669 } 3670 3671 /* write updated header.size */ 3672 offset = cpu_to_be64(offset); 3673 ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), 3674 &offset, sizeof(uint64_t)); 3675 if (ret < 0) { 3676 error_setg_errno(errp, -ret, "Failed to update the image size"); |
3667 return ret; | 3677 goto fail; |
3668 } 3669 3670 s->l1_vm_state_index = new_l1_size; | 3678 } 3679 3680 s->l1_vm_state_index = new_l1_size; |
3671 return 0; | 3681 ret = 0; 3682fail: 3683 qemu_co_mutex_unlock(&s->lock); 3684 return ret; |
3672} 3673 3674/* XXX: put compressed sectors first, then all the cluster aligned 3675 tables to avoid losing bytes in alignment */ 3676static coroutine_fn int 3677qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, 3678 uint64_t bytes, QEMUIOVector *qiov) 3679{ --- 7 unchanged lines hidden (view full) --- 3687 3688 if (bytes == 0) { 3689 /* align end of file to a sector boundary to ease reading with 3690 sector based I/Os */ 3691 cluster_offset = bdrv_getlength(bs->file->bs); 3692 if (cluster_offset < 0) { 3693 return cluster_offset; 3694 } | 3685} 3686 3687/* XXX: put compressed sectors first, then all the cluster aligned 3688 tables to avoid losing bytes in alignment */ 3689static coroutine_fn int 3690qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, 3691 uint64_t bytes, QEMUIOVector *qiov) 3692{ --- 7 unchanged lines hidden (view full) --- 3700 3701 if (bytes == 0) { 3702 /* align end of file to a sector boundary to ease reading with 3703 sector based I/Os */ 3704 cluster_offset = bdrv_getlength(bs->file->bs); 3705 if (cluster_offset < 0) { 3706 return cluster_offset; 3707 } |
3695 return bdrv_truncate(bs->file, cluster_offset, PREALLOC_MODE_OFF, NULL); | 3708 return bdrv_co_truncate(bs->file, cluster_offset, PREALLOC_MODE_OFF, 3709 NULL); |
3696 } 3697 3698 if (offset_into_cluster(s, offset)) { 3699 return -EINVAL; 3700 } 3701 3702 buf = qemu_blockalign(bs, s->cluster_size); 3703 if (bytes != s->cluster_size) { --- 987 unchanged lines hidden (view full) --- 4691 .bdrv_co_preadv = qcow2_co_preadv, 4692 .bdrv_co_pwritev = qcow2_co_pwritev, 4693 .bdrv_co_flush_to_os = qcow2_co_flush_to_os, 4694 4695 .bdrv_co_pwrite_zeroes = qcow2_co_pwrite_zeroes, 4696 .bdrv_co_pdiscard = qcow2_co_pdiscard, 4697 .bdrv_co_copy_range_from = qcow2_co_copy_range_from, 4698 .bdrv_co_copy_range_to = qcow2_co_copy_range_to, | 3710 } 3711 3712 if (offset_into_cluster(s, offset)) { 3713 return -EINVAL; 3714 } 3715 3716 buf = qemu_blockalign(bs, s->cluster_size); 3717 if (bytes != s->cluster_size) { --- 987 unchanged lines hidden (view full) --- 4705 .bdrv_co_preadv = qcow2_co_preadv, 4706 .bdrv_co_pwritev = qcow2_co_pwritev, 4707 .bdrv_co_flush_to_os = qcow2_co_flush_to_os, 4708 4709 .bdrv_co_pwrite_zeroes = qcow2_co_pwrite_zeroes, 4710 .bdrv_co_pdiscard = qcow2_co_pdiscard, 4711 .bdrv_co_copy_range_from = qcow2_co_copy_range_from, 4712 .bdrv_co_copy_range_to = qcow2_co_copy_range_to, |
4699 .bdrv_truncate = qcow2_truncate, | 4713 .bdrv_co_truncate = qcow2_co_truncate, |
4700 .bdrv_co_pwritev_compressed = qcow2_co_pwritev_compressed, 4701 .bdrv_make_empty = qcow2_make_empty, 4702 4703 .bdrv_snapshot_create = qcow2_snapshot_create, 4704 .bdrv_snapshot_goto = qcow2_snapshot_goto, 4705 .bdrv_snapshot_delete = qcow2_snapshot_delete, 4706 .bdrv_snapshot_list = qcow2_snapshot_list, 4707 .bdrv_snapshot_load_tmp = qcow2_snapshot_load_tmp, --- 32 unchanged lines hidden --- | 4714 .bdrv_co_pwritev_compressed = qcow2_co_pwritev_compressed, 4715 .bdrv_make_empty = qcow2_make_empty, 4716 4717 .bdrv_snapshot_create = qcow2_snapshot_create, 4718 .bdrv_snapshot_goto = qcow2_snapshot_goto, 4719 .bdrv_snapshot_delete = qcow2_snapshot_delete, 4720 .bdrv_snapshot_list = qcow2_snapshot_list, 4721 .bdrv_snapshot_load_tmp = qcow2_snapshot_load_tmp, --- 32 unchanged lines hidden --- |