Statistics
| Branch: | Revision:

root / block @ fb5590f7

# Date Author Comment
c8c3080f 01/26/2012 03:49 pm Marcelo Tosatti

block: add support for partial streaming

Add support for streaming data from an intermediate section of the
image chain (see patch and documentation for details).

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

641543b7 01/26/2012 03:49 pm Stefan Weil

block/vdi: Zero unused parts when allocating a new block (fix #919242)

The new block was filled with zero when it was allocated by g_malloc0,
but when it was reused later and only partially used, data from the
previously allocated block were still present and written to the new...

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

4f1043b4 01/26/2012 12:45 pm Stefan Hajnoczi

block: add image streaming block job

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

5094a6c0 01/26/2012 12:45 pm Stefan Hajnoczi

block: rate-limit streaming operations

This patch implements rate-limiting for image streaming. If we've
exceeded the bandwidth quota for a 100 ms time slice we sleep the
coroutine until the next slice begins.

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

bd603247 01/26/2012 12:39 pm Gregory Farnum

rbd: wire up snapshot removal and rollback functionality

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

031380d8 01/26/2012 12:39 pm Stefan Hajnoczi

block: replace unchecked strdup/malloc/calloc with glib

Most of the codebase as been converted to use glib memory allocation
functions. There are still a few instances of malloc/calloc in the
block layer and qemu-io. Replace them, especially since they do not...

6b620ca3 01/13/2012 06:55 pm Paolo Bonzini

prepare for future GPLv2+ relicensing

All files under GPLv2 will get GPLv2+ changes starting tomorrow.
event_notifier.c and exec-obsolete.h were only ever touched by Red Hat
employees and can be relicensed now.

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

8d987346 01/13/2012 12:36 pm Stefan Hajnoczi

vvfat: avoid leaking file descriptor in commit_one_file()

Reported-by: Dr David Alan Gilbert <>
Signed-off-by: Stefan Hajnoczi <>

128aa589 12/22/2011 12:53 pm Paolo Bonzini

move corking functions to osdep.c

Signed-off-by: Paolo Bonzini <>

ae255e52 12/22/2011 12:53 pm Paolo Bonzini

nbd: switch to asynchronous operation

Signed-off-by: Paolo Bonzini <>

d9b09f13 12/22/2011 12:53 pm Paolo Bonzini

nbd: split requests

qemu-nbd has a limit of slightly less than 1M per request. Work
around this in the nbd block driver.

Signed-off-by: Paolo Bonzini <>

ecda3447 12/22/2011 12:53 pm Paolo Bonzini

nbd: allow multiple in-flight requests

Allow sending up to 16 requests, and drive the replies to the coroutine
that did the request. The code is written to be exactly the same as
before this patch when MAX_NBD_REQUESTS == 1 (modulo the extra mutex
and state)....

2c7989a9 12/22/2011 12:53 pm Paolo Bonzini

nbd: add support for NBD_CMD_FLAG_FUA

Signed-off-by: Paolo Bonzini <>

1486d04a 12/22/2011 12:53 pm Paolo Bonzini

nbd: add support for NBD_CMD_FLUSH

Signed-off-by: Paolo Bonzini <>

7a706633 12/22/2011 12:53 pm Paolo Bonzini

nbd: add support for NBD_CMD_TRIM

Signed-off-by: Paolo Bonzini <>

8c5135f9 12/22/2011 12:53 pm Paolo Bonzini

sheepdog: move coroutine send/recv function to generic code

Outside coroutines, avoid busy waiting on EAGAIN by temporarily
making the socket blocking.

The API of qemu_recvv/qemu_sendv is slightly different from
do_readv/do_writev because they do not handle coroutines. It...

c2c9a466 12/15/2011 01:40 pm Kevin Wolf

qcow2: Allow >4 GB VM state

This is a compatible extension to the snapshot header format that allows
saving a 64 bit VM state size.

Signed-off-by: Kevin Wolf <>

16d2fc00 12/15/2011 01:40 pm Li Zhi Hui

block/cow: Return real error code

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

91977c2e 12/15/2011 01:40 pm Paolo Bonzini

block: qemu_aio_get does not return NULL

Initially done with the following semantic patch:

rule1
expression E;
statement S;
@@
E = qemu_aio_get (...);
(
- if (E == NULL) { ... } |
- if (E) { <... S ...> }
)

which however missed occurrences in linux-aio.c and posix-aio-compat.c....

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

b9c53290 12/15/2011 01:40 pm Josh Durgin

rbd: always set out parameter in qemu_rbd_snap_list

The caller expects psn_tab to be NULL when there are no snapshots or
an error occurs. This results in calling g_free on an invalid address.

Reported-by: Oliver Francke <>
Signed-off-by: Josh Durgin <>...

ad54ae80 12/15/2011 01:40 pm Paolo Bonzini

block: bdrv_aio_* do not return NULL

Initially done with the following semantic patch:

rule1
expression E;
statement S;
@@
E =
(
bdrv_aio_readv | bdrv_aio_writev | bdrv_aio_flush | bdrv_aio_discard | bdrv_aio_ioctl
)
(...);
(
- if (E == NULL) { ... }...

3a93113a 12/06/2011 11:56 am Dong Xu Wang

fix typo: delete redundant semicolon

Double semicolons should be single.

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

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

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

cow: use bdrv_co_is_allocated()

Now that bdrv_co_is_allocated() is available we can use it instead of
the synchronous bdrv_is_allocated() interface. This is a follow-up that
Kevin Wolf <> pointed out after applying the series that
introduces bdrv_co_is_allocated()....

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

qed: convert to .bdrv_co_is_allocated()

The bdrv_qed_is_allocated() function is a synchronous wrapper around
qed_find_cluster(), which performs the cluster lookup. In order to
convert the synchronous function to a coroutine function we yield
instead of using qemu_aio_wait(). Note that QED's cache is already safe...

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

73f703ca 12/05/2011 03:51 pm Stefan Hajnoczi

vvfat: convert to .bdrv_co_is_allocated()

It is trivial to switch from the synchronous .bdrv_is_allocated()
interface to .bdrv_co_is_allocated() since vvfat_is_allocated() does not
block.

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

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

vdi: convert to .bdrv_co_is_allocated()

It is trivial to switch from the synchronous .bdrv_is_allocated()
interface to .bdrv_co_is_allocated() since vdi_is_allocated() does not
block.

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

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

cow: convert to .bdrv_co_is_allocated()

The cow block driver does not keep internal state for cluster lookups.
This means it is safe to perform cluster lookups in coroutine context
without risk of race conditions that corrupt internal state.

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

d69969c4 12/05/2011 03:51 pm Kevin Wolf

qcow2: Update snapshot table information at once

Failing in the middle wouldn't help with the integrity of the image, so
doing everything in a single request seems better.

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

03343166 12/05/2011 03:51 pm Kevin Wolf

qcow2: Cleanups and memleak fix in qcow2_snapshot_create

sn->id_str could be leaked before this. The rest of this patch changes
comments, fixes coding style or removes checks that are unnecessary with
g_malloc.

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

d1ea98d5 12/05/2011 03:51 pm Kevin Wolf

qcow2: Rework qcow2_snapshot_create error handling

Increase refcounts only after allocating a new L1 table has succeeded in
order to make leaks less likely. If writing the snapshot table fails,
revert in-memory state to be consistent with that on disk.

While at it, make it return the real error codes instead of -1....

589f284b 12/05/2011 03:51 pm Kevin Wolf

qcow2: Return real error in qcow2_snapshot_goto

Besides fixing the return code, this adds some comments that make clear
how the code works and that it potentially breaks images if we fail in
the wrong place. Actually fixing this is left for the next patch....

43a0cac4 12/05/2011 03:51 pm Kevin Wolf

qcow2: Fix order of refcount updates in qcow2_snapshot_goto

The refcount updates must be moved so that in the worst case we can get
cluster leaks, but refcounts may never be too low.

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

9a476780 12/05/2011 03:51 pm Kevin Wolf

qcow2: Fix order in qcow2_snapshot_delete

First the snapshot must be deleted and only then the refcounts can be
decreased.

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

e3f652b3 12/05/2011 03:51 pm Kevin Wolf

qcow2: Fix error path in qcow2_snapshot_load_tmp

If the bdrv_read() of the snapshot's L1 table fails, return the right
error code and make sure that the old L1 table is still loaded and we
don't break the BlockDriverState completely.

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

3535a9c6 12/05/2011 03:51 pm Li Zhi Hui

block: Use bdrv functions to replace file operation in cow.c

Since common file operation functions lack of error detection,
so change them to bdrv series functions.

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

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

07fd8779 12/05/2011 03:51 pm Kevin Wolf

qcow2: Return real error code in qcow2_write_snapshots

Doesn't immediately fix anything as the callers don't use the return
value, but they will be fixed next.

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

23e9a39e 12/05/2011 03:51 pm Zhi Yong Wu

qed: adjust the way to get nb_sectors

This patch is only to refactor some lines of codes to get better and more robust codes.

As you have seen, in qed_read_table_cb() it's nice to
use qiov->size because that function doesn't obviously use a single
struct iovec....

aef4acb6 12/05/2011 03:49 pm Stefan Hajnoczi

qcow2: avoid reentrant bdrv_read() in copy_sectors()

A BlockDriverState should not issue requests on itself through the
public block layer interface. Nested, or reentrant, requests are
problematic because they do I/O throttling and request tracking twice....

1b9f1491 12/05/2011 03:49 pm Kevin Wolf

qcow2: Unlock during COW

Unlocking during COW allows for more parallelism. One change it requires is
that buffers are dynamically allocated instead of just using a per-image
buffer.

While touching the code, drop the synchronous qcow2_read() function and replace...

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

5bb1cbac 11/23/2011 06:04 pm Kevin Wolf

vpc: Add missing error handling in alloc_block

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

3397f0cb 11/23/2011 06:04 pm Kevin Wolf

vvfat: Add migration blocker

vvfat caches more or less everything when in writable mode. For migration
to work, it would have to be invalidated. Block migration for now when
in writable mode (default is readonly).

Signed-off-by: Kevin Wolf <>

6ac5f388 11/23/2011 06:04 pm Kevin Wolf

vdi: Fix memory leak

The block map is allocated in vdi_open, but was never freed.

Signed-off-by: Kevin Wolf <>

612ff3d8 11/23/2011 06:04 pm Kevin Wolf

vpc: Add migration blocker

vpc caches the BAT. For migration to work, it would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <>

2bc3166c 11/23/2011 06:04 pm Kevin Wolf

vmdk: Add migration blocker

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

Signed-off-by: Kevin Wolf <>

fc9d106c 11/23/2011 06:04 pm Kevin Wolf

vdi: Add migration blocker

vdi caches the block map. For migration to work, it would have to be
invalidated. Block migration for now.

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

c3fecea5 11/22/2011 11:33 am Dong Xu Wang

sheepdog: Avoid deadlock in error path

s->lock should be unlocked before leaving add_aio_request.

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

2923d34f 11/21/2011 11:05 pm Stefan Weil

Include zlib.h using #include <>

zlib.h is not a local include file, therefore it should be included
using <> instead of "".

Signed-off-by: Stefan Weil <>
Signed-off-by: Anthony Liguori <>

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

1ed520c6 11/21/2011 10:58 pm Anthony Liguori

qed: add migration blocker (v2)

Now when you try to migrate with qed, you get:

(qemu) migrate tcp:localhost:1025
Block format 'qed' used by device 'ide0-hd0' does not support feature 'live migration'
(qemu)

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

78439f6a 11/11/2011 03:02 pm Charles Arnold

block: Fix vpc initialization of the Dynamic Disk Header

The Data Offset field in the Dynamic Disk Header is an 8 byte field.
Although the specification (2006-10-11) gives an example of initializing
only the first 4 bytes, images generated by Microsoft on Windows initialize...

7704df98 11/11/2011 03:02 pm Kevin Wolf

vvfat: Fix read-write mode

vvfat used to directly call into the qcow2 block driver instead of using the
block.c wrappers. With the coroutine conversion, this stopped working.

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

273e4e03 11/04/2011 06:32 pm Paolo Bonzini

vvfat: reorganize computation of disk geometry

First determine FAT12/16/32, then compute geometry from that for both
FDD and HDD. For 1.44MB floppies, and 2.88MB floppies using FAT16,
change to 1 sector/cluster. The default remains 2.88MB with FAT12
and 2 sectors/cluster. Both DOS and mkdosfs by default format a 2.88MB...

d71cff42 11/04/2011 05:36 pm Paolo Bonzini

vvfat: do not hardcode sector counts in error message

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

5a742b55 11/04/2011 05:27 pm Paolo Bonzini

vvfat: unify and correct computation of sector count

The sector count is stored in the partition and hence must not include the
sectors before its start. At the same time, remove the useless special
casing for 1.44 MB floppies. This fixes fsck on VVFAT hard disks,...

aad37c06 11/04/2011 05:23 pm Paolo Bonzini

vvfat: need to use first_sectors_number to distinguish fdd/hdd

This is consistent with what "real" floppies have, so file(1)
now actually recognizes the VVFAT image as a 1.44 MB floppy.

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

e654bfe4 11/04/2011 04:55 pm Paolo Bonzini

vvfat: do not fail if the disk has spare sectors

If the number of "faked sectors" + the number of sectors that are
part of a cluster does not sum up to the total number of sectors,
qemu-img convert fails. Read these spare sectors as all zeros.

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

2b6a43a8 11/04/2011 04:42 pm Paolo Bonzini

vvfat: fix out of bounds array_get usage

When reading the address of the first free entry, you cannot
use array_get without first marking all entries as occupied.

This is visible if you change the sectors per cluster on a
floppy from 2 to 1.

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

756f51e4 11/04/2011 03:24 pm Dong Xu Wang

block/cloop: Use g_free instead of free

Fix mismatching allocation and deallocation: g_free should be used to pair with
g_malloc.

Reviewed-by: Andreas Färber <>
Reviewed_by: Ray Wang <>
Signed-off-by: Dong Xu Wang <>...

5b47b7c3 11/04/2011 03:24 pm Dong Xu Wang

block/cloop: Fix coding style

Fix coding style in block/cloop.c.

Reviewed-by: Andreas Färber <>
Reviewed_by: Ray Wang <>
Signed-off-by: Dong Xu Wang <>
Signed-off-by: Kevin Wolf <>

8494a397 10/31/2011 06:09 pm Anthony Liguori

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

Conflicts:
block/vmdk.c

3a069ff1 10/31/2011 05:23 pm Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches' into staging

c794b4e0 10/28/2011 08:25 pm Eric Sunshine

Teach block/vdi about "discarded" (no longer allocated) blocks

An entry in the VDI block map will hold an offset to the actual block if
the block is allocated, or one of two specially-interpreted values if
not allocated. Using VirtualBox terminology, value VDI_IMAGE_BLOCK_FREE...

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

bac8d7b4 10/28/2011 08:25 pm Kevin Wolf

vmdk: Fix use of uninitialised value

In error cases, cid is never set.

Signed-off-by: Kevin Wolf <>

99f1835d 10/28/2011 08:25 pm Kevin Wolf

vmdk: Improve error handling

Return the right error values in some more places.

Signed-off-by: Kevin Wolf <>

93897b9f 10/28/2011 08:25 pm Kevin Wolf

vmdk: Fix possible segfaults

Data we read from the disk isn't necessarily null terminated and may not
contain the string we're looking for. The code needs to be a bit more careful
here.

Signed-off-by: Kevin Wolf <>

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

c589b249 10/28/2011 08:25 pm Ronnie Sahlberg

iSCSI block driver

This provides built-in support for iSCSI to QEMU.

This has the advantage that the iSCSI devices need not be made visible to the host, which is useful if you have very many virtual machines and very many iscsi devices.
It also has the benefit that non-root users of QEMU can access iSCSI devices across the network without requiring root privilege on the host....

c18a1c88 10/26/2011 03:36 pm Pavel Borzenkov

vmdk: remove unneeded variable assignment

Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <>
Signed-off-by: Stefan Hajnoczi <>

8379e46d 10/26/2011 03:36 pm Pavel Borzenkov

vmdk: vmdk_read_cid returns garbage if p_name is NULL

Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <>
Signed-off-by: Stefan Hajnoczi <>

feba23b1 10/26/2011 03:36 pm Pavel Borzenkov

qed: don't pass NULL to memcpy

Spotted by Clang Analyzer

[Note this memcpy call has always been safe because the length will be 0
when the pointer is NULL]

Signed-off-by: Pavel Borzenkov <>
Signed-off-by: Stefan Hajnoczi <>

512a2cf8 10/26/2011 03:36 pm Pavel Borzenkov

qed: remove unneeded variable assignment

'ret' is unconditionally overwitten by qed_read_l1_table_sync()

Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <>
Signed-off-by: Stefan Hajnoczi <>

2914caa0 10/21/2011 06:34 pm Paolo Bonzini

block: take lock around bdrv_read implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_read implementations to take the mutex.

Drivers that implement bdrv_read rather than bdrv_co_readv can
then benefit from asynchronous operation (at least if the underlying...

e183ef75 10/21/2011 06:34 pm Paolo Bonzini

block: take lock around bdrv_write implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_write implementations to take the mutex.

Drivers that implement bdrv_write rather than bdrv_co_writev can
then benefit from asynchronous operation (at least if the underlying...

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

4265d620 10/21/2011 06:34 pm Paolo Bonzini

block: add bdrv_co_discard and bdrv_aio_discard support

This similarly adds support for coroutine and asynchronous discard.

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

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

588b65a3 10/21/2011 06:34 pm Paolo Bonzini

vmdk: fix return values of vmdk_parent_open

While vmdk_open_desc_file (touched by the patch) correctly changed -1
to -EINVAL, vmdk_open did not. Fix it directly in vmdk_parent_open.

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

bae0a0cc 10/21/2011 06:34 pm Paolo Bonzini

vmdk: clean up open

Move vmdk_parent_open to vmdk_open. There's another path how
vmdk_parent_open can be reached:

vmdk_parse_extents() ->  vmdk_open_sparse() ->  vmdk_open_vmdk4() ->
vmdk_open_desc_file().

If that can happen, however, the code is bogus. vmdk_parent_open...

848c66e8 10/21/2011 06:34 pm Paolo Bonzini

block: add a CoMutex to synchronous read drivers

The big conversion of bdrv_read/write to coroutines caused the two
homonymous callbacks in BlockDriver to become reentrant. It goes
like this:

1) bdrv_read is now called in a coroutine, and calls bdrv_read or...

d8716b41 10/21/2011 06:34 pm Paolo Bonzini

sheepdog: add coroutine_fn markers

This makes the following patch easier to review.

Cc: MORITA Kazutaka <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

2a22e6eb 10/14/2011 08:36 pm Anthony Liguori

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

1b1e8c6e 10/14/2011 06:31 pm Stefan Hajnoczi

raw-posix: remove bdrv_read()/bdrv_write()

Block drivers only need to provide one of sync, aio, or coroutine
interfaces. Since raw-posix.c provides aio interfaces, simply drop the
synchronous interfaces since they can be emulated using aio and
coroutines....

d8b7e0ad 10/14/2011 06:31 pm Stefan Hajnoczi

block: use coroutine interface for raw format

The raw format delegates all operations to bs->file (the protocol).
Previously this block driver exposed both sync and aio interfaces.
Since the block layer now works in terms of coroutines, expose the
coroutine interfaces and drop the others. This avoids unnecessary...

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

7acae208 10/14/2011 04:46 pm Dong Xu Wang

sheepdog: correct spelling

Reviewed-by: Andreas Färber <>
Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>