| Branch: | Revision:

root / block.c @ a74cdab4

History | View | Annotate | Download (81 kB)

# Date Author Comment
8d278467 05/19/2011 11:26 am Markus Armbruster

block: Remove type hint, it's guest matter, doesn't belong here

No users of bdrv_get_type_hint() left. bdrv_set_type_hint() can make
the media removable by side effect. Make that explicit.

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

d8aeeb31 05/19/2011 11:26 am Markus Armbruster

block QMP: Deprecate query-block's "type", drop info block's "type="

query-block's specification documents response member "type" with
values "hd", "cdrom", "floppy", "unknown".

Its value is unreliable: a block device used as floppy has type
"floppy" if created with if=floppy, but type "hd" if created with...

a1c7273b 05/08/2011 12:02 pm Stefan Weil

Fix typos in comments and code (occured -> occurred and related)

The code changed here is an unused data type name (evt_flush_occurred).

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

ebabb67a 05/06/2011 10:19 am Stefan Weil

Fix typo in code and comments

Replace writeable -> writable

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

d22b2f41 04/07/2011 02:51 pm Ryan Harper

Do not delete BlockDriverState when deleting the drive

When removing a drive from the host-side via drive_del we currently have
the following path:

bdrv_close() // zaps bs->drv, which makes any subsequent I/O get
// dropped. Works as designed...

b8c6d095 04/07/2011 02:51 pm Stefan Hajnoczi

trace: Trace bdrv_set_locked()

It can be handy to know when the guest locks/unlocks the CD-ROM tray.
This trace event makes that possible.

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

46a4e4e6 04/07/2011 02:51 pm Stefan Hajnoczi

block: Do not cache device size for removable media

The block layer caches the device size to avoid doing lseek(fd, 0,
SEEK_END) every time this value is needed. For removable media the
device size becomes stale if a new medium is inserted. This patch
simply prevents device size caching for removable media....

301db7c2 03/15/2011 02:21 pm Ryan Harper

Don't allow multiwrites against a block device without underlying medium

If the block device has been closed, we no longer have a medium to submit
IO against, check for this before submitting io. This prevents a segfault
further in the code where we dereference elements of the block driver....

a13aac04 03/07/2011 05:34 pm Stefan Hajnoczi

trace: Trace bdrv_aio_flush()

Add a trace event for bdrv_aio_flush() to complement the existing
bdrv_aio_readv() and bdrv_aio_writev() events.

Signed-off-by: Stefan Hajnoczi <>

5bbdbb46 02/20/2011 11:33 am Blue Swirl

fdc: move floppy geometry guessing to block.c

Other geometry guessing functions already reside in block.c.

Remove some unused or debugging only fields.

Signed-off-by: Blue Swirl <>

db593f25 02/07/2011 01:51 pm Marcelo Tosatti

Add flag to indicate external users to block device

Certain operations such as drive_del or resize cannot be performed
while external users (eg. block migration) reference the block device.

Add a flag to indicate that.

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

8591675f 02/07/2011 01:51 pm Marcelo Tosatti

block: enable in_use flag

Set block device in use during block migration, disallow drive_del and
bdrv_truncate for in use devices.

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Kevin Wolf <>

db97ee6a 01/31/2011 11:03 am Christoph Hellwig

block: tell drivers about an image resize

Extend the change_cb callback with a reason argument, and use it
to tell drivers about size changes.

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

96df67d1 01/24/2011 05:49 pm Stefan Hajnoczi

block: Use backing format driver during image creation

The backing format should be honored during image creation. For some
reason we currently use the image format to open the backing file. This
fails when the backing file has a different format than the image being...

71df0eeb 01/06/2011 08:25 pm Blue Swirl

block: delete a write-only variable

Avoid a warning with GCC 4.6.0:
/src/qemu/block.c: In function 'bdrv_img_create':
/src/qemu/block.c:2862:25: error: variable 'fmt' set but not used [-Werror=unused-but-set-variable]

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

f88e1a42 12/17/2010 05:11 pm Jes Sorensen

qemu-img.c: Re-factor img_create()

This patch re-factors img_create() moving the code doing the actual
work into block.c where it can be shared with QEMU. This is needed to
be able to create images from QEMU to be used for live snapshots.

Signed-off-by: Jes Sorensen <>...

792da93a 12/17/2010 05:11 pm Jes Sorensen

Prevent creating an image with the same filename as backing file

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

4f70f249 12/17/2010 05:11 pm Jes Sorensen

bdrv_img_create() use proper errno return values

Kevin suggested to have bdrv_img_create() return proper -errno values
on error.

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

bb8bf76f 12/17/2010 05:11 pm Christoph Hellwig

block: add discard support

Add a new bdrv_discard method to free blocks in a mapping image, and a new
drive property to set the granularity for these discard. If no discard
granularity support is set discard support is disabled.

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

9e0b22f4 12/17/2010 05:10 pm Stefan Hajnoczi

block: Introduce path_has_protocol() function

The bdrv_find_protocol() function returns NULL if an unknown protocol
name is given. It returns the "file" protocol when the filename
contains no protocol at all. This makes it difficult to distinguish
between paths which contain a protocol and those which do not....

df2dbb4a 12/17/2010 05:10 pm Stefan Hajnoczi

block: Fix the use of protocols in backing files

Backing filenames may contain a protocol. The code currently doesn't
consider this case and produces filenames that embed "<protocol>:".
Don't combine filenames if the backing filename contains a protocol....

16905d71 12/14/2010 04:44 pm Stefan Hajnoczi

block: Make bdrv_create_file() ':' handling consistent

Filenames may start with "<protocol>:" to explicitly use a protocol like
nbd. Filenames with unknown protocols are rejected in most of QEMU
except for bdrv_create_file(). Even if a file with an invalid filename...

6d59fec1 11/21/2010 05:16 pm Marcelo Tosatti

block: fix shift in dirty bitmap calculation

Otherwise upper 32 bits of bitmap entries are not correctly calculated.

Reviewed-by: Kevin Wolf <>
Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Anthony Liguori <>

4dcafbb1 11/21/2010 05:16 pm Marcelo Tosatti

block: set sector dirty on AIO write completion

Sectors are marked dirty in the bitmap on AIO submission. This is wrong
since data has not reached storage.

Set a given sector as dirty in the dirty bitmap on AIO completion, so that
reading a sector marked as dirty is guaranteed to return uptodate data....

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

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

Copy snapshots out of QCOW2 disk

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

bbf0a440 10/09/2010 11:17 am Stefan Hajnoczi

trace: Trace bdrv_aio_{readv,writev}

Observing block layer aio readv/writev operations is useful for
debugging image formats or understanding guest disk I/O patterns.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Blue Swirl <>

6d519a5f 09/10/2010 12:22 am Stefan Hajnoczi

trace: Trace virtio-blk, multiwrite, and paio_submit

This patch adds trace events that make it possible to observe

Signed-off-by: Stefan Hajnoczi <>

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

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

This reverts commit 79368c81bf8cf93864d7afc88b81b05d8f0a2c90.



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

ee181196 08/30/2010 07:29 pm Kevin Wolf

block: Fix image re-open in bdrv_commit

Arguably we should re-open the backing file with the backing file format and
not with the format of the snapshot image.

Signed-off-by: Kevin Wolf <>

8a426614 08/03/2010 04:57 pm Kevin Wolf

block: Change bdrv_commit to handle multiple sectors at once

bdrv_commit copies the image to its backing file sector by sector, which
is (surprise!) relatively slow. Let's take a larger buffer and handle more
sectors at once if possible.

With a 1G qcow2 file, this brought the time bdrv_commit takes down from...

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

4be9762a 08/03/2010 04:57 pm Markus Armbruster

block: Change bdrv_eject() not to drop the image

bdrv_eject() gets called when a device model opens or closes the tray.

If the block driver implements method bdrv_eject(), that method gets
called. Drivers host_cdrom implements it, and it opens and closes the...

c98ac35d 07/26/2010 02:39 pm Stefan Weil

block: Use error codes from lower levels for error message

"No such file or directory" is a misleading error message
when a user tries to open a file with wrong permissions.

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

199630b6 07/26/2010 02:39 pm Blue Swirl

Fix -snapshot deleting images on disk change

Block device change command did not copy BDRV_O_SNAPSHOT flag. Thus
the new image did not have this flag and the file got deleted during

Fix by copying BDRV_O_SNAPSHOT flag.

Signed-off-by: Blue Swirl <>...

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

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

e076f338 07/06/2010 06:05 pm Kevin Wolf

qemu-img check: Distinguish different kinds of errors

People think that their images are corrupted when in fact there are just some
leaked clusters. Differentiating several error cases should make the messages
more comprehensible.

Signed-off-by: Kevin Wolf <>

453f9a16 07/02/2010 04:44 pm Kevin Wolf

block: Fix early failure in multiwrite

bdrv_aio_writev may call the callback immediately (and it will commonly do so
in error cases). Current code doesn't consider this. For details see the
comment added by this patch.

Signed-off-by: Kevin Wolf <>

de189a1b 07/02/2010 04:44 pm Kevin Wolf

block: Handle multiwrite errors only when all requests have completed

Don't try to be clever by freeing all temporary data and calling all callbacks
when the return value (an error) is certain. Doing so has at least two
important problems:

  • The temporary data that is freed (qiov, possibly zero buffer) is still used...
18846dee 07/02/2010 02:18 pm Markus Armbruster

block: Catch attempt to attach multiple devices to a blockdev

For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foo
happily creates two SCSI disks connected to the same block device.
It's all downhill from there.

Device usb-storage deliberately attaches twice to the same blockdev,...

f9092b10 07/02/2010 02:18 pm Markus Armbruster

savevm: Survive hot-unplug of snapshot device

savevm.c keeps a pointer to the snapshot block device. If you manage
to get that device deleted, the pointer dangles, and the next snapshot
operation will crash & burn. Unplugging a guest device that uses it...

3ac906f7 07/02/2010 02:18 pm Markus Armbruster

block: Clean up bdrv_snapshots()

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

7d0d6950 07/02/2010 02:18 pm Markus Armbruster

block: Fix virtual media change for if=none

BlockDriverState member removable controls whether virtual media
change (monitor commands change, eject) is allowed. It is set when
the "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.

The type hint is only set by drive_init(). It sets BDRV_TYPE_FLOPPY...

39508e7a 07/02/2010 02:18 pm Christoph Hellwig

block: allow filenames with colons again for host devices

Before the raw/file split we used to allow filenames with colons for host
device only. While this was more by accident than by design people rely
on it, so we need to bring it back.

So move the host device probing to be before the protocol detection...

15c7733b 07/02/2010 02:18 pm Ryan Harper

Don't reset bs->is_temporary in bdrv_open_common

To fix where qemu fails to
call unlink() on temporary snapshots due to bs->is_temporary getting clobbered
in bdrv_open_common() after being set in bdrv_open() which calls the former....

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

block: Add bdrv_(p)write_sync

Add new functions that write and flush the written data to disk immediately.
This is what needs to be used for image format metadata to maintain integrity
for cache=... modes that don't use O_DSYNC. (Actually, we only need barriers,...

5ffbbc67 06/15/2010 10:42 am Blue Swirl

block: fix a warning and possible truncation

Fix a warning from OpenBSD gcc (3.3.5 (propolice)):
/src/qemu/block.c: In function `bdrv_info_stats_bs':
/src/qemu/block.c:1548: warning: long long int format, long unsigned
int arg (arg 6)

There may be also truncation effects....

abd7f68d 06/15/2010 10:41 am Markus Armbruster

block: Move error actions from DriveInfo to BlockDriverState

That's where they belong semantically (block device host part), even
though the actions are actually executed by guest device code.

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

6ab4b5ab 06/15/2010 10:41 am Markus Armbruster

block: Decouple block device "commit all" from DriveInfo

do_commit() and mux_proc_byte() iterate over the list of drives
defined with drive_init(). This misses host block devices defined by
other means. Such means don't exist now, but will be introduced later...

2f399b0a 06/15/2010 10:41 am Markus Armbruster

block: New bdrv_next()

This is a more flexible alternative to bdrv_iterate().

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

feeee5ac 06/15/2010 10:41 am Miguel Di Ciurcio Filho

savevm: Really verify if a drive supports snapshots

Both bdrv_can_snapshot() and bdrv_has_snapshot() does not work as advertized.

First issue: Their names implies different porpouses, but they do the same thing
and have exactly the same code. Maybe copied and pasted and forgotten?...

08a00559 06/04/2010 12:43 pm Kevin Wolf

block: Assume raw for drives without media

qemu -cdrom /dev/cdrom with an empty CD-ROM drive doesn't work any more because
we try to guess the format and when this fails (because there is no medium) we
exit with an error message.

This patch should restore the old behaviour by assuming raw format for such...

2bc93fed 06/04/2010 12:43 pm MORITA Kazutaka

close all the block drivers before the qemu process exits

This patch calls the close handler of the block driver before the qemu
process exits.

This is necessary because the sheepdog block driver releases the lock
of VM images in the close handler.

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

7cdb1f6d 06/04/2010 12:43 pm MORITA Kazutaka

block: call the snapshot handlers of the protocol drivers

When snapshot handlers are not defined in the format driver, it is
better to call the ones of the protocol driver. This enables us to
implement snapshot support in the protocol driver.

We need to call bdrv_close() and bdrv_open() handlers of the format...

3e82990b 06/04/2010 12:43 pm Jes Sorensen

Cleanup: bdrv_open() no need to shift total_size just to shift back.

In bdrv_open() there is no need to shift total_size >> 9 just to
multiply it by 512 again just a few lines later, since this is the
only place the variable is used.

Mask with BDRV_SECTOR_MASK to protect against case where we are...

eb5a3165 06/04/2010 12:43 pm Jes Sorensen

Cleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512

Clean up block.c and use BDRV_SECTOR_SIZE rather than hard coded
numbers (512) when referring to sector size throughout the code.

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

358c360f 06/03/2010 10:55 pm Anthony Liguori

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

637503d1 06/01/2010 09:48 pm Luiz Capitulino

Monitor: Drop QMP documentation from code

Previous commit added QMP documentation to the qemu-monitor.hx
file, it's is a copy of this information.

While it's good to keep it near code, maintaining two copies of
the same information is too hard and has little benefit as we...

1a396859 05/28/2010 02:29 pm Nicholas A. Bellinger

block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format()

This patch adds a missing bdrv_delete() call in find_image_format() so that a
SG_IO BlockDriver properly releases the temporary BlockDriverState *bs created
from bdrv_file_open()...

cbf1dff2 05/28/2010 02:14 pm Kevin Wolf

block: Fix multiwrite with overlapping requests

With overlapping requests, the total number of sectors is smaller than the sum
of the nb_sectors of both requests.

Signed-off-by: Kevin Wolf <>

b50cbabc 05/28/2010 02:14 pm MORITA Kazutaka

add support for protocol driver create_options

This patch enables protocol drivers to use their create options which
are not supported by the format. For example, protcol drivers can use
a backing_file option with raw format.

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

016f5cf6 05/26/2010 09:05 pm Alexander Graf

Add cache=unsafe parameter to -drive

Usually the guest can tell the host to flush data to disk. In some cases we
don't want to flush though, but try to keep everything in cache.

So let's add a new cache value to -drive that allows us to set the cache
policy to most aggressive, disabling flushes. We call this mode "unsafe",...

77be4366 05/21/2010 12:49 pm Christoph Hellwig

block: fix sector comparism in multiwrite_req_compare

The difference between the start sectors of two requests can be larger
than the size of the "int" type, which can lead to a not correctly
sorted multiwrite array and thus spurious I/O errors and filesystem...

f8ea0b00 05/21/2010 12:49 pm Nicholas Bellinger

block: Make find_image_format() return 'raw' BlockDriver for SG_IO devices

This patch adds a special BlockDriverState->sg check in block.c:find_image_format()
after bdrv_file_open() -> block/raw-posix.c:hdev_open() has been called to determine
if we are dealing with a Linux host scsi-generic device....

396759ad 05/21/2010 12:49 pm Nicholas Bellinger

block: Add SG_IO device check in refresh_total_sectors()

This patch adds a special case check for scsi-generic devices in
refresh_total_sectors() to skip the subsequent BlockDriver->bdrv_getlength()
that will be returning -ESPIPE from block/raw-posic.c:raw_getlength() for...

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

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

block: Fix protocol detection for Windows devices

We can't assume the file protocol for Windows devices, they need the same
detection as other files for which an explicit protocol is not specified.

Signed-off-by: Kevin Wolf <>

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

block: Fix bdrv_commit

When reopening the image, don't guess the driver, but use the same driver as
was used before. This is important if the format=... option was used for that

Signed-off-by: Kevin Wolf <>

af474591 05/17/2010 11:20 am Bruce Rogers

use qemu_free() instead of free()

There is a call to free() where qemu_free() should instead be used.

Signed-off-by: Bruce Rogers <>
Signed-off-by: Kevin Wolf <>

21955137 05/17/2010 11:20 am Daniel P. Berrange

Fix docs for block stats monitor command

The 'parent' field in the 'query-blockstats' monitor command is
part of the top level block device QDict, not part of the 2nd
level 'stats' QDict.

  • block.c: Fix docs for 'parent' field in block stats monitor
    command output...
35ed5de6 05/17/2010 11:20 am Kevin Wolf

block: Remove special case for vvfat

The special case doesn't really us buy anything. Without it vvfat works more
consistently as a protocol. We get raw on top of vvfat now, which works just
as well as using vvfat directly.

Signed-off-by: Kevin Wolf <>

51762288 05/03/2010 11:07 am Stefan Hajnoczi

block: Cache total_sectors to reduce bdrv_getlength calls

The BlockDriver bdrv_getlength function is called from the I/O code path
when checking that the request falls within the device. Unfortunately
this involves an lseek system call in the raw protocol; every read or...

294cc35f 05/03/2010 11:07 am Kevin Wolf

block: Add wr_highest_sector blockstat

This adds the wr_highest_sector blockstat which implements what is generally
known as the high watermark. It is the highest offset of a sector written to
the respective BlockDriverState since it has been opened.

The query-blockstat QMP command is extended to add this value to the result,...

d748768c 05/03/2010 11:07 am Jan Kiszka

block: Release allocated options after bdrv_open

They aren't used afterwards nor supposed to be stored by a bdrv_create

Signed-off-by: Jan Kiszka <>
Signed-off-by: Kevin Wolf <>

557df6ac 05/03/2010 11:07 am Stefan Hajnoczi

block: Set backing_hd to NULL after deleting it

It is safer to set backing_hd to NULL after deleting it so that any use
after deletion is obvious during development. Happy segfaulting!

This patch should be applied after Kevin Wolf's "vmdk: Convert to
bdrv_open" so that vmdk does not segfault on close....

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

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

block: Split bdrv_open

bdrv_open contains quite some code that is only useful for opening images (as
opposed to opening files by a protocol), for example snapshots.

This patch splits the code so that we have bdrv_open_file() for files (uses
protocols), bdrv_open() for images (uses format drivers) and bdrv_open_common()...

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

block: Avoid forward declaration of bdrv_open_common

Move bdrv_open_common so it's defined before its callers and remove the forward

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

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

block: bdrv_has_zero_init

This fixes the problem that qemu-img's use of no_zero_init only considered the
no_zero_init flag of the format driver, but not of the underlying protocols.

Between the raw/file split and this fix, converting to host devices is broken....

1e1ea48d 04/23/2010 05:21 pm Stefan Hajnoczi

block: Free iovec arrays allocated by multiwrite_merge()

A new iovec array is allocated when creating a merged write request.
This patch ensures that the iovec array is deleted in addition to its
qiov owner.

Reported-by: Leszek Urbanski <>
Signed-off-by: Stefan Hajnoczi <>...

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

block: Do not export bdrv_first

The bdrv_first linked list of BlockDriverStates is currently extern so
that block migration can iterate the list. However, since there is
already a bdrv_iterate() function there is no need to expose bdrv_first.

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

1b7bdbc1 04/23/2010 05:21 pm Stefan Hajnoczi

block: Convert bdrv_first to QTAILQ

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

8a22f02a 04/23/2010 05:21 pm Stefan Hajnoczi

block: Convert first_drv to QLIST

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

8b9b0cc2 04/23/2010 05:08 pm Kevin Wolf

blkdebug: Add events and rules

Block drivers can trigger a blkdebug event whenever they reach a place where it
could be useful to inject an error for testing/debugging purposes.

Rules are read from a blkdebug config file and describe which action is taken...

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

6db95603 04/23/2010 05:08 pm Christoph Hellwig

block: get rid of the BDRV_O_FILE flag

BDRV_O_FILE is only used to communicate between bdrv_file_open and bdrv_open.
It affects two things: first bdrv_open only searches for protocols using
find_protocol instead of all image formats and host drivers. We can easily...

7eb58a6c 04/10/2010 01:39 am Kevin Wolf

block: Fix multiwrite memory leak in error case

Previously multiwrite_user_cb was never called if a request in the multiwrite
batch failed right away because it did set mcb->error immediately. Make it look
more like a normal callback to fix this.

Reported-by: Juan Quintela <>...

0f0b604b 04/10/2010 01:39 am Kevin Wolf

block: Fix error code in multiwrite for immediate failures

Signed-off-by: Kevin Wolf <>
Signed-off-by: Aurelien Jarno <>

cb6d3ca0 04/10/2010 01:14 am Kevin Wolf

block: Fix multiwrite error handling

When two requests of the same multiwrite batch fail, the callback of all
requests in that batch were called twice. This could have any kind of nasty
effects, in my case it lead to use after free and eventually a segfault....

fd04a2ae 03/17/2010 05:41 pm Shahar Havivi

Wrong error message in block_passwd command

Signed-off-by: Shahar Havivi <>
Signed-off-by: Anthony Liguori <>

4dca4b63 02/19/2010 11:32 pm Naphtali Sprei

block: more read-only changes, related to backing files

Open backing file read-only where possible
Upgrade backing file to read-write during commit, back to read-only after commit
If upgrade fail, back to read-only. If also fail, "disconnect" the drive....

ba144141 02/10/2010 09:46 pm Luiz Capitulino

Monitor: remove unneeded checks

It's not needed to check the return of qobject_from_jsonf()
anymore, as an assert() has been added there.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Anthony Liguori <>

2582bfed 02/10/2010 07:57 pm Luiz Capitulino

block: BLOCK_IO_ERROR QMP event

This commit introduces the bdrv_mon_event() function, which
should be called by block subsystems (eg. IDE) when a I/O
error occurs, so that an QMP event is emitted.

The following information is currently provided in the event:...

15dc2697 02/10/2010 07:57 pm Christoph Hellwig

block: saner flags filtering in bdrv_open2

Clean up the current mess about figuring out which flags to pass to the
only used by the block layer internally so filter them out directly.
Previously BDRV_O_NO_BACKING could accidentally be passed to the drivers,...

aaa0eb75 02/10/2010 12:56 am Liran Schour

Count dirty blocks and expose an API to get dirty count

This will manage dirty counter for each device and will allow to get the
dirty counter from above.

Signed-off-by: Liran Schour <>
Signed-off-by: Anthony Liguori <>

e2a305fb 01/27/2010 01:08 am Christoph Hellwig

block: avoid creating too large iovecs in multiwrite_merge

If we go over the maximum number of iovecs support by syscall we get
back EINVAL from the kernel which translate to I/O errors for the guest.

Add a MAX_IOV defintion for platforms that don't have it. For now we use...

f8a83245 01/27/2010 12:41 am Herve Poussineau

win32: pair qemu_memalign() with qemu_vfree()

Win32 suffers from a very big memory leak when dealing with SCSI devices.
Each read/write request allocates memory with qemu_memalign (ie
VirtualAlloc) but frees it with qemu_free (ie free).
Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks....

6987307c 01/26/2010 11:42 pm Christoph Hellwig

block: clean up bdrv_open2 structure a bit

Check the whitelist as early as possible instead of continuing the
setup, and move all the error handling code to the end of the

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Anthony Liguori <>