mirror of https://github.com/xemu-project/xemu.git
Merge remote-tracking branch 'stefanha/block' into staging
# By Max Reitz (5) and others # Via Stefan Hajnoczi * stefanha/block: block: use correct filename qemu-iotests: Correct 026 output qcow2: Free allocated L2 cluster on error qcow2: Switch L1 table in a single sequence block: vhdx - add migration blocker block: use correct filename for error report qcow2: CHECK_OFLAG_COPIED is obsolete qcow2: Correct endianness in overlap check Message-id: 1381145289-6591-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
This commit is contained in:
commit
a107170537
8
block.c
8
block.c
|
@ -808,8 +808,8 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (error_is_set(&local_err)) {
|
if (error_is_set(&local_err)) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
} else if (filename) {
|
} else if (bs->filename[0]) {
|
||||||
error_setg_errno(errp, -ret, "Could not open '%s'", filename);
|
error_setg_errno(errp, -ret, "Could not open '%s'", bs->filename);
|
||||||
} else {
|
} else {
|
||||||
error_setg_errno(errp, -ret, "Could not open image");
|
error_setg_errno(errp, -ret, "Could not open image");
|
||||||
}
|
}
|
||||||
|
@ -824,8 +824,8 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (bs->is_temporary) {
|
if (bs->is_temporary) {
|
||||||
assert(filename != NULL);
|
assert(bs->filename[0] != '\0');
|
||||||
unlink(filename);
|
unlink(bs->filename);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -35,6 +35,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
|
||||||
BDRVQcowState *s = bs->opaque;
|
BDRVQcowState *s = bs->opaque;
|
||||||
int new_l1_size2, ret, i;
|
int new_l1_size2, ret, i;
|
||||||
uint64_t *new_l1_table;
|
uint64_t *new_l1_table;
|
||||||
|
int64_t old_l1_table_offset, old_l1_size;
|
||||||
int64_t new_l1_table_offset, new_l1_size;
|
int64_t new_l1_table_offset, new_l1_size;
|
||||||
uint8_t data[12];
|
uint8_t data[12];
|
||||||
|
|
||||||
|
@ -106,11 +107,13 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
g_free(s->l1_table);
|
g_free(s->l1_table);
|
||||||
qcow2_free_clusters(bs, s->l1_table_offset, s->l1_size * sizeof(uint64_t),
|
old_l1_table_offset = s->l1_table_offset;
|
||||||
QCOW2_DISCARD_OTHER);
|
|
||||||
s->l1_table_offset = new_l1_table_offset;
|
s->l1_table_offset = new_l1_table_offset;
|
||||||
s->l1_table = new_l1_table;
|
s->l1_table = new_l1_table;
|
||||||
|
old_l1_size = s->l1_size;
|
||||||
s->l1_size = new_l1_size;
|
s->l1_size = new_l1_size;
|
||||||
|
qcow2_free_clusters(bs, old_l1_table_offset, old_l1_size * sizeof(uint64_t),
|
||||||
|
QCOW2_DISCARD_OTHER);
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
g_free(new_l1_table);
|
g_free(new_l1_table);
|
||||||
|
@ -270,6 +273,10 @@ fail:
|
||||||
qcow2_cache_put(bs, s->l2_table_cache, (void**) table);
|
qcow2_cache_put(bs, s->l2_table_cache, (void**) table);
|
||||||
}
|
}
|
||||||
s->l1_table[l1_index] = old_l2_offset;
|
s->l1_table[l1_index] = old_l2_offset;
|
||||||
|
if (l2_offset > 0) {
|
||||||
|
qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t),
|
||||||
|
QCOW2_DISCARD_ALWAYS);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1034,7 +1034,6 @@ static void inc_refcounts(BlockDriverState *bs,
|
||||||
|
|
||||||
/* Flags for check_refcounts_l1() and check_refcounts_l2() */
|
/* Flags for check_refcounts_l1() and check_refcounts_l2() */
|
||||||
enum {
|
enum {
|
||||||
CHECK_OFLAG_COPIED = 0x1, /* check QCOW_OFLAG_COPIED matches refcount */
|
|
||||||
CHECK_FRAG_INFO = 0x2, /* update BlockFragInfo counters */
|
CHECK_FRAG_INFO = 0x2, /* update BlockFragInfo counters */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1481,8 +1480,7 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
|
||||||
|
|
||||||
/* current L1 table */
|
/* current L1 table */
|
||||||
ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
|
ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
|
||||||
s->l1_table_offset, s->l1_size,
|
s->l1_table_offset, s->l1_size, CHECK_FRAG_INFO);
|
||||||
CHECK_OFLAG_COPIED | CHECK_FRAG_INFO);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -1733,8 +1731,8 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int chk, int64_t offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < l1_sz; j++) {
|
for (j = 0; j < l1_sz; j++) {
|
||||||
if ((l1[j] & L1E_OFFSET_MASK) &&
|
uint64_t l2_ofs = be64_to_cpu(l1[j]) & L1E_OFFSET_MASK;
|
||||||
overlaps_with(l1[j] & L1E_OFFSET_MASK, s->cluster_size)) {
|
if (l2_ofs && overlaps_with(l2_ofs, s->cluster_size)) {
|
||||||
g_free(l1);
|
g_free(l1);
|
||||||
return QCOW2_OL_INACTIVE_L2;
|
return QCOW2_OL_INACTIVE_L2;
|
||||||
}
|
}
|
||||||
|
|
10
block/vhdx.c
10
block/vhdx.c
|
@ -20,6 +20,7 @@
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "qemu/crc32c.h"
|
#include "qemu/crc32c.h"
|
||||||
#include "block/vhdx.h"
|
#include "block/vhdx.h"
|
||||||
|
#include "migration/migration.h"
|
||||||
|
|
||||||
|
|
||||||
/* Several metadata and region table data entries are identified by
|
/* Several metadata and region table data entries are identified by
|
||||||
|
@ -159,6 +160,7 @@ typedef struct BDRVVHDXState {
|
||||||
VHDXParentLocatorHeader parent_header;
|
VHDXParentLocatorHeader parent_header;
|
||||||
VHDXParentLocatorEntry *parent_entries;
|
VHDXParentLocatorEntry *parent_entries;
|
||||||
|
|
||||||
|
Error *migration_blocker;
|
||||||
} BDRVVHDXState;
|
} BDRVVHDXState;
|
||||||
|
|
||||||
uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size,
|
uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size,
|
||||||
|
@ -806,6 +808,12 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
|
|
||||||
/* TODO: differencing files, write */
|
/* TODO: differencing files, write */
|
||||||
|
|
||||||
|
/* Disable migration when VHDX images are used */
|
||||||
|
error_set(&s->migration_blocker,
|
||||||
|
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
|
||||||
|
"vhdx", bs->device_name, "live migration");
|
||||||
|
migrate_add_blocker(s->migration_blocker);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
qemu_vfree(s->headers[0]);
|
qemu_vfree(s->headers[0]);
|
||||||
|
@ -952,6 +960,8 @@ static void vhdx_close(BlockDriverState *bs)
|
||||||
qemu_vfree(s->headers[1]);
|
qemu_vfree(s->headers[1]);
|
||||||
qemu_vfree(s->bat);
|
qemu_vfree(s->bat);
|
||||||
qemu_vfree(s->parent_entries);
|
qemu_vfree(s->parent_entries);
|
||||||
|
migrate_del_blocker(s->migration_blocker);
|
||||||
|
error_free(s->migration_blocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BlockDriver bdrv_vhdx = {
|
static BlockDriver bdrv_vhdx = {
|
||||||
|
|
|
@ -5,16 +5,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 5; imm: off; once: on; write
|
Event: l1_update; errno: 5; imm: off; once: on; write
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 5; imm: off; once: on; write -b
|
Event: l1_update; errno: 5; imm: off; once: on; write -b
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 5; imm: off; once: off; write
|
Event: l1_update; errno: 5; imm: off; once: off; write
|
||||||
|
@ -33,16 +29,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 28; imm: off; once: on; write
|
Event: l1_update; errno: 28; imm: off; once: on; write
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 28; imm: off; once: on; write -b
|
Event: l1_update; errno: 28; imm: off; once: on; write -b
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 28; imm: off; once: off; write
|
Event: l1_update; errno: 28; imm: off; once: off; write
|
||||||
|
@ -181,16 +173,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 5; imm: off; once: on; write
|
Event: l2_alloc.write; errno: 5; imm: off; once: on; write
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 5; imm: off; once: on; write -b
|
Event: l2_alloc.write; errno: 5; imm: off; once: on; write -b
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 5; imm: off; once: off; write
|
Event: l2_alloc.write; errno: 5; imm: off; once: off; write
|
||||||
|
@ -207,16 +195,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 28; imm: off; once: on; write
|
Event: l2_alloc.write; errno: 28; imm: off; once: on; write
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 28; imm: off; once: on; write -b
|
Event: l2_alloc.write; errno: 28; imm: off; once: on; write -b
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 28; imm: off; once: off; write
|
Event: l2_alloc.write; errno: 28; imm: off; once: off; write
|
||||||
|
|
|
@ -5,16 +5,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 5; imm: off; once: on; write
|
Event: l1_update; errno: 5; imm: off; once: on; write
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 5; imm: off; once: on; write -b
|
Event: l1_update; errno: 5; imm: off; once: on; write -b
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 5; imm: off; once: off; write
|
Event: l1_update; errno: 5; imm: off; once: off; write
|
||||||
|
@ -33,16 +29,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 28; imm: off; once: on; write
|
Event: l1_update; errno: 28; imm: off; once: on; write
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 28; imm: off; once: on; write -b
|
Event: l1_update; errno: 28; imm: off; once: on; write -b
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l1_update; errno: 28; imm: off; once: off; write
|
Event: l1_update; errno: 28; imm: off; once: off; write
|
||||||
|
@ -189,16 +181,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 5; imm: off; once: on; write
|
Event: l2_alloc.write; errno: 5; imm: off; once: on; write
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 5; imm: off; once: on; write -b
|
Event: l2_alloc.write; errno: 5; imm: off; once: on; write -b
|
||||||
write failed: Input/output error
|
write failed: Input/output error
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 5; imm: off; once: off; write
|
Event: l2_alloc.write; errno: 5; imm: off; once: off; write
|
||||||
|
@ -215,16 +203,12 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 28; imm: off; once: on; write
|
Event: l2_alloc.write; errno: 28; imm: off; once: on; write
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 28; imm: off; once: on; write -b
|
Event: l2_alloc.write; errno: 28; imm: off; once: on; write -b
|
||||||
write failed: No space left on device
|
write failed: No space left on device
|
||||||
|
No errors were found on the image.
|
||||||
1 leaked clusters were found on the image.
|
|
||||||
This means waste of disk space, but no harm to data.
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||||
|
|
||||||
Event: l2_alloc.write; errno: 28; imm: off; once: off; write
|
Event: l2_alloc.write; errno: 28; imm: off; once: off; write
|
||||||
|
|
Loading…
Reference in New Issue