Statistics
| Branch: | Revision:

root / block @ 31ca6d07

# Date Author Comment
31ca6d07 04/22/2013 11:27 am Kevin Wolf

block: Add driver-specific options for backing files

Options starting in "backing." are passed to the backing file now. If
you don't need to specify the filename for the backing file, you can add
it on the command line instead of in the image file:

$ qemu-nbd -t /tmp/test.img...

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

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

c7a101f5 04/19/2013 12:45 pm Richard W.M. Jones

ssh: Remove unnecessary use of strlen function.

Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Weil <>

Signed-off-by: Stefan Hajnoczi <>

6ae7d660 04/19/2013 12:44 pm Stefan Weil

block/ssh: Add missing gcc format attributes

Now gcc will check whether format string and variable arguments match.

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

0a12ec87 04/15/2013 11:18 am Richard W.M. Jones

block: Add support for Secure Shell (ssh) block device.

qemu-system-x86_64 -drive file=ssh://hostname/some/image

QEMU will ssh into 'hostname' and open '/some/image' which is made
available as a standard block device.

You can specify a username (ssh://user@host/...) and/or a port number...

9a2d462e 04/15/2013 11:18 am Richard W.M. Jones

block: ssh: Use libssh2_sftp_fsync (if supported by libssh2) to flush to disk.

libssh2_sftp_fsync is an extension to libssh2 to support fsync(2) over
sftp, which is itself an extension of OpenSSH.

If both libssh2 and the ssh daemon support it, this will allow...

dc7588c1 04/15/2013 11:18 am Josh Durgin

rbd: add an asynchronous flush

The existing bdrv_co_flush_to_disk implementation uses rbd_flush(),
which is sychronous and causes the main qemu thread to block until it
is complete. This results in unresponsiveness and extra latency for
the guest.

Fix this by using an asynchronous version of flush. This was added to...

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

0d09e41a 04/08/2013 07:13 pm Paolo Bonzini

hw: move headers to include/

Many of these should be cleaned up with proper qdev-/QOM-ification.
Right now there are many catch-all headers in include/hw/ARCH depending
on cpu.h, and this makes it necessary to compile these files per-target.
However, fixing this does not belong in these patches....

c2bc78b6 04/05/2013 07:58 pm Kevin Wolf

qcow2: Return real error in qcow2_update_snapshot_refcount

This fixes the error message triggered by the following script:

cat > /tmp/blkdebug.cfg <&lt;EOF
[inject-error]
event = "cluster_free"
errno = "28"
immediately = "off"
EOF
$qemu_img create -f qcow2 test.qcow2 10G...
c2b6ff51 04/05/2013 07:58 pm Kevin Wolf

qcow2: Fix L1 write error handling in qcow2_update_snapshot_refcount

It ignored the error code, and at least the 'goto fail' is obvious
nonsense as it creates an endless loop (if the next attempt doesn't
magically succeed) and leaves the in-memory L1 table in big-endian...

f9e8cacc 04/02/2013 06:47 pm Stefan Hajnoczi

oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()

The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.
Rename to qemu_set_nonblock() just like qemu_set_cloexec().

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

710c2496 03/28/2013 12:52 pm Kevin Wolf

qcow2: Use byte granularity in qcow2_alloc_cluster_offset()

This gets rid of the nb_clusters and keep_clusters and the associated
complicated calculations. Just advance the number of bytes that have
been processed and everything is fine.

This patch advances the variables even after the last operation even...

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

2c3b32d2 03/28/2013 12:52 pm Kevin Wolf

qcow2: Move cluster gathering to a non-looping loop

This patch is mainly to separate the indentation change from the
semantic changes. All that really changes here is that everything moves
into a while loop, all 'goto done' become 'break' and at the end of the...

ecdd5333 03/28/2013 12:52 pm Kevin Wolf

qcow2: Gather clusters in a looping loop

Instead of just checking once in exactly this order if there are
dependendies, non-COW clusters and new allocation, this starts looping
around these. This way we can, for example, gather non-COW clusters after
new allocations as long as the host cluster offsets stay contiguous....

d9d74f41 03/28/2013 12:52 pm Kevin Wolf

qcow2: Improve check for overlapping allocations

The old code detected an overlapping allocation even when the
allocations didn't actually overlap, but were only adjacent.

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

65eb2e35 03/28/2013 12:52 pm Kevin Wolf

qcow2: Change handle_dependency to byte granularity

This is a more precise description of what really constitutes a
dependency. The behaviour doesn't change at this point because the COW
area of the old request is still aligned to cluster boundaries and
therefore an overlap is detected wheneven the requests touch any part of...

037689d8 03/28/2013 12:52 pm Kevin Wolf

qcow2: Decouple cluster allocation from cluster reuse code

This moves some code that prepares the allocation of new clusters to
where the actual allocation happens. This is the minimum required to be
able to move it to a separate function in the next patch....

10f0ed8b 03/28/2013 12:52 pm Kevin Wolf

qcow2: Factor out handle_alloc()

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

f5bc6350 03/28/2013 12:52 pm Kevin Wolf

qcow2: handle_alloc(): Get rid of nb_clusters parameter

We already communicate the same information in *bytes.

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

3b8e2e26 03/28/2013 12:52 pm Kevin Wolf

qcow2: handle_alloc(): Get rid of keep_clusters parameter

handle_alloc() is now called with the offset at which the actual new
allocation starts instead of the offset at which the whole write request
starts, part of which may already be processed.

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

c37f4cd7 03/28/2013 12:52 pm Kevin Wolf

qcow2: Finalise interface of handle_alloc()

The interface works completely on a byte granularity now and duplicated
parameters are removed.

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

83baa9a4 03/28/2013 12:52 pm Kevin Wolf

qcow2: Clean up handle_alloc()

Things can be simplified a bit now. No semantic changes.

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

0af729ec 03/28/2013 12:52 pm Kevin Wolf

qcow2: Factor out handle_copied()

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

acb0467f 03/28/2013 12:52 pm Kevin Wolf

qcow2: handle_copied(): Get rid of nb_clusters parameter

handle_copied() uses its bytes parameter now to determine how many
clusters it should try to find.

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

c53ede9f 03/28/2013 12:52 pm Kevin Wolf

qcow2: handle_copied(): Get rid of keep_clusters parameter

Now *bytes is used to return the length of the area that can be written
to without performing an allocation or COW.

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

e62daaf6 03/28/2013 12:52 pm Kevin Wolf

qcow2: handle_copied(): Implement non-zero host_offset

Look only for clusters that start at a given physical offset.

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

411d62b0 03/28/2013 12:52 pm Kevin Wolf

qcow2: Prepare handle_alloc/copied() for byte granularity

This makes handle_alloc() and handle_copied() return byte-granularity
host offsets instead of returning always the cluster start. This is
required so that qcow2_alloc_cluster_offset() can stop aligning...

c349ca4b 03/28/2013 12:52 pm Kevin Wolf

qcow2: Fix "total clusters" number in bdrv_check

This should be based on the virtual disk size, not on the size of the
image.

Interesting observation: With some VM state stored in the image file,
percentages higher than 100% are possible, even though snapshots...

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

17a71e58 03/28/2013 12:52 pm Kevin Wolf

qcow2: Handle dependencies earlier

Handling overlapping allocations isn't just a detail of cluster
allocation. It is rather one of three ways to get the host cluster
offset for a write request:

1. If a request overlaps an in-flight allocations, the cluster offset...

ea804cad 03/25/2013 10:53 am Stefan Weil

block: Add options QDict to bdrv_file_open() prototypes (fix MinGW build)

The new parameter is unused yet.

This part was missing in commit 787e4a8500020695eb391e2f1cc4767ee071d441.

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

d43731c7 03/25/2013 10:51 am Liu Yuan

rbd: fix compile error

Commit 787e4a85 [block: Add options QDict to bdrv_file_open() prototypes] didn't
update rbd.c accordingly.

Cc: Kevin Wolf <>
Cc: Stefan Hajnoczi <>
Signed-off-by: Liu Yuan <>
Reviewed-by: Stefan Weil <>...

f53a1feb 03/22/2013 06:51 pm Kevin Wolf

nbd: Accept -drive options for the network connection

The existing parsers for the file name now parse everything into the
bdrv_open() options QDict. Instead of using these parsers, you can now
directly specify the options on the command line, like this:...

6963a30d 03/22/2013 06:51 pm Kevin Wolf

block: Introduce .bdrv_parse_filename callback

If a driver needs structured data and not just a string, it can provide
a .bdrv_parse_filename callback now that parses the command line string
into separate options. Keeping this separate from .bdrv_open_filename...

f5866fa4 03/22/2013 06:51 pm Kevin Wolf

block: Make find_image_format safe with NULL filename

In order to achieve this, the .bdrv_probe callbacks of all drivers must
cope with this. The DMG driver is the only one that bases its decision
on the filename and it needs to be changed.

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

bebbf7fa 03/22/2013 06:51 pm Kevin Wolf

nbd: Use default port if only host is specified

The URL method already takes care to apply the default port when none is
specfied. Directly specifying driver-specific options required the port
number until now. Allow leaving it out and apply the default....

681e7ad0 03/22/2013 06:51 pm Kevin Wolf

nbd: Check against invalid option combinations

A file name may only specified if no host or socket path is specified.
The latter two may not appear at the same time either.

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

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

f17c90be 03/22/2013 06:51 pm Kevin Wolf

nbd: Keep hostname and port separate

The NBD block supports an URL syntax, for which a URL parser returns
separate hostname and port fields. It also supports the traditional qemu
syntax encoded in a filename. Until now, after parsing the URL to get
each piece of information, a new string is built to be fed to socket...

fca23f0a 03/19/2013 12:48 pm Liu Yuan

sheepdog: show error message for halt status

Sheepdog (neither quorum nor unsafe mode) will refuse to serve IO requests when
number of alive nodes is less than that of copies specified by users. This will
return 0x19 to QEMU client which currently doesn't recognize it....

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

c4d9d196 03/15/2013 05:07 pm Stefan Hajnoczi

threadpool: drop global thread pool

Now that each AioContext has a ThreadPool and the main loop AioContext
can be fetched with bdrv_get_aio_context(), we can eliminate the concept
of a global thread pool from thread-pool.c.

The submit functions must take a ThreadPool* argument....

f6977f15 03/15/2013 05:07 pm Stefan Hajnoczi

qcow2: flush refcount cache correctly in qcow2_write_snapshots()

Since qcow2 metadata is cached we need to flush the caches, not just the
underlying file. Use bdrv_flush(bs) instead of bdrv_flush(bs->file).

Also add the error return path when bdrv_flush() fails and move the...

c1f5bafd 03/15/2013 05:07 pm Stefan Hajnoczi

qcow2: set L2 cache dependency in qcow2_alloc_bytes()

Compressed writes use qcow2_alloc_bytes() to allocate space with byte
granularity. The affected clusters' refcounts will be incremented but
we do not need to flush yet.

Set a L2 cache dependency on the refcount block cache, so that the...

2154f24e 03/15/2013 05:07 pm Stefan Hajnoczi

qcow2: flush in qcow2_update_snapshot_refcount()

Users of qcow2_update_snapshot_refcount() do not flush consistently.
qcow2_snapshot_create() flushes but qcow2_snapshot_goto() and
qcow2_snapshot_delete() do not.

Solve this by moving the bdrv_flush() into...

f9cb2860 03/15/2013 05:07 pm Stefan Hajnoczi

qcow2: drop flush in update_cluster_refcount()

The update_cluster_refcount() function increments/decrements a cluster's
refcount and then returns the new refcount value.

There is no need to flush since both update_cluster_refcount() callers
already take care of this:...

36479179 03/15/2013 05:07 pm Stefan Hajnoczi

qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount()

We already flush when the function completes. There is no need to flush
after every compressed cluster.

Signed-off-by: Stefan Hajnoczi <>
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...

0d6db300 03/15/2013 05:07 pm MORITA Kazutaka

sheepdog: use non-blocking fd in coroutine context

Using a blocking socket in the coroutine context reduces the chance of
switching to other work. This patch makes the sheepdog driver use a
non-blocking fd always.

Signed-off-by: MORITA Kazutaka <>...

ed9ba724 03/15/2013 05:07 pm MORITA Kazutaka

sheepdog: set io_flush handler in do_co_req

If an io_flush handler is not set, qemu_aio_wait doesn't invoke
callbacks.

Signed-off-by: MORITA Kazutaka <>
Signed-off-by: Stefan Hajnoczi <>

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

9991923b 03/15/2013 05:07 pm Stefan Hajnoczi

qcow2: flush refcount cache correctly in alloc_refcount_block()

update_refcount() affects the refcount cache, it does not write to disk.
Therefore bdrv_flush(bs->file) does nothing. We need to flush the
refcount cache in order to write out the refcount updates!...

cb1b83e7 03/05/2013 06:51 pm Peter Lieven

iscsi: add iscsi_truncate support

this patch adds iscsi_truncate which effectively allows for
online resizing of iscsi volumes. for this to work you have
to resize the volume on your storage and then call
block_resize command in qemu which will issue a
readcapacity16 to update the capacity....

1dde716e 03/05/2013 06:51 pm Peter Lieven

iscsi: retry read, write, flush and unmap on unit attention check conditions

the storage might return a check condition status for various reasons.
(e.g. bus reset, capacity change, thin-provisioning info etc.)

currently all these informative status responses lead to an I/O error...

bf1c852a 03/04/2013 10:54 am MORITA Kazutaka

move socket_set_nodelay to osdep.c

Signed-off-by: MORITA Kazutaka <>
Signed-off-by: Stefan Hajnoczi <>

5d6768e3 03/04/2013 10:54 am MORITA Kazutaka

sheepdog: accept URIs

The URI syntax is consistent with the NBD and Gluster syntax. The
syntax is

sheepdog[+tcp]://[host:port]/vdiname[#snapid|#tag]

Signed-off-by: MORITA Kazutaka <>
Signed-off-by: Stefan Hajnoczi <>

25af257d 03/04/2013 10:54 am MORITA Kazutaka

sheepdog: use inet_connect to simplify connect code

This uses the form "<host>:<port>" for the representation of the
sheepdog server to use inet_connect.

Signed-off-by: MORITA Kazutaka <>
Signed-off-by: Stefan Hajnoczi <>

1b8bbb46 03/04/2013 10:54 am MORITA Kazutaka

sheepdog: add support for connecting to unix domain socket

This patch adds support for a unix domain socket for a connection
between qemu and local sheepdog server. You can use the unix domain
socket with the following syntax:

$ qemu sheepdog+unix:///&lt;vdiname&gt;?socket=&lt;socket path&gt;[#snapid]...
801f7044 02/22/2013 10:21 pm Stefan Hajnoczi

qcow2: introduce check_refcounts_l1/l2() flags

The check_refcounts_l1/l2() functions have a check_copied argument to
check that the QCOW_O_COPIED flag is consistent with refcount == 1.
This should be a bool, not an int.

However, the next patch introduces qcow2 fragmentation statistics and...

fba31bae 02/22/2013 10:21 pm Stefan Hajnoczi

qcow2: record fragmentation statistics during check

The qemu-img check command can display fragmentation statistics: * Total number of clusters in virtual disk * Number of allocated clusters * Number of fragmented clusters

This patch adds fragmentation statistics support to qcow2....

4db35162 02/22/2013 10:21 pm Stefan Hajnoczi

qcow2: support compressed clusters in BlockFragInfo

Signed-off-by: Stefan Hajnoczi <>

c6bb9ad1 02/22/2013 10:21 pm Federico Simoncelli

qemu-img: find the image end offset during check

This patch adds the support for reporting the image end offset (in
bytes). This is particularly useful after a conversion (or a rebase)
where the destination is a block device in order to find the first
unused byte at the end of the image....

8a8f5840 02/13/2013 07:57 pm Stefan Hajnoczi

block/curl: only restrict protocols with libcurl>=7.19.4

The curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, ...) interface was
introduced in libcurl 7.19.4. Therefore we cannot protect against
CVE-2013-0249 when linking against an older libcurl.

This fixes the build failure introduced by...

33ccf667 02/12/2013 01:25 pm Stefan Hajnoczi

Revert "block/vpc: Fix size calculation"

This reverts commit f880defbb06708d30a38ce9f2667067626acdd38.

Jeff Cody's testing revealed that the interpretation of size differs
even between VirtualPC and HyperV. Revert this so there is time to
consider the impact of any backwards incompatible behavior this change...

da888d37 02/12/2013 01:22 pm Stefan Hajnoczi

block/raw-posix: detect readonly Linux block devices using BLKROGET

Linux block devices can be set read-only with "blockdev --setro
<device>". The same thing can be done for LVM volumes using "lvchange
--permission r <volume>". This read-only setting is independent of...

f880defb 02/11/2013 04:14 pm Stefan Weil

block/vpc: Fix size calculation

The size calculated from the CHS values is not the real image (disk) size,
but usually a smaller value. This is caused by rounding effects.

Only older operating systems use CHS. Such guests won't be able to use
the whole disk. All modern operating systems use the real size....

312fd5f2 02/11/2013 04:13 pm Markus Armbruster

error: Strip trailing '\n' from error string arguments (again)

Commit 6daf194d and be62a2eb got rid of a bunch, but they keep coming
back. Tracked down with this Coccinelle semantic patch:

r
expression err, eno, cls, fmt;
position p;
@@
(...
fb6d1bbd 02/08/2013 07:14 pm Stefan Hajnoczi

block/curl: disable extra protocols to prevent CVE-2013-0249

There is a buffer overflow in libcurl POP3/SMTP/IMAP. The workaround is
simple: disable extra protocols so that they cannot be exploited. Full
details here:

http://curl.haxx.se/docs/adv_20130206.html...
fdf263f6 02/01/2013 04:11 pm Andreas Färber

block/raw-posix: Build fix for O_ASYNC

Commit eeb6b45d48800e96f67ef2a5c80332557fd45ddb (block: raw-posix image
file reopen) broke the build on OpenIndiana.

illumos has no O_ASYNC. Exclude it from flags to be compared
and instead assert that it is not set where defined....

69d34a36 02/01/2013 03:58 pm Kevin Wolf

dmg: Fix bdrv_open() error handling

Return -errno instead of -1 on errors and add error checks in some
places that didn't have one. Passing things by reference requires more
correct typing, replaced a few off_ts therefore - with a 32-bit off_t
this is even a fix for truncation bugs....

4f8aa2e1 02/01/2013 03:58 pm Kevin Wolf

dmg: Use g_free instead of free

The buffers are allocated with g_(re)alloc, so use g_free to free them.

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

46536235 02/01/2013 03:58 pm Kevin Wolf

parallels: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. Hey, no memory leak to fix here
while we're touching it!

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

cd923475 02/01/2013 03:58 pm Philipp Hahn

vmdk: Allow space in file name

The previous scanf() format string stopped parsing the file name on the
first white white space, which seems to be allowed at least by VMware
Workstation.

Change the format string to collect everything between the first and...

7f2039f6 02/01/2013 03:58 pm Othmar Pasteka

vmdk: Allow selecting SCSI adapter in image creation

Introduce a new option "adapter_type" when converting to vmdk images.
It can be one of the following: ide (default), buslogic, lsilogic
or legacyESX (according to the vmdk spec from vmware).

In case of a non-ide adapter, heads is set to 255 instead of the 16....

6f74c260 02/01/2013 03:58 pm Liu Yuan

sheepdog: pass vdi_id to sheep daemon for sd_close()

Sheep daemon needs vdi_id to identify which vdi is closed to release resources
such as object cache.

Cc: MORITA Kazutaka <>
Cc: Kevin Wolf <>
Cc: Stefan Hajnoczi <>...

5b7d7dfd 02/01/2013 03:58 pm Kevin Wolf

bochs: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. While touching the
code, fix a memory leak.

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

1a60657f 02/01/2013 03:58 pm Kevin Wolf

cloop: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. While touching the
code, fix a memory leak.

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

59294e46 02/01/2013 03:58 pm Kevin Wolf

vpc: Fix bdrv_open() error handling

Return -errno instead of -1 on errors. While touching the
code, fix a memory leak.

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

6528499f 01/30/2013 12:14 pm Markus Armbruster

g_malloc(0) and g_malloc0(0) return NULL; simplify

Once upon a time, it was decided that qemu_malloc(0) should abort.
Switching to glib retired that bright idea. Some code that was added
to cope with it (e.g. in commits 702ef63, b76b6e9) is still around....

402a4741 01/25/2013 07:18 pm Paolo Bonzini

mirror: support more than one in-flight AIO operation

With AIO support in place, we can start copying more than one chunk
in parallel. This patch introduces the required infrastructure for
this: the buffer is split into multiple granularity-sized chunks,...

884fea4e 01/25/2013 07:18 pm Paolo Bonzini

mirror: support arbitrarily-sized iterations

Yet another optimization is to extend the mirroring iteration to include more
adjacent dirty blocks. This limits the number of I/O operations and makes
mirroring efficient even with a small granularity. Most of the infrastructure...

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

9f0470bb 01/25/2013 07:18 pm Stefan Weil

block/vdi: Improve debug output for signature

The signature is a 32 bit value and needs up to 8 hex digits for printing.

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

8937f822 01/25/2013 07:18 pm Stefan Weil

block/vdi: Improved return values from vdi_open

vdi_open returned -1 in case of any error, but it should return an
error code (negative value of errno or -EMEDIUMTYPE).

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

0e87ba2c 01/25/2013 07:18 pm Stefan Weil

block/vdi: Check for bad signature

vdi_open did not check for a bad signature.
This check was only in vdi_probe.

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

88ff0e48 01/25/2013 07:18 pm Paolo Bonzini

mirror: do nothing on zero-sized disk

On a zero-sized disk we need to break out of the job successfully
before bdrv_dirty_iter_init is called, otherwise you will get an
assertion failure with the next patch.

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

50717e94 01/25/2013 07:18 pm Paolo Bonzini

block: allow customizing the granularity of the dirty bitmap

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

eee13dfe 01/25/2013 07:18 pm Paolo Bonzini

mirror: allow customizing the granularity

The desired granularity may be very different depending on the kind of
operation (e.g. continuous replication vs. collapse-to-raw) and whether
the VM is expected to perform lots of I/O while mirroring is in progress....

bd48bde8 01/25/2013 07:18 pm Paolo Bonzini

mirror: switch mirror_iteration to AIO

There is really no change in the behavior of the job here, since
there is still a maximum of one in-flight I/O operation between
the source and the target. However, this patch already introduces
the AIO callbacks (which are unmodified in the next patch)...

08e4ed6c 01/25/2013 07:18 pm Paolo Bonzini

mirror: add buf-size argument to drive-mirror

This makes sense when the next commit starts using the extra buffer space
to perform many I/O operations asynchronously.

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

8f0720ec 01/25/2013 07:18 pm Paolo Bonzini

block: implement dirty bitmap using HBitmap

This actually uses the dirty bitmap in the block layer, and converts
mirroring to use an HBitmapIter.

Reviewed-by: Laszlo Ersek <> (except block/mirror.c parts)
Reviewed-by: Eric Blake <>...

b812f671 01/25/2013 07:18 pm Paolo Bonzini

mirror: perform COW if the cluster size is bigger than the granularity

When mirroring runs, the backing files for the target may not yet be
ready. However, this means that a copy-on-write operation on the target
would fill the missing sectors with zeros. Copy-on-write only happens...

acc906c6 01/25/2013 07:18 pm Paolo Bonzini

block: return count of dirty sectors, not chunks

Reviewed-by: Laszlo Ersek <>
Reviewed-by: Eric Blake <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>