Statistics
| Branch: | Revision:

root / block / qcow2.c @ c4d9d196

History | View | Annotate | Download (51.6 kB)

# Date Author Comment
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 <>...

e24e49e6 02/09/2012 05:17 pm Kevin Wolf

qcow2: Update whole header at once

In order to switch the backing file, qcow2 issues multiple write
requests that only changed a part of the image header. Any failure after
the first one would leave the header in an corrupted state. With this
patch, the whole header is written at once, so we can't fail in the...

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...

28c1202b 12/15/2011 01:40 pm Li Zhi Hui

block/qcow2.c: call qcow2_free_snapshots in the function of qcow2_close

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

eb5d5bea 12/05/2011 05:39 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

e8ee5e4c 12/05/2011 03:51 pm Stefan Hajnoczi

coroutine: add qemu_co_queue_restart_all()

It's common to wake up all waiting coroutines. Introduce the
qemu_co_queue_restart_all() function to do this instead of looping over
qemu_co_queue_next() in every caller.

Signed-off-by: Stefan Hajnoczi <>...

f8a2e5e3 12/05/2011 03:51 pm Stefan Hajnoczi

block: convert qcow2, qcow2, and vmdk to .bdrv_co_is_allocated()

The qcow2, qcow, and vmdk block drivers are based on coroutines. They have a
coroutine mutex which protects internal state. We can convert the
.bdrv_is_allocated() function to .bdrv_co_is_allocated() by holding the mutex...

a968168c 12/05/2011 03:51 pm Dong Xu Wang

block: Add coroutine_fn marker to coroutine functions

Looks better when reviewing these source files.

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

42deb29f 12/05/2011 03:51 pm Kevin Wolf

qcow2: Return real error code in qcow2_read_snapshots

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

9b2260cb 12/02/2011 12:50 pm Dong Xu Wang

fix spelling in block sub directory

Cc: Kevin Wolf <>
Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>

06d9260f 11/21/2011 10:58 pm Anthony Liguori

qcow2: implement bdrv_invalidate_cache (v2)

We don't reopen the actual file, but instead invoke the close and open routines.
We specifically ignore the backing file since it's contents are read-only and
therefore immutable.

Signed-off-by: Anthony Liguori <>

c68b89ac 11/11/2011 03:02 pm Kevin Wolf

block: Rename bdrv_co_flush to bdrv_co_flush_to_disk

There are two different types of flush that you can do: Flushing one level up
to the OS (i.e. writing data to the host page cache) or flushing it all the way
down to the disk. The existing functions flush to the disk, reflect this in the...

eb489bb1 11/11/2011 03:02 pm Kevin Wolf

block: Introduce bdrv_co_flush_to_os

qcow2 has a writeback metadata cache, so flushing a qcow2 image actually
consists of writing back that cache to the protocol and only then flushes the
protocol in order to get everything stable on disk.

This introduces a separate bdrv_co_flush_to_os to reflect the split....

c95de7e2 10/28/2011 08:25 pm Dong Xu Wang

block: fix qcow2_co_flush deadlock

If qcow2_cache_flush failed, s->lock will not be unlock.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Kevin Wolf <>

8b94ff85 10/21/2011 06:34 pm Paolo Bonzini

block: change flush to co_flush

Since coroutine operation is now mandatory, convert all bdrv_flush
implementations to coroutines. For qcow2, this means taking the lock.
Other implementations are simpler and just forward bdrv_flush to the
underlying protocol, so they can avoid the lock....

6db39ae2 10/21/2011 06:34 pm Paolo Bonzini

block: change discard to co_discard

Since coroutine operation is now mandatory, convert both bdrv_discard
implementations to coroutines. For qcow2, this means taking the lock
around the operation. raw-posix remains synchronous.

The bdrv_discard callback is then unused and can be eliminated....

6f6dc656 10/21/2011 06:34 pm Stefan Hajnoczi

block: drop redundant bdrv_flush implementation

Block drivers now only need to provide either of .bdrv_co_flush,
.bdrv_aio_flush() or for legacy drivers .bdrv_flush(). Remove
the redundant .bdrv_flush() implementations.

[Paolo Bonzini: change raw driver to bdrv_co_flush]...

8f1efd00 10/21/2011 06:34 pm Kevin Wolf

qcow2: Fix bdrv_write_compressed error handling

If during allocation of compressed clusters the cluster was already allocated
uncompressed, fail and properly release the l2_table (the latter avoids a
failed assertion).

While at it, make it return some real error numbers instead of -1....

dea43a65 09/12/2011 04:17 pm Frediano Ziglio

qcow2: align cluster_data to block to improve performance using O_DIRECT

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

8e217d53 09/06/2011 12:23 pm Kevin Wolf

qcow2: Properly initialise QcowL2Meta

Dependency list pointers filled with random garbage from the stack aren't a
good idea.

Signed-off-by: Kevin Wolf <>

0fa9131a 09/06/2011 12:23 pm Kevin Wolf

qcow2: Fix error cases to run depedent requests

Requests depending on a failed request would end up waiting forever. This fixes
the error path to continue dependent requests even when the request has failed.

Signed-off-by: Kevin Wolf <>

ab0997e0 08/23/2011 06:41 pm Frediano Ziglio

qcow2: remove memory leak

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

f5cd8173 08/23/2011 06:41 pm Frediano Ziglio

qcow/qcow2: Allocate QCowAIOCB structure using stack

instead of calling qemi_aio_get use stack

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

4617310c 08/23/2011 06:41 pm Frediano Ziglio

qcow2: Removed unused AIOCB fields

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

faf575c1 08/23/2011 06:41 pm Frediano Ziglio

qcow2: removed cur_nr_sectors field in QCowAIOCB

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

c2271403 08/23/2011 06:41 pm Frediano Ziglio

qcow2: remove l2meta from QCowAIOCB

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

c2bdd990 08/23/2011 06:41 pm Frediano Ziglio

qcow2: remove cluster_offset from QCowAIOCB

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

e78c69b8 08/23/2011 06:41 pm Frediano Ziglio

qcow2: remove common from QCowAIOCB

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

5ebaa27e 08/23/2011 06:41 pm Frediano Ziglio

qcow2: reindent and use while before the big jump

prepare to remove read/write callbacks

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

3fc48d09 08/23/2011 06:41 pm Frediano Ziglio

qcow2: Removed QCowAIOCB entirely

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

6cbc3031 08/23/2011 03:15 pm Philipp Hahn

qcow2: Fix DEBUG_* compilation

By introducing BlockDriverState compiling qcow2 with DEBUG_ALLOC and DEBUG_EXT
defined got broken.
Define a BdrvCheckResult structure locally which is now needed as the second
argument.

Also fix qcow2_read_extensions() needing BDRVQcowState....

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

68d100e9 08/02/2011 04:53 pm Kevin Wolf

qcow2: Use coroutines

Signed-off-by: Kevin Wolf <>

6daf194d 06/24/2011 11:13 am Markus Armbruster

Strip trailing '\n' from error_report()'s first argument

error_report() prepends location, and appends a newline. The message
constructed from the arguments should not contain a newline. Fix the
obvious offenders.

Signed-off-by: Markus Armbruster <>...

42496d62 06/14/2011 06:03 pm Kevin Wolf

qcow2: Avoid direct AIO callback

bdrv_aio_* must not call the callback before returning to its caller. In qcow2,
this could happen in some error cases. This starts the real requests processing
in a BH to avoid this situation.

Signed-off-by: Kevin Wolf <>

99cce9fa 06/08/2011 12:56 pm Kevin Wolf

qemu-img create: Fix displayed default cluster size

When not specifying a cluster size on the command line, qemu-img printed
a cluster size of 0:

Formatting '/tmp/test.qcow2', fmt=qcow2 size=67108864
encryption=off cluster_size=0

This patch adds the default cluster size to the QEMUOptionParameter list, so...

a6599793 06/08/2011 11:39 am Christoph Hellwig

block: clarify the meaning of BDRV_O_NOCACHE

Change BDRV_O_NOCACHE to only imply bypassing the host OS file cache,
but no writeback semantics. All existing callers are changed to also
specify BDRV_O_CACHE_WB to give them writeback semantics.

Signed-off-by: Christoph Hellwig <>...

e8cdcec1 02/10/2011 02:23 pm Kevin Wolf

qcow2: Report error for version > 2

The qcow2 driver is now declared responsible for any QCOW image that has
version 2 or greater (before this, version 3 would be detected as raw).

For everything newer than version 2, an error is reported.

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

e0d9c6f9 02/10/2011 02:23 pm Chunqiang Tang

QCOW2: bug fix - read base image beyond its size

This patch fixes the following bug in QCOW2. For a QCOW2 image that is larger
than its base image, when handling a read request straddling over the end of the
base image, the QCOW2 driver attempts to read beyond the end of the base image...

3ab4c7e9 02/10/2011 02:23 pm Kevin Wolf

qcow2: Fix error handling for immediate backing file read failure

Requests could return success even though they failed when bdrv_aio_readv
returned NULL for a backing file read.

Reported-by: Chunqiang Tang <>
Signed-off-by: Kevin Wolf <>

8af36488 02/10/2011 02:23 pm Kevin Wolf

qcow2: Fix error handling for reading compressed clusters

When reading a compressed cluster failed, qcow2 falsely returned success.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Markus Armbruster <>

e1a7107f 02/07/2011 10:44 am Kevin Wolf

qcow2: Really use cache=unsafe for image creation

For cache=unsafe we also need to set BDRV_O_CACHE_WB, otherwise we have some
strange unsafe writethrough mode.

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

5ea929e3 01/31/2011 11:03 am Kevin Wolf

qcow2: Add bdrv_discard support

This adds a bdrv_discard function to qcow2 that frees the discarded clusters.
It does not yet pass the discard on to the underlying file system driver, but
the space can be reused by future writes to the image.

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

29c1a730 01/24/2011 05:41 pm Kevin Wolf

qcow2: Use QcowCache

Use the new functions of qcow2-cache.c for everything that works on refcount
block and L2 tables.

Signed-off-by: Kevin Wolf <>

6d85a57e 12/17/2010 05:15 pm Jes Sorensen

Add proper -errno error return values to qcow2_open()

In addition this adds missing braces to the function to be consistent
with the coding style.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

7c80ab3f 12/17/2010 05:15 pm Jes Sorensen

block/qcow2.c: rename qcow_ functions to qcow2_

It doesn't really make sense for functions in qcow2.c to be named
qcow_ so convert the names to match correctly.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

205ef796 11/04/2010 01:52 pm Kevin Wolf

block: Allow bdrv_flush to return errors

This changes bdrv_flush to return 0 on success and -errno in case of failure.
It's a requirement for implementing proper error handle in users of bdrv_flush.

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

72893756 10/22/2010 03:49 pm Stefan Hajnoczi

qcow2: Support exact L1 table growth

The L1 table grow operation includes a size calculation that bumps up
the new L1 table size in order to anticipate the size needs of vmstate
data. This helps reduce the number of times that the L1 table has to be
grown when vmstate data is appended....

a9420734 10/22/2010 03:49 pm Kevin Wolf

qcow2: Simplify image creation

Instead of doing lots of magic for setting up initial refcount blocks and stuff
create a minimal (inconsistent) image, open it and initialize the rest with
regular qcow2 functions.

This is a complete rewrite of the image creation function. The old...

9b036055 10/22/2010 03:49 pm Kevin Wolf

qcow2: Remove old image creation function

They have been #ifdef'd out by the previous patch.

Signed-off-by: Kevin Wolf <>

51ef6727 10/22/2010 03:49 pm edison

Copy snapshots out of QCOW2 disk

In order to backup snapshots, created from QCOW2 iamge, we want to copy snapshots out of QCOW2 disk to a seperate storage.
The following patch adds a new option in "qemu-img": qemu-img convert -f qcow2 -O qcow2 -s snapshot_name src_img bck_img....

6f5f060b 09/21/2010 04:39 pm Kevin Wolf

qcow2: Avoid bounce buffers for AIO write requests

qcow2 used to use bounce buffers for any AIO requests. This does not only imply
unnecessary copying, but also unbounded allocations which should be avoided.

This patch removes bounce buffers from the normal AIO write path. Encrypted...

bd28f835 09/21/2010 04:39 pm Kevin Wolf

qcow2: Avoid bounce buffers for AIO read requests

qcow2 used to use bounce buffers for any AIO requests. This does not only imply
unnecessary copying, but also unbounded allocations which should be avoided.

This patch removes bounce buffers from the normal AIO read path, and constrains...

9ac228e0 07/06/2010 06:05 pm Kevin Wolf

qcow2/vdi: Change check to distinguish error cases

This distinguishes between harmless leaks and real corruption. Hopefully users
better understand what qemu-img check wants to tell them.

Signed-off-by: Kevin Wolf <>