Statistics
| Branch: | Revision:

root / block / qcow.c @ feature-archipelago

History | View | Annotate | Download (28.6 kB)

# Date Author Comment
76abe407 02/21/2014 10:02 pm Paolo Bonzini

block: do not abuse EMEDIUMTYPE

Returning "Wrong medium type" for an image that does not have a valid
header is a bit weird. Improve the error by mentioning what format
was trying to open it.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Fam Zheng <>...

b6d5066d 02/21/2014 10:02 pm Paolo Bonzini

qcow: correctly propagate errors

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

2e40134b 02/21/2014 10:02 pm Max Reitz

block: Make bdrv_file_open() static

Add the bdrv_open() option BDRV_O_PROTOCOL which results in passing the
call to bdrv_file_open(). Additionally, make bdrv_file_open() static and
therefore bdrv_open() the only way to call it.

Consequently, all existing calls to bdrv_file_open() have to be adjusted...

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

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

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

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

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

16b3c5cd 04/22/2013 11:27 am Stefan Hajnoczi

qcow: allow sub-cluster compressed write to last cluster

Compression in qcow 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...

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

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

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

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

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

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

caf71f86 12/19/2012 09:31 am Paolo Bonzini

migration: move include files to include/migration/

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

d177692e 09/24/2012 04:15 pm Jeff Cody

block: qcow image file reopen

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

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

Signed-off-by: Jeff Cody <>
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,...

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

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

84b0ec02 01/26/2012 03:49 pm Li Zhi Hui

qcow: Return real error code in qcow_open

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

2b16c9ff 01/26/2012 03:49 pm Li Zhi Hui

qcow: Use bdrv functions to replace file operation

Since common file operation functions lack of error detection and use
much more I/O syscalls, so change them to bdrv series functions and
reduce I/O request.

Signed-off-by: Li Zhi Hui <>...

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

fd9f102c 11/23/2011 06:03 pm Kevin Wolf

qcow: Add migration blocker

qcow caches L2 tables. For migration to work, they would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <>

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

64ebe71a 10/28/2011 08:25 pm Kevin Wolf

qcow: Fix bdrv_write_compressed error handling

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

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

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

add8d262 10/14/2011 04:57 pm Stefan Weil

block/qcow: Fix use of free() instead of g_free()

cppcheck reported this error:

qemu/block/qcow.c:599: error: Mismatching allocation and deallocation: cluster_data

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

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

430bbaaa 08/23/2011 06:41 pm Frediano Ziglio

qcow: QCowAIOCB field cleanup

remove unused field from this structure and put some of them in qcow_aio_read_cb and qcow_aio_write_cb

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

43ca85b5 08/23/2011 06:41 pm Frediano Ziglio

qcow: move some blocks of code to avoid useless variable initialization

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

27deebe8 08/23/2011 06:41 pm Frediano Ziglio

qcow: Remove QCowAIOCB

Embed qcow_aio_read_cb into qcow_co_readv and qcow_aio_write_cb into qcow_co_writev

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

122bbd1d 08/23/2011 06:41 pm Frediano Ziglio

qcow: remove old #undefined code

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

de33b1f3 08/23/2011 03:15 pm Scott Wood

qcow: initialize coroutine mutex

commit 52b8eb60132b27ad53476490e9d7579003390cfa added a mutex,
but never initialized it. This caused a segfault.

Reported-by: Alexander Graf <>
Signed-off-by: Scott Wood <>
Signed-off-by: Kevin Wolf <>

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

52b8eb60 08/02/2011 04:53 pm Kevin Wolf

qcow: Use coroutines

The old qcow format is another user of the AsyncContext infrastructure.
Converting it to coroutines (and therefore CoMutexes) allows to remove
AsyncContexts.

Signed-off-by: Kevin Wolf <>

b11a24de 06/14/2011 06:03 pm Kevin Wolf

qcow: Avoid direct AIO callback

bdrv_aio_* must not call the callback before returning to its caller. In qcow,
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 <>

5614c188 03/15/2011 02:21 pm Stefan Weil

block/qcow: Don't ignore immediate read/write and other failures

This patch is similar to 171e3d6b9997c98a97d0c525867f7cd9b640cadd
which fixed qcow2:

Returning -EIO is far from optimal, but at least it's an error code.

In addition to read/write failures, -EIO is also returned when...

80465c50 11/24/2010 06:31 pm Kevin Wolf

block: Remove unused s->hd in various drivers

All drivers use bs->file instead of s->hd for quite a while now, so it's time
to remove s->hd.

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

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

5e5557d9 06/22/2010 03:38 pm Kevin Wolf

qcow: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.

Signed-off-by: Kevin Wolf <>

b666d239 05/17/2010 11:20 am Kevin Wolf

block: Avoid unchecked casts for AIOCBs

Use container_of for one direction and &acb->common for the other one.

Signed-off-by: Kevin Wolf <>

66f82cee 05/03/2010 11:07 am Kevin Wolf

block: Open the underlying image file in generic code

Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which...

98c2b2f4 03/09/2010 07:23 pm Juan Quintela

qcow: return errno instead of -1

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

3e1a8134 01/26/2010 10:59 pm Kirill A. Shutemov

block/qcow.c: fix warnings with _FORTIFY_SOURCE

CC block/qcow.o
cc1: warnings being treated as errors
block/qcow.c: In function 'qcow_create':
block/qcow.c:804: error: ignoring return value of 'write', declared with attribute warn_unused_result
block/qcow.c:806: error: ignoring return value of 'write', declared with attribute warn_unused_result...

f8012c13 01/14/2010 01:14 am Kevin Wolf

qcow/qcow2: implement bdrv_aio_flush

Now that we do not have to flush the backing device anymore implementing
the bdrv_aio_flush method for image formats is trivial.

[hch: forward ported to qemu mainline from a product tree]

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

c53ffce9 07/10/2009 09:44 pm Kevin Wolf

qcow1: Fix qcow_aio_writev

Pass is_write = 1 to qcow_aio_setup when writing.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

db08adf5 06/06/2009 06:38 pm Kevin Wolf

qemu-img: Print available options with -o ?

This patch adds a small help text to each of the options in the block drivers
which can be displayed by using qemu-img create -f fmt -o ?

Signed-off-by: Kevin Wolf <>

c16b5a2c 05/27/2009 05:46 pm Christoph Hellwig

fully split aio_pool from BlockDriver

Now that we have a separate aio pool structure we can remove those
aio pool details from BlockDriver.

Every driver supporting AIO now needs to declare a static AIOPool
with the aiocb size and the cancellation method. This cleans up the...

ad53089b 05/27/2009 05:45 pm Christoph Hellwig

qcow: add qcow_aio_setup helper

[this one is required for [PATCH] fully split aio_pool from BlockDriver,
sorry for not sending it out earlier]

Add a qcow_aio_setup helper to qcow to shared common code between
the aio_readv and aio_writev methods. Based on the function with...

ade40677 05/27/2009 05:45 pm Kevin Wolf

qcow/qcow2: Drop synchronous qcow_write()

There is only one (internal) user left and it can be switched to the normal
emulation provided in block.c

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

0e7e1989 05/22/2009 06:50 pm Kevin Wolf

Convert all block drivers to new bdrv_create

Now we can make use of the newly introduced option structures. Instead of
having bdrv_create carry more and more parameters (which are format specific in
most cases), just pass a option structure as defined by the driver itself....

019d6b8f 05/15/2009 12:13 am Anthony Liguori

Move block drivers into their own directory

Signed-off-by: Anthony Liguori <>