Statistics
| Branch: | Revision:

root / block @ a9420734

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

83e3f76c 10/13/2010 09:38 pm Blue Swirl

block: avoid a write only variable

Compiling with GCC 4.6.0 20100925 produced a warning:
/src/qemu/block/qcow2-refcount.c: In function 'update_refcount':
/src/qemu/block/qcow2-refcount.c:552:13: error: variable 'dummy' set but not used [-Werror=unused-but-set-variable]...

d523d5d6 10/03/2010 09:40 am Stefan Weil

block/vvfat: Fix compiler warning in debug code

Fix this compiler warning:
./block/vvfat.c:2285: error: comparison of unsigned expression >= 0 is always true

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

687db4ed 09/22/2010 10:46 pm Anthony Liguori

block-verify: fix 32-bit build

Reported-by: Peter Lemenkov <>
Signed-off-by: Anthony Liguori <>

d9d33417 09/21/2010 06:00 pm Stefan Hajnoczi

blkverify: Add block driver for verifying I/O

The blkverify block driver makes investigating image format data
corruption much easier. A raw image initialized with the same contents
as the test image (e.g. qcow2 file) must be provided. The raw image
mirrors read/write operations and is used to verify that data read from...

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

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

vvfat: Fix segfault on write to read-only disk

vvfat tries to set the readonly flag in its open function, but nowadays
this is overwritted with the readonly=... command line option. Check in
bdrv_write if the vvfat was opened read-only and return an error in this...

9217e26f 09/21/2010 04:39 pm Kevin Wolf

vvfat: Fix double free for opening the image rw

Allocation and deallocation of bs->opaque is not in the control of a
block driver. Therefore it should not set bs->opaque to a data structure
used by another bs, or closing the image will lead to a double free....

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

vvfat: Use cache=unsafe

The qcow file used for write support in vvfat is a temporary file,
so we can use cache=unsafe there. Without this, write support is just
too slow to be of any use.

Signed-off-by: Kevin Wolf <>

581b9e29 09/21/2010 04:39 pm Christoph Hellwig

raw-posix: handle > 512 byte alignment correctly

Replace the hardcoded handling of 512 byte alignment with bs->buffer_alignment
to handle larger sector size devices correctly.

Note that we can not rely on it to be initialize in bdrv_open, so deal
with the worst case there....

c2e2872b 09/21/2010 04:39 pm Laurent Vivier

nbd: correctly manage default port

block/nbd.c: use default port number when none is specified
qemu-nbd.c: use IANA-assigned port number: 10809

Signed-off-by: Laurent Vivier <>
Signed-off-by: Kevin Wolf <>

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

qcow2: Move sync out of write_refcount_block_entries

Signed-off-by: Kevin Wolf <>

1c4c2814 09/21/2010 04:39 pm Kevin Wolf

qcow2: Move sync out of update_refcount

Note that the flush is omitted intentionally in qcow2_free_clusters. If
anything, we can leak clusters here if we lose the writes.

Signed-off-by: Kevin Wolf <>

29216ed1 09/21/2010 04:39 pm Kevin Wolf

qcow2: Move sync out of qcow2_alloc_clusters

Signed-off-by: Kevin Wolf <>

9f8e668e 09/21/2010 04:39 pm Kevin Wolf

qcow2: Get rid of additional sync on COW

We always have a sync for the refcount update when a new cluster is
allocated. If we move this past the COW, we can save an additional sync.

Signed-off-by: Kevin Wolf <>

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

95ee3914 09/18/2010 08:53 am Blue Swirl

blkdebug: fix enum comparison

The signedness of enum types depend on the compiler implementation.
Therefore the check for negative values may or may not be meaningful.

Fix by explicitly casting to a signed integer.

Since the values are also checked earlier against event_names...

8b33d9ee 09/09/2010 01:09 am Anthony Liguori

Revert "Make default invocation of block drivers safer (v3)"

This reverts commit 79368c81bf8cf93864d7afc88b81b05d8f0a2c90.

Conflicts:

block.c

I haven't been able to come up with a solution yet for the corruption caused by
unaligned requests from the IDE disk so revert until a solution can be written....

7ec5e6a4 09/08/2010 01:39 pm Kevin Wolf

qcow2: Remove unnecessary flush after L2 write

When a new cluster was allocated, we only need a flush after the write to the
L2 table if it was a COW and we need to decrease the refcounts of the old
clusters.

Signed-off-by: Kevin Wolf <>

05acda4d 09/08/2010 01:39 pm Bernhard Kohl

raw-posix: improve detection of scsi-generic devices

Allow symbolic links which point to /dev/sgX devices.

Signed-off-by: Bernhard Kohl <>
Signed-off-by: Kevin Wolf <>

897804d6 09/08/2010 01:39 pm Kevin Wolf

raw-posix: Don't use file name for host_cdrom detection on Linux

On Linux, we have code to detect CD-ROMs using an ioctl. We shouldn't lose
anything but false positives by removing the check for a /dev/cd* path.

Signed-off-by: Kevin Wolf <>

010cb2b3 08/30/2010 07:29 pm Izumi Tsutsui

sheepdog: remove unnecessary includes

"qemu_socket.h" includes all necessary files and
including <netinet/tcp.h> without <netinet/in.h>
could cause errors on some systems.

Signed-off-by: Izumi Tsutsui <>
Signed-off-by: Kevin Wolf <>

2aa326be 08/30/2010 07:29 pm Loïc Minier

vvfat: fat_chksum(): fix access above array bounds

Signed-off-by: Loïc Minier <>
Signed-off-by: Kevin Wolf <>

1d45f8b5 08/30/2010 07:29 pm Laurent Vivier

nbd: Introduce NBD named exports.

This patch allows to connect Qemu using NBD protocol to an nbd-server
using named exports.

For instance, if on the host "isoserver", in /etc/nbd-server/config, you have:

[generic]
[debian-500-ppc-netinst]
exportname = /ISO/debian-500-powerpc-netinst.iso...

336c1c12 08/03/2010 04:57 pm Kevin Wolf

block: Fix bdrv_has_zero_init

Assuming that any image on a block device is not properly zero-initialized is
actually wrong: Only raw images have this problem. Any other image format
shouldn't care about it, they initialize everything properly themselves....

2ee9fb48 07/25/2010 05:59 pm Stefan Weil

block: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <>
Signed-off-by: Aurelien Jarno <>

79368c81 07/15/2010 04:17 pm Anthony Liguori

Make default invocation of block drivers safer (v3)

CVE-2008-2004 described a vulnerability in QEMU whereas a malicious user could
trick the block probing code into accessing arbitrary files in a guest. To
mitigate this, we added an explicit format parameter to -drive which disabling...

6defcc37 07/07/2010 08:54 pm MORITA Kazutaka

sheepdog: fix compile error on systems without TCP_CORK

WIN32 is not only the system which doesn't have TCP_CORK (e.g. OS X).

Signed-off-by: MORITA Kazutaka <>
Signed-off-by: Blue Swirl <>

33b1db1c 07/06/2010 06:05 pm MORITA Kazutaka

block: add sheepdog driver for distributed storage support

Sheepdog is a distributed storage system for QEMU. It provides highly
available block level storage volumes to VMs like Amazon EBS. This
patch adds a qemu block driver for Sheepdog.

Sheepdog features are:...

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

65d21bc7 07/06/2010 06:05 pm Markus Armbruster

raw-posix: Fix test for host CD-ROM

raw_pread_aligned() retries up to two times if the block device backs
a virtual CD-ROM (a drive with media=cdrom and if=ide, scsi, xen or
none). This makes no sense. Whether retrying reads can correct read
errors can only depend on what we're reading, not on how the result...

327cdad4 07/02/2010 02:18 pm Kevin Wolf

blkdebug: Fix set_state_opts definition

The list head was initialized to point to the wrong list, so all actions ended
up being handled as inject-error even if they were set-state in fact.

Signed-off-by: Kevin Wolf <>

698f0d52 07/02/2010 02:18 pm Kevin Wolf

blkdebug: Free QemuOpts after having read the config

Forgetting to free them means that the next instance inherits all rules and
gets its own rules only additionally.

Signed-off-by: Kevin Wolf <>

8db520ce 07/02/2010 02:18 pm Kevin Wolf

blkdebug: Initialize state as 1

state = 0 in rules means that the rule is valid for any state. Therefore it's
impossible to have a rule that works only in the initial state. This changes
the initial state from 0 to 1 to make this possible.

Signed-off-by: Kevin Wolf <>

19dbcbf7 07/02/2010 02:18 pm Kevin Wolf

qcow2: Fix error handling during metadata preallocation

People were wondering why qemu-img check failed after they tried to preallocate
a large qcow2 file and ran out of disk space.

Signed-off-by: Kevin Wolf <>

b0ad5a45 06/22/2010 03:38 pm Kevin Wolf

cow: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.
While at it, correct the wrong usage of errno.

Signed-off-by: Kevin Wolf <>

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

8b3b7206 06/22/2010 03:38 pm Kevin Wolf

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

b8852e87 06/22/2010 03:38 pm Kevin Wolf

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

078a458e 06/22/2010 03:38 pm Kevin Wolf

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

6882c8fa 06/22/2010 03:38 pm Kevin Wolf

qcow2: Fix qemu-img check segfault on corrupted images

With corrupted images, we can easily get an cluster index that exceeds the
array size of the temporary refcount table.

Signed-off-by: Kevin Wolf <>

f74550fd 06/22/2010 03:38 pm Kevin Wolf

qcow2: Don't try to check tables that couldn't be loaded

Trying to check them leads to a second error message which is more confusing
than helpful:

Can't get refcount for cluster 0: Invalid argument
ERROR cluster 0 refcount=-22 reference=1

Signed-off-by: Kevin Wolf <>

122bb9e3 06/15/2010 10:41 am Christoph Hellwig

cow: use pread/pwrite

Use pread/pwrite instead of lseek + read/write in preparation of using the
qemu block API.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

893a9cb4 06/15/2010 10:41 am Christoph Hellwig

cow: stop using mmap

We don't have an equivalent to mmap in the qemu block API, so read and
write the bitmap directly. At least in the dumb implementation added
in this patch this is a lot less efficient, but it means cow can also
work on windows, and over nbd or curl. And it fixes qemu-iotests testcase...

2063392a 06/15/2010 10:41 am Christoph Hellwig

cow: use qemu block API

Use bdrv_pwrite to access the backing device instead of pread, and
convert the driver to implementing the bdrv_open method which gives
it an already opened BlockDriverState for the underlying device.

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

6c6ea921 06/15/2010 10:41 am Kevin Wolf

vpc: Read/write multiple sectors at once

This changes the vpc block driver (for VHD) to read/write multiple sectors at
once instead of doing a request for each single sector.

Before this, running qemu-iotests for VPC took ages, now it's actually quite
reasonable to run it always (down from ~1 hour to 40 seconds for me)....

018faafd 06/15/2010 10:41 am Kevin Wolf

qcow2: Allow get_refcount to return errors

get_refcount might need to load a refcount block from disk, so errors may
happen. Return the error code instead of assuming a refcount of 1 and change
the callers to respect error return values.

Signed-off-by: Kevin Wolf <>

2eaa8f63 06/15/2010 10:41 am Kevin Wolf

qcow2: Allow alloc_clusters_noref to return errors

Currently it would consider blocks for which get_refcount fails used. However,
it's unlikely that get_refcount would succeed for the next cluster, so it's not
really helpful. Return an error instead.

Signed-off-by: Kevin Wolf <>

e14e8ba5 06/15/2010 10:41 am Kevin Wolf

qcow2: Return real error code in load_refcount_block

This fixes load_refcount_block which completely ignored the return value of
write_refcount_block and always returned -EIO for bdrv_pwrite failure.

Signed-off-by: Kevin Wolf <>

68dba0bf 06/15/2010 10:41 am Kevin Wolf

qcow2: Restore L1 entry on l2_allocate failure

If writing the L1 table to disk failed, we need to restore its old content in
memory to avoid inconsistencies.

Reported-by: Juan Quintela <>
Signed-off-by: Kevin Wolf <>

a4673e27 06/14/2010 06:33 pm Anthony Liguori

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

Conflicts:
hw/pc.c

11165820 06/13/2010 09:00 pm Paul Brook

Move stdbool.h

Move inclusion of stdbool.h to common header files, instead of including
in an ad-hoc manner.

Signed-off-by: Paul Brook <>

9040385d 06/04/2010 12:43 pm Jes Sorensen

Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512

Clean up raw-posix.c to be more consistent using BDRV_SECTOR_SIZE
instead of hard coded 512 values.

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

86fa8da8 05/28/2010 02:29 pm Kevin Wolf

qcow2: Fix corruption after error in update_refcount

After it is done with updating refcounts in the cache, update_refcount writes
all changed entries to disk. If a refcount block allocation fails, however,
there was no change yet and therefore first_index = last_index = -1. Don't...

25408c09 05/28/2010 02:29 pm Kevin Wolf

qcow2: Fix corruption after refblock allocation

Refblock allocation code needs to take into consideration that update_refcount
will load a different refcount block into the cache, so it must initialize the
cache for a new refcount block only afterwards. Not doing this means that not...

ed0df867 05/28/2010 02:29 pm Kevin Wolf

qcow2: Return right error code in write_refcount_block_entries

write_refcount_block_entries used to return -EIO for any errors. Change this to
return the real error code.

Signed-off-by: Kevin Wolf <>

55c17e98 05/28/2010 02:29 pm Kevin Wolf

qcow2: Change l2_load to return 0/-errno

Provide the error code to the caller instead of just indicating success/error.

Signed-off-by: Kevin Wolf <>

1c46efaa 05/28/2010 02:29 pm Kevin Wolf

qcow2: Allow qcow2_get_cluster_offset to return errors

qcow2_get_cluster_offset() looks up a given virtual disk offset and returns the
offset of the corresponding cluster in the image file. Errors (e.g. L2 table
can't be read) are currenctly indicated by a return value of 0, which is...

1b7c801b 05/28/2010 02:14 pm Kevin Wolf

qcow2: Clear L2 table cache after write error

If the L2 table was already updated in cache, but writing it to disk has
failed, we must not continue using the changed version in the cache to stay
consistent with what's on the disk.

Signed-off-by: Kevin Wolf <>

175e1152 05/28/2010 02:14 pm Kevin Wolf

qcow2: Fix error handling in l2_allocate

l2_allocate has some intermediate states in which the image is inconsistent.
Change the order to write to the L1 table only after the new L2 table has
successfully been initialized.

Also reset the L2 cache in failure case, it's very likely wrong....

9c678ccd 05/24/2010 06:53 pm Anthony Liguori

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

0bfcd599 05/22/2010 11:02 am Blue Swirl

Fix %lld or %llx printf format use

Signed-off-by: Blue Swirl <>

792b45b1 05/21/2010 12:49 pm Riccardo Magliocchetti

vvfat: Fix compilation with DEBUG defined

gcc does not like passing a NULL where an int value is expected:

block/vvfat.c: In function ‘checkpoint’:
block/vvfat.c:2868: error: passing argument 2 of ‘remove_mapping’ makes
integer from pointer without a cast...

3e89cb04 05/21/2010 12:49 pm Kevin Wolf

vvfat: More build fixes with DEBUG

Casting a pointer to an int doesn't work on 64 bit platforms. Use the %p printf
conversion specifier instead.

Signed-off-by: Kevin Wolf <>

7a6f3913 05/17/2010 11:20 am Christoph Hellwig

bochs: use qemu block API

Use bdrv_pwrite to access the backing device instead of pread, and
convert the driver to implementing the bdrv_open method which gives
it an already opened BlockDriverState for the underlying device.

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

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

b76b6e95 05/17/2010 11:20 am Stefan Weil

block/vdi: Allow disk images of size 0

Even it is not very useful, users may create images of size 0.

Without the special option CONFIG_ZERO_MALLOC, qemu_mallocz
aborts execution when it is told to allocate 0 bytes,
so avoid this kind of call.

Cc: Kevin Wolf <>...

9d8b88f6 05/17/2010 11:20 am Christoph Hellwig

parallels: use pread

Use pread instead of lseek + read in preparation of using the qemu
block API.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

1dec5a70 05/17/2010 11:20 am Christoph Hellwig

parallels: use qemu block API

Use bdrv_pwrite to access the backing device instead of pread, and
convert the driver to implementing the bdrv_open method which gives
it an already opened BlockDriverState for the underlying device.

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

dede4188 05/17/2010 11:20 am Stefan Weil

block/vpc: Fix conversion from size to disk geometry

The VHD algorithm calculates a disk geometry
which is usually smaller than the requested size.

QEMU tried to round up but failed for certain sizes:

qemu-img create -f vpc disk.vpc 9437184
would create an image with 9435136 bytes...

cd02a24b 05/17/2010 11:20 am Christoph Hellwig

dmg: fix reading of uncompressed chunks

When dmg_read_chunk encounters an uncompressed chunk it currently
calls read without any previous adjustment of the file postion.

This seems very wrong, and the "reference" implementation in
dmg2img does a search to the same offset as done in the various...

16cdf7ce 05/17/2010 11:20 am Christoph Hellwig

dmg: use pread

Use pread instead of lseek + read in preparation of using the qemu
block API. Note that dmg actually uses the implicit file offset
a lot in dmg_open, and we had to replace it with an offset variable.

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

64a31d5c 05/17/2010 11:20 am Christoph Hellwig

dmg: use qemu block API

Use bdrv_pwrite to access the backing device instead of pread, and
convert the driver to implementing the bdrv_open method which gives
it an already opened BlockDriverState for the underlying device.

Dmg actually does an lseek to a negative offset in the open routine,...

f21dc3a4 05/17/2010 11:20 am Stefan Weil

block/vdi: Fix image opening and creation for odd disk sizes

The fix is based on a patch from Kevin Wolf. Here his comment:

"The number of blocks needs to be rounded up to cover all of the virtual hard
disk. Without this fix, we can't even open our own images if their size is not...

c94304be 05/17/2010 11:20 am Christoph Hellwig

cloop: use pread

Use pread instead of lseek + read in preparation of using the qemu
block API.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

20be49e4 05/17/2010 11:20 am Christoph Hellwig

cloop: use qemu block API

Use bdrv_pwrite to access the backing device instead of pread, and
convert the driver to implementing the bdrv_open method which gives
it an already opened BlockDriverState for the underlying device.

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

efbca10f 05/17/2010 11:20 am Christoph Hellwig

bochs: use pread

Use pread instead of lseek + read in preparation of using the qemu
block API.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

92b30744 05/07/2010 08:11 pm Kevin Wolf

qcow2: Remove static forward declaration

OpenBSDs gcc is said to generate warnings for this declaration, so don't
reference bdrv_qcow2 directly, but look it up using bdrv_find_format.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Blue Swirl <>

de5f3f40 05/07/2010 08:11 pm Kevin Wolf

Revert "Fix OpenBSD build"

This reverts commit 20d97356c9df6d68fbd37d6334fdb7063f24eab6.
The BlockDriver definition should stay at the end of source files.

Conflicts:

block/qcow2.c

Signed-off-by: Kevin Wolf <>
Signed-off-by: Blue Swirl <>

003fad6e 05/03/2010 11:07 am Kevin Wolf

qcow2: Remove abort on free_clusters failure

While it's true that during regular operation free_clusters failure would be a
bug, an I/O error can always happen. There's no need to kill the VM, the worst
thing that can happen (and it will) is that we leak some clusters....

419b19d9 05/03/2010 11:07 am Stefan Hajnoczi

qcow2: Implement bdrv_truncate() for growing images

This patch adds the ability to grow qcow2 images in-place using
bdrv_truncate(). This enables qemu-img resize command support for
qcow2.

Snapshots are not supported and bdrv_truncate() will return -ENOTSUP....

c336500d 05/03/2010 11:07 am Kevin Wolf

vmdk: Fix COW

When trying to do COW, VMDK wrote the data back to the backing file. This
problem was revealed by the patch that made backing files read-only. This patch
does not only fix the problem, but also simplifies the VMDK code a bit.

This fixes the backing file qemu-iotests cases for VMDK....

9949f97e 05/03/2010 11:07 am Kevin Wolf

vmdk: Clean up backing file handling

VMDK is doing interesting things when it needs to open a backing file. This
patch changes that part to look more like in other drivers. The nice side
effect is that the file name isn't needed any more in the open function....

6511ef77 05/03/2010 11:07 am Kevin Wolf

vmdk: Convert to bdrv_open

It's a format driver, so implement bdrv_open instead of bdrv_file_open.

Signed-off-by: Kevin Wolf <>

508e0893 05/03/2010 11:07 am Stefan Hajnoczi

qcow2: Avoid shadowing variable in alloc_clusters_noref()

The i loop iterator is shadowed by the next free cluster index. Both
using the variable name 'i' makes the code harder to read.

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

4899d10d 05/03/2010 11:07 am Stefan Hajnoczi

raw-posix: Use pread/pwrite instead of lseek+read/write

This patch combines the lseek+read/write calls to use pread/pwrite
instead. This will result in fewer system calls and is already used by
AIO.

Thanks to Jan Kiszka <> for identifying excessive...

84a12e66 05/03/2010 11:07 am Christoph Hellwig

block: separate raw images from the file protocol

We're running into various problems because the "raw" file access, which
is used internally by the various image formats is entangled with the
"raw" image format, which maps the VM view 1:1 to a file system....

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

88bf7950 04/25/2010 06:27 pm Blue Swirl

Fix dead initialization, spotted by clang analyzer

Fix clang warnings:
/src/qemu/block/vvfat.c:1102:9: warning: Value stored to 'index3' during its initialization is never read
int index3=index1+1;
/src/qemu/cmd.c:290:15: warning: Value stored to 'p' during its initialization is never read...

20d97356 04/23/2010 11:19 pm Blue Swirl

Fix OpenBSD build

GCC 3.3.5 generates warnings for static forward declarations of data, so
rearrange code to use static forward declarations of functions instead.

Signed-off-by: Blue Swirl <>

d4c146f0 04/23/2010 05:21 pm Stefan Hajnoczi

qcow2: Use QLIST_FOREACH_SAFE macro

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

8252278a 04/23/2010 05:08 pm Kevin Wolf

qcow2: Trigger blkdebug events

This adds blkdebug events to qcow2 to allow injecting I/O errors in specific
places.

Signed-off-by: Kevin Wolf <>

4768fa90 04/23/2010 05:08 pm Kevin Wolf

qcow2: Fix creation of large images

qcow_create2 assumes that the new image will only need one cluster for its
refcount table initially. Obviously that's not true any more when the image is
big enough (exact value depends on the cluster size).

This patch calculates the refcount table size dynamically....

d6e9098e 04/23/2010 05:08 pm Kevin Wolf

Replace calls of old bdrv_open

What is known today as bdrv_open2 becomes the new bdrv_open. All remaining
callers of the old function are converted to the new one. In some places they
even know the right format, so they should have used bdrv_open2 from the...

50779cc2 04/23/2010 05:08 pm Christoph Hellwig

block: split raw_getlength

Split up the raw_getlength into separate generic, solaris and BSD
versions to reduce the ifdef maze a bit. The BSD variant still
is a complete maze, but to clean it up properly we'd need some
people using the BSD variants to figure out what code is used...

79a31189 04/23/2010 05:08 pm Kevin Wolf

qcow2: Return 0/-errno in write_l2_entries

Change write_l2_entries to return the real error code instead of -1.

Signed-off-by: Kevin Wolf <>

c835d00f 04/23/2010 05:08 pm Kevin Wolf

qcow2: Fix error return code in qcow2_alloc_cluster_link_l2

Fix qcow2_alloc_cluster_link_l2 to return the real error code like it does in
all other error cases.

Signed-off-by: Kevin Wolf <>

f7defcb6 04/23/2010 05:08 pm Kevin Wolf

qcow2: Return 0/-errno in write_l1_entry

Change write_l1_entry to return the real error code instead of -1.

Signed-off-by: Kevin Wolf <>

c46e1167 04/23/2010 05:08 pm Kevin Wolf

qcow2: Return 0/-errno in l2_allocate

Returning NULL on error doesn't allow distinguishing between different errors.
Change the interface to return an integer for -errno.

Signed-off-by: Kevin Wolf <>