Statistics
| Branch: | Revision:

root / block / qcow2.c @ 72daa72e

History | View | Annotate | Download (70.6 kB)

# Date Author Comment
72daa72e 01/22/2014 01:07 pm Max Reitz

block: Allow reference for bdrv_file_open()

Allow specifying a reference to an existing block device (by name) for
bdrv_file_open() instead of a filename and/or options.

Signed-off-by: Max Reitz <>
Reviewed-by: Kevin Wolf <>...

87ea75d5 01/06/2014 10:02 pm Peter Crosthwaite

qemu-option: Remove qemu_opts_create_nofail

This is a boiler-plate _nofail variant of qemu_opts_create. Remove and
use error_abort in call sites.

null/0 arguments needs to be added for the id and fail_if_exists fields
in affected callsites due to argument inconsistency between the normal and...

f8413b3c 12/04/2013 12:29 pm Kevin Wolf

qcow2: Zero-initialise first cluster for new images

Strictly speaking, this is only required for has_zero_init() == false,
but it's easy enough to just do a cluster-aligned write that is padded
with zeros after the header.

This fixes that after 'qemu-img create' header extensions are attempted...

95de6d70 12/03/2013 04:26 pm Paolo Bonzini

block drivers: add discard/write_zeroes properties to bdrv_get_info implementation

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Peter Lieven <>
Signed-off-by: Stefan Hajnoczi <>

cffb1ec6 12/03/2013 04:26 pm Paolo Bonzini

block drivers: expose requirement for write same alignment from formats

This will let misaligned but large requests use zero clusters. This
is important because the cluster size is not guest visible.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Peter Lieven <>...

c9fbb99d 11/29/2013 06:41 pm Kevin Wolf

block: Use BDRV_O_NO_BACKING where appropriate

If you open an image temporarily just because you want to check its size
or get it flushed, there's no real reason to open the whole backing file
chain.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Fam Zheng <>...

aa7bfbff 11/28/2013 11:30 am Peter Lieven

block: add flags to bdrv_*_write_zeroes

Reviewed-by: Eric Blake <>
Signed-off-by: Peter Lieven <>
Signed-off-by: Stefan Hajnoczi <>

ba2ab2f2 10/28/2013 06:34 pm Max Reitz

qcow2: Flush image after creation

Opening the qcow2 image with BDRV_O_NO_FLUSH prevents any flushes during
the image creation. This means that the image has not yet been flushed
to disk when qemu-img create exits. This flush is delayed until the next
operation on the image involving opening it without BDRV_O_NO_FLUSH and...

6e13610a 10/24/2013 12:50 pm Max Reitz

qcow2: Unset zero_beyond_eof in save_vmstate

Saving the VM state is done using bdrv_pwrite. This function may perform
a read-modify-write, which in this case results in data being read from
beyond the end of the virtual disk. Since we are actually trying to...

eedff66f 10/24/2013 12:45 pm Max Reitz

qcow2: Restore total_sectors value in save_vmstate

Since df2a6f29a5, bdrv_co_do_writev increases the total_sectors value of
a growable block devices on writes after the current end. This leads to
the virtual disk apparently growing in qcow2_save_vmstate, which in turn...

231bb267 10/11/2013 05:50 pm Max Reitz

qcow2: Use negated overflow check mask

In qcow2_check_metadata_overlap and qcow2_pre_write_overlap_check,
change the parameter signifying the checks to perform from its current
positive form to a negative one, i.e., it will no longer explicitly
specify every check to perform but rather a mask of checks not to...

3e355390 10/11/2013 05:50 pm Max Reitz

qcow2: Make overlap check mask variable

Replace the QCOW2_OL_DEFAULT macro by a variable overlap_check in
BDRVQcowState.

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

05de7e86 10/11/2013 05:50 pm Max Reitz

qcow2: Add overlap-check options

Add runtime options to tune the overlap checks to be performed before
write accesses.

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

4092e99d 10/11/2013 05:50 pm Max Reitz

qcow2: Array assigning options to OL check bits

Add an array which assigns the option string to its corresponding
overlap check bit.

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

1fa5cc83 10/11/2013 05:50 pm Max Reitz

qcow2: Evaluate overlap check options

Evaluate the runtime overlap check options and set
BDRVQcowState.overlap_check appropriately.

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

9e3f0892 10/11/2013 05:49 pm Max Reitz

qcow2: Add missing space in error message

The error message in qcow2_downgrade about an unsupported refcount
order is missing a space. This patch adds it.

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

f9bff971 10/11/2013 05:49 pm Max Reitz

qcow2: Remove wrong metadata overlap check

In qcow2_write_compressed, if the compression fails, a normal cluster is
written to disk. This is done through bdrv_write on the qcow2 BDS
itself (using the guest offset), thus it is wrong to do a metadata
overlap check before....

37764dfb 10/11/2013 03:03 pm Max Reitz

qcow2: Add support for ImageInfoSpecific

Add a new ImageInfoSpecificQCow2 type as a subtype of ImageInfoSpecific.
This contains the compatibility level as a string and an optional
lazy_refcounts boolean (optional means mandatory for compat >= 1.1 and
not available for compat == 0.10)....

c4217f64 09/25/2013 09:51 pm Jeff Cody

block: qcow2 - used QEMU_PACKED for on-disk structures

QCowHeader and QCowExtension are structs that reside in the on-disk
image format, and are read and written directly via bdrv_pread()/write(),
and as such should be packed to avoid any unintentional struct padding....

d5124c00 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for creating images

Add an Error ** parameter to BlockDriver.bdrv_create to allow more
specific error messages.

Signed-off-by: Max Reitz <>

34b5d2c6 09/12/2013 11:12 am Max Reitz

block: Error parameter for open functions

Add an Error ** parameter to bdrv_open, bdrv_file_open and associated
functions to allow more specific error messages.

Signed-off-by: Max Reitz <>

cc84d90f 09/12/2013 11:12 am Max Reitz

block: Error parameter for create functions

Add an Error ** parameter to bdrv_create and its associated functions to
allow more specific error messages.

Signed-off-by: Max Reitz <>

3ef6c40a 09/12/2013 11:12 am Max Reitz

qcow2: Use Error parameter

Employ usage of the new Error ** parameter in qcow2_open, qcow2_create
and associated functions.

Signed-off-by: Max Reitz <>

015a1036 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for opening images

Add an Error ** parameter to BlockDriver.bdrv_open and
BlockDriver.bdrv_file_open to allow more specific error messages.

Signed-off-by: Max Reitz <>

670df5e3 09/12/2013 11:12 am Kevin Wolf

qcow2: Pass discard type to qcow2_discard_clusters()

The function will be used internally instead of only being called for
guest discard requests.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Max Reitz <>

1ebf561c 09/12/2013 11:12 am Kevin Wolf

qcow2: Discard VM state in active L1 after creating snapshot

During savevm, the VM state is written to the active L1 of the image and
then a snapshot is taken. After that, the VM state isn't needed any more
in the active L1 and should be discarded. This is implemented by this...

b6481f37 09/12/2013 11:12 am Max Reitz

qcow2: Save refcount order in BDRVQcowState

Save the image refcount order in BDRVQcowState. This will be relevant
for future code supporting different refcount orders than four and also
for code that needs to verify a certain refcount order for an opened...

9296b3ed 09/12/2013 11:12 am Max Reitz

qcow2: Implement bdrv_amend_options

Implement bdrv_amend_options for compat, size, backing_file, backing_fmt
and lazy_refcounts.

Downgrading images from compat=1.1 to compat=0.10 is achieved through
handling all incompatible flags accordingly, clearing all compatible and...

d663640c 09/06/2013 04:25 pm Paolo Bonzini

block: expect errors from bdrv_co_is_allocated

Some bdrv_is_allocated callers do not expect errors, but the fallback
in qcow2.c might make other callers trip on assertion failures or
infinite loops.

Fix the callers to always look for errors.

Cc: ...

b6b8a333 09/06/2013 04:25 pm Paolo Bonzini

block: introduce bdrv_get_block_status API

For now, bdrv_get_block_status is just another name for bdrv_is_allocated.
The next patches will add more flags.

This also touches all block drivers with a mostly mechanical rename. The
sole exception is cow; because it calls cow_co_is_allocated from the read...

4bc74be9 09/06/2013 04:25 pm Paolo Bonzini

block: return get_block_status data and flags for formats

Reviewed-by: Eric Blake <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

4f6fd349 09/06/2013 04:25 pm Fam Zheng

block: make bdrv_delete() static

Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is no
longer public and should be called by bdrv_unref() if refcnt is
decreased to 0.

This is an identical change because effectively, there's no multiple
reference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets...

24530f3e 09/02/2013 11:15 am Max Reitz

qcow2_check: Mark image consistent

If no corruptions remain after an image repair (and no errors have been
encountered), clear the corrupt flag in qcow2_check.

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

69c98726 08/30/2013 04:48 pm Max Reitz

qcow2: Add corrupt bit

This adds an incompatible bit indicating corruption to qcow2. Any image
with this bit set may not be written to unless for repairing (and
subsequently clearing the bit if the repair has been successful).

Signed-off-by: Max Reitz <>...

cf93980e 08/30/2013 04:48 pm Max Reitz

qcow2: Employ metadata overlap checks

The pre-write overlap check function is now called before most of the
qcow2 writes (aborting it on collision or other error).

Signed-off-by: Max Reitz <>
Signed-off-by: Kevin Wolf <>

9117b477 08/30/2013 04:28 pm Kevin Wolf

qcow2: Change default for new images to compat=1.1

By the time that qemu 1.7 will be released, enough time will have passed
since qemu 1.1, which is the first version to understand version 3
images, that changing the default shouldn't hurt many people any more...

0d51b4de 08/22/2013 03:10 pm Asias He

block: Introduce bs->zero_beyond_eof

In 4146b46c42e0989cb5842e04d88ab6ccb1713a48 (block: Produce zeros when
protocols reading beyond end of file), we break qemu-iotests ./check
-qcow2 022. This happens because qcow2 temporarily sets ->growable = 1
for vmstate accesses (which are stored beyond the end of regular image...

8ad1898c 08/21/2013 03:41 pm Kevin Wolf

qcow2: Change default for new images to compat=1.1

By the time that qemu 1.7 will be released, enough time will have passed
since qemu 1.1, which is the first version to understand version 3
images, that changing the default shouldn't hurt many people any more...

64aa99d3 07/26/2013 10:59 pm Kevin Wolf

qcow2: Use dashes instead of underscores in options

This is what QMP wants to use. The options haven't been enabled in any
release yet, so we're still free to change them.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

3ac21627 06/28/2013 02:52 pm Peter Lieven

block: change default of .has_zero_init to 0

.has_zero_init defaults to 1 for all formats and protocols.

this is a dangerous default since this means that all
new added drivers need to manually overwrite it to 0 if
they do not ensure that a device is zero initialized...

6cfcb9b8 06/24/2013 11:25 am Kevin Wolf

qcow2: Add refcount update reason to all callers

This adds a refcount update reason to all callers of update_refcounts(),
so that a follow-up patch can use this information to decide whether
clusters that reach a refcount of 0 should be discarded in the image...

67af674e 06/24/2013 11:25 am Kevin Wolf

qcow2: Options to enable discard for freed clusters

Deleted snapshots are discarded in the image file by default, discard
requests take their default from the -drive discard=... option and other
places that free clusters must always be enabled explicitly....

0b919fae 06/24/2013 11:25 am Kevin Wolf

qcow2: Batch discards

This optimises the discard operation for freed clusters by batching
discard requests (both snapshot deletion and bdrv_discard end up
updating the refcounts cluster by cluster).

Note that we don't discard asynchronously, but keep s->lock held. This...

2cf7cfa1 05/14/2013 05:44 pm Kevin Wolf

qcow2: Catch some L1 table index overflows

This catches the situation that is described in the bug report at
https://bugs.launchpad.net/qemu/+bug/865518 and goes like this:

$ qemu-img create -f qcow2 huge.qcow2 $((1024*1024))T
Formatting 'huge.qcow2', fmt=qcow2 size=1152921504606846976 encryption=off cluster_size=65536 lazy_refcounts=off...
f4d38bef 04/22/2013 11:27 am Stefan Hajnoczi

qcow2: allow sub-cluster compressed write to last cluster

Compression in qcow2 requires image length to be a multiple of the
cluster size. Lift this requirement by zero-padding the final cluster
when necessary. The virtual disk size is still not cluster-aligned, so...

cf8074b3 04/15/2013 09:26 am Kevin Wolf

block: Introduce bdrv_writev_vmstate

Signed-off-by: Kevin Wolf <>
Signed-off-by: Stefan Hajnoczi <>

8d3b1a2d 04/15/2013 09:26 am Kevin Wolf

block: Introduce bdrv_pwritev() for qcow2_save_vmstate

Directly pass the QEMUIOVector on instead of linearising it.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Stefan Hajnoczi <>

753d9b82 04/13/2013 02:51 pm Aurelien Jarno

aes: move aes.h from include/block to include/qemu

Move aes.h from include/block to include/qemu to show it can be reused
by other subsystems.

Cc: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>
Reviewed-by: Edgar E. Iglesias <>...

88c6588c 03/28/2013 12:52 pm Kevin Wolf

qcow2: Allow requests with multiple l2metas

Instead of expecting a single l2meta, have a list of them. This allows
to still have a single I/O request for the guest data, even though
multiple l2meta may be needed in order to describe both a COW overwrite
and a new cluster allocation (typical sequential write case)....

9ee6439e 03/28/2013 12:52 pm Kevin Wolf

qcow2: Remove bogus unlock of s->lock

The unlock wakes up the next coroutine, but the currently running
coroutine will lock it again before it yields, so this doesn't make a
lot of sense.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Stefan Hajnoczi <>

787e4a85 03/22/2013 06:51 pm Kevin Wolf

block: Add options QDict to bdrv_file_open() prototypes

The new parameter is unused yet.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

acdfb480 03/19/2013 12:48 pm Kevin Wolf

qcow2: Fix segfault in qcow2_invalidate_cache

Need to pass an options QDict to qcow2_open() now. This fixes a segfault
on the migration target with qcow2.

Signed-off-by: Kevin Wolf <>

381b487d 03/15/2013 05:07 pm Paolo Bonzini

qcow2: make is_allocated return true for zero clusters

Otherwise, live migration of the top layer will miss zero clusters and
let the backing file show through. This also matches what is done in qed.

QCOW2_CLUSTER_ZERO clusters are invalid in v2 image files. Check this...

1a86938f 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to .bdrv_open()

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Stefan Hajnoczi <>

de9c0cec 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to bdrv_open() prototype

It doesn't do anything yet except storing the options QDict in the
BlockDriverState.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Hajnoczi <>...

74c4510a 03/15/2013 05:07 pm Kevin Wolf

qcow2: Allow lazy refcounts to be enabled on the command line

qcow2 images now accept a boolean lazy_refcounts options. Use it like
this:

-drive file=test.qcow2,lazy_refcounts=on

If the option is specified on the command line, it overrides the default...

15bac0d5 01/25/2013 07:18 pm Stefan Weil

block: Use error code EMEDIUMTYPE for wrong format in some block drivers

This improves error reports for bochs, cow, qcow, qcow2, qed and vmdk
when a file with the wrong format is selected.

Signed-off-by: Stefan Weil <>
Reviewed-by: Eric Blake <>...

8d2497c3 01/15/2013 10:08 am Kevin Wolf

qcow2: Fix segfault on zero-length write

One of the recent refactoring patches (commit f50f88b9) didn't take care
to initialise l2meta properly, so with zero-length writes, which don't
even enter the write loop, qemu just segfaulted.

Signed-off-by: Kevin Wolf <>...

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

7b1b5d19 12/19/2012 09:31 am Paolo Bonzini

qapi: move include files to include/qobject/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

cf5c1a23 12/13/2012 04:37 pm Kevin Wolf

qcow2: Allocate l2meta dynamically

As soon as delayed COW is introduced, the l2meta struct is needed even
after completion of the request, so it can't live on the stack.

Signed-off-by: Kevin Wolf <>

060bee89 12/13/2012 04:37 pm Kevin Wolf

qcow2: Drop l2meta.cluster_offset

There's no real reason to have an l2meta for normal requests that don't
allocate anything. Before we can get rid of it, we must return the host
cluster offset in a different way.

Signed-off-by: Kevin Wolf <>

f50f88b9 12/13/2012 04:37 pm Kevin Wolf

qcow2: Allocate l2meta only for cluster allocations

Even for writes to already allocated clusters, an l2meta is allocated,
though it stays effectively unused. After this patch, only allocating
requests still have one. Each l2meta now describes an in-flight request...

280d3735 12/13/2012 04:37 pm Kevin Wolf

qcow2: Enable dirty flag in qcow2_alloc_cluster_link_l2

This is closer to where the dirty flag is really needed, and it avoids
having checks for special cases related to cluster allocation directly
in the writev loop.

Signed-off-by: Kevin Wolf <>

4e95314e 12/13/2012 04:37 pm Kevin Wolf

qcow2: Execute run_dependent_requests() without lock

There's no reason for run_dependent_requests() to hold s->lock, and a
later patch will require that in fact the lock is not held.

Also, before this patch, run_dependent_requests() not only does what its...

67a7a0eb 12/12/2012 01:33 pm Kevin Wolf

qcow2: Move BLKDBG_EVENT out of the lock

We want to use these events to suspend requests for testing concurrent
AIO requests. Suspending requests while they are holding the CoMutex is
rather boring for this purpose.

Signed-off-by: Kevin Wolf <>

00ea1881 10/05/2012 03:58 pm Jim Meyering

qcow2: mark this file's sole strncpy use as justified

Acked-by: Kevin Wolf <>
Signed-off-by: Jim Meyering <>
Signed-off-by: Anthony Liguori <>

21d82ac9 09/24/2012 04:15 pm Jeff Cody

block: qcow2 image file reopen

These are the stubs for the file reopen drivers for the qcow2 format.

There is currently nothing that needs to be done by the qcow2 driver
in reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

acbe5982 08/10/2012 11:25 am Stefan Hajnoczi

qcow2: mark image clean after repair succeeds

The dirty bit is cleared after image repair succeeds in qcow2_open().
Move this into qcow2_check() so that all callers benefit from this
behavior when fix mode is enabled.

This is necessary so qemu-img check can call .bdrv_check() and mark the...

058f8f16 08/10/2012 11:25 am Stefan Hajnoczi

block: add BLOCK_O_CHECK for qemu-img check

Image formats with a dirty bit, like qed and qcow2, repair dirty image
files upon open with BDRV_O_RDWR. Performing automatic repair when
qemu-img check runs is not ideal because the bdrv_open() call repairs
the image before the actual bdrv_check() call from qemu-img.c....

c61d0004 08/06/2012 11:39 pm Stefan Hajnoczi

qcow2: introduce dirty bit

This patch adds an incompatible feature bit to mark images that have not
been closed cleanly. When a dirty image file is opened a consistency
check and repair is performed.

Update qemu-iotests 031 and 036 since the extension header size changes...

bfe8043e 08/06/2012 11:39 pm Stefan Hajnoczi

qcow2: implement lazy refcounts

Lazy refcounts is a performance optimization for qcow2 that postpones
refcount metadata updates and instead marks the image dirty. In the
case of crash or power failure the image will be left in a dirty state
and repaired next time it is opened....

23797df3 07/09/2012 08:35 pm Anthony Liguori

Merge remote-tracking branch 'mjt/mjt-iov2' into staging

  • mjt/mjt-iov2:
    rewrite iov_send_recv() and move it to iov.c
    cleanup qemu_co_sendv(), qemu_co_recvv() and friends
    export iov_send_recv() and use it in iov_send() and iov_recv()
    rename qemu_sendv to iov_send, change proto and move declarations to iov.h...
b35278f7 07/09/2012 04:53 pm Stefan Hajnoczi

qcow2: fix #ifdef'd qcow2_check_refcounts() callers

The DEBUG_ALLOC qcow2.h macro enables additional consistency checks
throughout the code. This makes it easier to spot corruptions that are
introduced during development. Since consistency check is an expensive...

6af4e9ea 06/15/2012 03:03 pm Paolo Bonzini

qcow2: always operate caches in writeback mode

Writethrough does not need special-casing anymore in the qcow2 caches.
The block layer adds flushes after every guest-initiated data write,
and these will also flush the qcow2 caches to the OS.

Signed-off-by: Paolo Bonzini <>...

af7b708d 06/15/2012 03:03 pm Stefan Hajnoczi

qcow2: fix autoclear image header update

The autoclear feature bits can be used for qcow2 file format features
that are safe to "drop" by old programs that do not understand the
feature. Upon opening the image file unknown autoclear feature bits are
cleared and the image file header is rewritten, but this was happening...

4534ff54 06/15/2012 03:03 pm Kevin Wolf

qemu-img check -r for repairing images

The QED block driver already provides the functionality to not only
detect inconsistencies in images, but also fix them. However, this
functionality cannot be manually invoked with qemu-img, but the
check happens only automatically during bdrv_open()....

166acf54 06/15/2012 03:03 pm Kevin Wolf

qcow2: Support for fixing refcount inconsistencies

Signed-off-by: Kevin Wolf <>

03396148 06/11/2012 10:12 pm Michael Tokarev

allow qemu_iovec_from_buffer() to specify offset from which to start copying

Similar to
qemu_iovec_memset(QEMUIOVector *qiov, size_t offset,
int c, size_t bytes);
the new prototype is:
qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,...

1b093c48 06/11/2012 10:12 pm Michael Tokarev

consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent

qemu_iovec_concat() is currently a wrapper for
qemu_iovec_copy(), use the former (with extra
"0" arg) in a few places where it is used.

Change skip argument of qemu_iovec_copy() from...

d5e6b161 06/11/2012 10:12 pm Michael Tokarev

change qemu_iovec_to_buf() to match other to,from_buf functions

It now allows specifying offset within qiov to start from and
amount of bytes to copy. Actual implementation is just a call
to iov_to_buf().

Signed-off-by: Michael Tokarev <>

3d9b4925 06/11/2012 10:07 pm Michael Tokarev

consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset()

This patch combines two functions into one, and replaces
the implementation with already existing iov_memset() from
iov.c.

The new prototype of qemu_iovec_memset():...

b6c14762 05/25/2012 07:12 pm Jim Meyering

qcow2: don't leak buffer for unexpected qcow_version in header

Signed-off-by: Jim Meyering <>
Signed-off-by: Kevin Wolf <>

c44bfe46 05/14/2012 06:02 pm Kevin Wolf

qcow2: Don't ignore failure to clear autoclear flags

Signed-off-by: Kevin Wolf <>

5f377794 05/10/2012 11:32 am Paolo Bonzini

block: push bdrv_change_backing_file error checking up from drivers

This check applies to all drivers, but QED lacks it.

Reviewed-by: Kevin Wolf <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

15552c4a 05/07/2012 08:33 pm Zhi Yong Wu

qcow2: lock on prealloc

preallocate() will be locked. This is required because
qcow2_alloc_cluster_link_l2() assumes that it runs under a lock that it
can drop while COW is being performed.

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Kevin Wolf <>

b9531b6e 05/02/2012 07:39 pm Stefan Weil

block/qcow2: Add missing GCC_FMT_ATTR to function report_unsupported()

Cc: Kevin Wolf <>
Signed-off-by: Stefan Weil <>
Signed-off-by: Kevin Wolf <>

621f0589 04/20/2012 04:57 pm Kevin Wolf

qcow2: Zero write support

Signed-off-by: Kevin Wolf <>

6744cbab 04/20/2012 04:57 pm Kevin Wolf

qcow2: Version 3 images

This adds the basic infrastructure to qcow2 to handle version 3 images.
It includes code to create v3 images, allow header updates for v3 images
and checks feature bits.

It still misses support for zero clusters, so this is not a fully...

6377af48 04/20/2012 04:57 pm Kevin Wolf

qcow2: Support reading zero clusters

This adds support for reading zero clusters in version 3 images.

Signed-off-by: Kevin Wolf <>

cfcc4c62 04/20/2012 04:57 pm Kevin Wolf

qcow2: Support for feature table header extension

Instead of printing an ugly bitmask, qemu can now print a more helpful
string even for yet unknown features.

Signed-off-by: Kevin Wolf <>

68d000a3 04/20/2012 04:57 pm Kevin Wolf

qcow2: Ignore reserved bits in get_cluster_offset

With this change, reading from a qcow2 image ignores all reserved bits
that are set in an L1 or L2 table entry.

Now get_cluster_offset() assigns *cluster_offset only the offset without
any other flags. The cluster type is not longer encoded in the offset,...

29cdb251 04/05/2012 03:54 pm Paolo Bonzini

block: push recursive flushing up from drivers

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

3cce16f4 03/12/2012 04:14 pm Kevin Wolf

qcow2: Add some tracing

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

259b2173 03/12/2012 04:14 pm Kevin Wolf

qcow2: Add error messages in qcow2_truncate

qemu-img resize has some limitations with qcow2, but the user is only
told that "this image format does not support resize". Quite confusing,
so add some more detailed error_report() calls and change "this image...

423477e5 02/29/2012 01:48 pm Kevin Wolf

qcow2: Fix build with DEBUG_EXT enabled

Signed-off-by: Kevin Wolf <>

fd29b4bb 02/29/2012 01:48 pm Kevin Wolf

qcow2: Fix offset in qcow2_read_extensions

The spec says that the length of extensions is padded to 8 bytes, not
the offset. Currently this is the same because the header size is a
multiple of 8, so this is only about compatibility with future changes
to the header size....

64ca6aee 02/29/2012 01:48 pm Kevin Wolf

qcow2: Reject too large header extensions

Image files that make qemu-img info read several gigabytes into the
unknown header extensions list are bad. Just fail opening the image
if an extension claims to be larger than the header extension area.

Signed-off-by: Kevin Wolf <>...

75bab85c 02/09/2012 05:17 pm Kevin Wolf

qcow2: Keep unknown header extension when rewriting header

If we want header extensions to work as compatible extensions, we can't
destroy yet unknown header extensions when rewriting the header (e.g.
for changing the backing file). Save all unknown header extensions in a...