qcow2.c (7e0019a7196ebed177c95824875cf852e1a6f667) qcow2.c (e24d813b29d3a478a9309078487efc8ce8599f22)
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

--- 1465 unchanged lines hidden (view full) ---

1474 if (ret < 0) {
1475 error_setg_errno(errp, -ret, "Could not update qcow2 header");
1476 goto fail;
1477 }
1478 }
1479
1480 /* Initialise locks */
1481 qemu_co_mutex_init(&s->lock);
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

--- 1465 unchanged lines hidden (view full) ---

1474 if (ret < 0) {
1475 error_setg_errno(errp, -ret, "Could not update qcow2 header");
1476 goto fail;
1477 }
1478 }
1479
1480 /* Initialise locks */
1481 qemu_co_mutex_init(&s->lock);
1482 bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP;
1482 bs->supported_zero_flags = header.version >= 3 ? BDRV_REQ_MAY_UNMAP : 0;
1483
1484 /* Repair image if dirty */
1485 if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only &&
1486 (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
1487 BdrvCheckResult result = {0};
1488
1489 ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS);
1490 if (ret < 0 || result.check_errors) {

--- 2275 unchanged lines hidden (view full) ---

3766 error_propagate(errp, local_err);
3767 return NULL;
3768}
3769
3770static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
3771{
3772 BDRVQcow2State *s = bs->opaque;
3773 bdi->unallocated_blocks_are_zero = true;
1483
1484 /* Repair image if dirty */
1485 if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only &&
1486 (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
1487 BdrvCheckResult result = {0};
1488
1489 ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS);
1490 if (ret < 0 || result.check_errors) {

--- 2275 unchanged lines hidden (view full) ---

3766 error_propagate(errp, local_err);
3767 return NULL;
3768}
3769
3770static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
3771{
3772 BDRVQcow2State *s = bs->opaque;
3773 bdi->unallocated_blocks_are_zero = true;
3774 bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3);
3775 bdi->cluster_size = s->cluster_size;
3776 bdi->vm_state_offset = qcow2_vm_state_offset(s);
3777 return 0;
3778}
3779
3780static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
3781{
3782 BDRVQcow2State *s = bs->opaque;

--- 599 unchanged lines hidden ---
3774 bdi->cluster_size = s->cluster_size;
3775 bdi->vm_state_offset = qcow2_vm_state_offset(s);
3776 return 0;
3777}
3778
3779static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
3780{
3781 BDRVQcow2State *s = bs->opaque;

--- 599 unchanged lines hidden ---