Statistics
| Branch: | Revision:

root / block.c @ 93d7ae8e

History | View | Annotate | Download (120.8 kB)

# Date Author Comment
c8433287 06/15/2012 03:03 pm Markus Armbruster

block: New bdrv_get_flags()

Signed-off-by: Markus Armbruster <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

f05fa4ad 06/15/2012 03:03 pm Paolo Bonzini

block: flush in writethrough mode after writes

We want to make the formats handle their own flushes
autonomously, while keeping for guests the ability to use a writethrough
cache. Since formats will write metadata via bs->file, bdrv_co_do_writev
is the only place where we need to add a flush....

c4a248a1 06/15/2012 03:03 pm Paolo Bonzini

block: copy enable_write_cache in bdrv_append

Because the guest will be able to flip enable_write_cache, the actual
state may not match what is used to open the new snapshot.

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

425b0148 06/15/2012 03:03 pm Paolo Bonzini

block: add bdrv_set_enable_write_cache

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

e1e9b0ac 06/15/2012 03:03 pm Paolo Bonzini

block: always open drivers in writeback mode

Formats are entirely in charge of flushes for metadata writes. For
guest-initiated writes, a writethrough cache is faked in the block layer.
So we can always open in writeback mode.

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

f8d6bba1 06/15/2012 03:03 pm Markus Armbruster

block: Replace bdrv_get_format() by bdrv_get_format_name()

So callers don't need to know anything about maximum name length.
Returning a pointer is safe, because the name string lives as long as
the block driver it names, and block drivers don't die.

Requested by Peter Maydell....

188a7bbf 06/15/2012 03:03 pm Paolo Bonzini

stream: move is_allocated_above to block.c

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

4534ff54 06/15/2012 03:03 pm Kevin Wolf

qemu-img check -r for repairing images

The QED block driver already provides the functionality to not only
detect inconsistencies in images, but also fix them. However, this
functionality cannot be manually invoked with qemu-img, but the
check happens only automatically during bdrv_open()....

eba25057 05/30/2012 09:48 am Jim Meyering

block: prevent snapshot mode $TMPDIR symlink attack

In snapshot mode, bdrv_open creates an empty temporary file without
checking for mkstemp or close failure, and ignoring the possibility
of a buffer overrun given a surprisingly long $TMPDIR.
Change the get_tmp_filename function to return int (not void),...

e023b2e2 05/10/2012 11:32 am Paolo Bonzini

block: fix snapshot on QED

QED's opaque data includes a pointer back to the BlockDriverState.
This breaks when bdrv_append shuffles data between bs_new and bs_top.
To avoid this, add a "rebind" function that tells the driver about
the new relationship between the BlockDriverState and its opaque....

3a389e79 05/10/2012 11:32 am Paolo Bonzini

block: another bdrv_append fix

bdrv_append must also copy open_flags to the top, because the snapshot
has BDRV_O_NO_BACKING set. This causes interesting results if you
later use drive-reopen (not upstream) to reopen the image, and lose
the backing file in the process....

a275fa42 05/10/2012 11:32 am Paolo Bonzini

block: do not reuse the backing file across bdrv_close/bdrv_open

This is another bug caused by not doing a full cleanup of the BDS
across close/open. This was found with mirroring by Shaolong Hu,
but it can probably be reproduced also with eject or change....

0ac9377d 05/10/2012 11:32 am Paolo Bonzini

block: fully delete bs->file when closing

We are reusing bs->file across close/open, which may not cause any
known bugs but is a recipe for trouble. Prefer bdrv_delete, and
enjoy the new invariant in the implementation of bdrv_delete.

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

4513eafe 05/10/2012 11:32 am Paolo Bonzini

block: add block_job_sleep_ns

This function abstracts the pretty complex semantics of the "busy"
member of BlockJob.

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

fa4478d5 05/10/2012 11:32 am Paolo Bonzini

block: wait for job callback in block_job_cancel_sync

The limitation on not having I/O after cancellation cannot really be
kept. Even streaming has a very small race window where you could
cancel a job and have it report completion. If this window is hit,...

f53f4da9 05/10/2012 11:32 am Paolo Bonzini

block: simplify path_is_absolute

On Windows, all the logic is already in is_windows_drive and
is_windows_drive_prefix. On POSIX, there is no need to look
out for colons.

The win32 code changes the behaviour in some cases, we could have
something like "d:foo.img". The old code would treat it as relative...

947995c0 05/10/2012 11:32 am Paolo Bonzini

block: protect path_has_protocol from filenames with colons

path_has_protocol will erroneously return "true" if the colon is part
of a filename. These names are common with stable device names produced
by udev. We cannot fully protect against this in case the filename...

6405875c 05/10/2012 11:32 am Paolo Bonzini

block: move field reset from bdrv_open_common to bdrv_close

bdrv_close should leave fields in the same state as bdrv_new. It is
not up to bdrv_open_common to fix the mess.

Also, backing_format was not being re-initialized.

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

dc5a1371 05/10/2012 11:32 am Paolo Bonzini

qemu-img: make "info" backing file output correct and easier to use

qemu-img info should use the same logic as qemu when printing the
backing file path, or debugging becomes quite tricky. We can also
simplify the output in case the backing file has an absolute path...

4c355d53 05/10/2012 11:32 am Zhi Yong Wu

block: add the support to drain throttled requests

Signed-off-by: Zhi Yong Wu <>
[ Iterate until all block devices have processed all requests,
add comments. - Paolo ]
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

5f377794 05/10/2012 11:32 am Paolo Bonzini

block: push bdrv_change_backing_file error checking up from drivers

This check applies to all drivers, but QED lacks it.

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

469ef350 05/10/2012 11:32 am Paolo Bonzini

block: update in-memory backing file and format

These are needed to print "info block" output correctly. QCOW2 does this
because it needs it to write the header, but QED does not, and common code
is the right place to do it.

Reviewed-by: Kevin Wolf <>...

63090dac 05/10/2012 11:32 am Paolo Bonzini

block: open backing file as read-only when probing for size

bdrv_img_create will temporarily open the backing file to probe its size.
However, this could be done with a read-write open if the wrong flags are
passed to bdrv_img_create. Since there is really no documentation on...

71df14fc 05/10/2012 11:32 am Paolo Bonzini

block: fix allocation size for dirty bitmap

Also reuse elsewhere the new constant for sizeof(unsigned long) * 8.

The dirty bitmap is allocated in bits but declared as unsigned long.
Thus, its memory block is accessed beyond its end unless the image
is a multiple of 64 chunks (i.e. a multiple of 64 MB)....

5b7e1542 05/07/2012 08:33 pm Zhi Yong Wu

block: make bdrv_create adopt coroutine

The current qemu.git introduces failure with preallocation and some
sizes:

qemu-img create f qcow2 new.img 976563K -o preallocation=metadata
qemu-img: qemu-coroutine-lock.c:111: qemu_co_mutex_unlock: Assertion
`mutex
>locked == 1' failed....

fd7f8c65 04/27/2012 05:44 pm Stefan Hajnoczi

block: use Error mechanism instead of -errno for block_job_create()

The block job API uses -errno return values internally and we convert
these to Error in the QMP functions. This is ugly because the Error
should be created at the point where we still have all the relevant...

9e6636c7 04/27/2012 05:44 pm Stefan Hajnoczi

block: use Error mechanism instead of -errno for block_job_set_speed()

There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs....

882ec7ce 04/27/2012 05:44 pm Stefan Hajnoczi

block: change block-job-set-speed argument from 'value' to 'speed'

Signed-off-by: Stefan Hajnoczi <>
Acked-by: Kevin Wolf <>
Signed-off-by: Luiz Capitulino <>

c83c66c3 04/27/2012 05:44 pm Stefan Hajnoczi

block: add 'speed' optional parameter to block-stream

Allow streaming operations to be started with an initial speed limit.
This eliminates the window of time between starting streaming and
issuing block-job-set-speed. Users should use the new optional 'speed'...

621f0589 04/20/2012 04:57 pm Kevin Wolf

qcow2: Zero write support

Signed-off-by: Kevin Wolf <>

80ccf93b 04/20/2012 12:42 pm Liu Yuan

qemu-img: let 'qemu-img convert' flush data

The 'qemu-img convert -h' advertise that the default cache mode is
'writeback', while in fact it is 'unsafe'.

This patch 1) fix the help manual and 2) let bdrv_close() call bdrv_flush()

2) is needed because some backend storage doesn't have a self-flush...

7094f12f 04/19/2012 04:48 pm Kevin Wolf

block: Drain requests in bdrv_close

If an AIO request is in flight that refers to a BlockDriverState that
has been closed and possibly even freed, more or less anything could
happen. I have seen segfaults, -EBADF return values and qcow2 sometimes
actually catches the situation in bdrv_close() and abort()s....

07789269 04/05/2012 05:27 pm Benoît Canet

block: add a function to clear incoming live migration flags

This function will clear all BDRV_O_INCOMING flags.

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

f6801b83 04/05/2012 03:54 pm Jeff Cody

block: bdrv_append() fixes

A few fixups for bdrv_append():

The new bs (bs_new) passed into bdrv_append() should be anonymous. Rather
than call bdrv_make_anon() to enforce this, use an assert to catch when a caller
is passing in a bs_new that is not anonymous....

498e386c 04/05/2012 03:54 pm Zhi Yong Wu

block: disable I/O throttling on sync api

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

3e914655 04/05/2012 03:54 pm Paolo Bonzini

block: fix streaming/closing race

Streaming can issue I/O while qcow2_close is running. This causes the
L2 caches to become very confused or, alternatively, could cause a
segfault when the streaming coroutine is reentered after closing its
block device. The fix is to cancel streaming jobs when closing their...

9f25eccc 04/05/2012 03:54 pm Paolo Bonzini

block: set job->speed in block_set_speed

There is no need to do this in every implementation of set_speed
(even though there is only one right now).

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Stefan Hajnoczi <>...

29cdb251 04/05/2012 03:54 pm Paolo Bonzini

block: push recursive flushing up from drivers

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

e8877497 03/12/2012 04:14 pm Stefan Hajnoczi

block: handle -EBUSY in bdrv_commit_all()

Monitor operations that manipulate image files must not execute while a
background job (like image streaming) is in progress. This prevents
corruptions from happening when two pieces of code are manipulating the...

8802d1fd 02/29/2012 04:48 pm Jeff Cody

qapi: Introduce blockdev-group-snapshot-sync command

This is a QAPI/QMP only command to take a snapshot of a group of
devices. This is similar to the blockdev-snapshot-sync command, except
blockdev-group-snapshot-sync accepts a list devices, filenames, and...

b6a127a1 02/29/2012 01:48 pm Paolo Bonzini

block: drop aio_multiwrite in BlockDriver

These were never used.

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

f8d3d128 02/29/2012 01:48 pm Hervé Poussineau

block: add a transfer rate for floppy types

Floppies must be read at a specific transfer rate, depending of its own format.
Update floppy description table to include required transfer rate.

Signed-off-by: Hervé Poussineau <>
Signed-off-by: Kevin Wolf <>

6f382ed2 02/22/2012 09:23 pm Luiz Capitulino

qmp: add DEVICE_TRAY_MOVED event

It's emitted whenever the tray is moved by the guest or by HMP/QMP
commands.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Acked-by: Kevin Wolf <>

f36f3949 02/22/2012 09:23 pm Luiz Capitulino

block: bdrv_eject(): Make eject_flag a real bool

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Acked-by: Kevin Wolf <>

329c0a48 02/22/2012 09:22 pm Luiz Capitulino

block: Rename bdrv_mon_event() & BlockMonEventAction

They are QMP events, not monitor events. Rename them accordingly.

Also, move bdrv_emit_qmp_error_event() up in the file. A new event will
be added soon and it's good to have them next each other.

Signed-off-by: Luiz Capitulino <>...

f08f2dda 02/09/2012 05:17 pm Stefan Hajnoczi

block: add .bdrv_co_write_zeroes() interface

The ability to zero regions of an image file is a useful primitive for
higher-level features such as image streaming or zero write detection.

Image formats may support an optimized metadata representation instead...

79c053bd 02/09/2012 05:17 pm Stefan Hajnoczi

block: perform zero-detection during copy-on-read

Copy-on-Read populates the image file with data read from a backing
image. In order to avoid bloating the image file when all zeroes are
read we should scan the buffer and perform an optimized zero write...

e8a6bb9c 01/26/2012 03:49 pm Marcelo Tosatti

block: add bdrv_find_backing_image

Add bdrv_find_backing_image: given a BlockDriverState pointer, and an id,
traverse the backing image chain to locate the id.

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

2d3735d3 01/26/2012 12:45 pm Stefan Hajnoczi

block: check bdrv_in_use() before blockdev operations

Long-running block operations like block migration and image streaming
must have continual access to their block device. It is not safe to
perform operations like hotplug, eject, change, resize, commit, or...

470c0504 01/26/2012 12:45 pm Stefan Hajnoczi

block: make copy-on-read a per-request flag

Previously copy-on-read could only be enabled for all requests to a
block device. This means requests coming from the guest as well as
QEMU's internal requests would perform copy-on-read when enabled.

For image streaming we want to support finer-grained behavior than just...

eeec61f2 01/26/2012 12:45 pm Stefan Hajnoczi

block: add BlockJob interface for long-running operations

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

3f3aace8 12/15/2011 01:40 pm Paolo Bonzini

block: avoid useless checks on acb->bh

Coverity is confused by this "if" and reports leaks on acb->bh.
The bottom half is always deleted before releasing the AIOCB,
in either bdrv_aio_cancel_em or bdrv_aio_bh_cb.

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

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

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

block: simplify failure handling for bdrv_aio_multiwrite

Now that early failure of bdrv_aio_writev is not possible anymore,
mcb->num_requests can be set before the loop starts.

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

922453bc 12/05/2011 03:56 pm Stefan Hajnoczi

block: convert qemu_aio_flush() calls to bdrv_drain_all()

Many places in QEMU call qemu_aio_flush() to complete all pending
asynchronous I/O. Most of these places actually want to drain all block
requests but there is no block layer API to do so.

This patch introduces the bdrv_drain_all() API to wait for requests...

5f8b6491 12/05/2011 03:52 pm Stefan Hajnoczi

block: wait_for_overlapping_requests() deadlock detection

Debugging a reentrant request deadlock was fun but in the future we need
a quick and obvious way of detecting such bugs. Add an assert that
checks we are not about to deadlock when waiting for another request....

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

block: implement bdrv_co_is_allocated() boundary cases

Cases beyond the end of the disk image are only implemented for block
drivers that do not provide .bdrv_co_is_allocated(). It's worth making
these cases generic so that block drivers that do implement...

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

block: add request tracking

The block layer does not know about pending requests. This information
is necessary for copy-on-read since overlapping requests must be
serialized to prevent races that corrupt the image.

The BlockDriverState gets a new tracked_request list field which...

53fec9d3 12/05/2011 03:51 pm Stefan Hajnoczi

block: add interface to toggle copy-on-read

The bdrv_enable_copy_on_read()/bdrv_disable_copy_on_read() functions can
be used to programmatically enable or disable copy-on-read for a block
device. Later patches add the actual copy-on-read logic.

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

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

block: wait for overlapping requests

When copy-on-read is enabled it is necessary to wait for overlapping
requests before issuing new requests. This prevents races between the
copy-on-read and a write request.

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

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

block: request overlap detection

Detect overlapping requests and remember to align to cluster boundaries
if the image format uses them. This assumes that allocating I/O is
performed in cluster granularity - which is true for qcow2, qed, etc.

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

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

block: core copy-on-read logic

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

6aebab14 12/05/2011 03:51 pm Stefan Hajnoczi

block: drop .bdrv_is_allocated() interface

Now that all block drivers have been converted to
.bdrv_co_is_allocated() we can drop .bdrv_is_allocated().

Note that the public bdrv_is_allocated() interface is still available
but is in fact a synchronous wrapper around .bdrv_co_is_allocated()....

060f51c9 12/05/2011 03:51 pm Stefan Hajnoczi

block: add bdrv_co_is_allocated() interface

This patch introduces the public bdrv_co_is_allocated() interface which
can be used to query image allocation status while the VM is running.

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

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

block: use public bdrv_is_allocated() interface

There is no need for bdrv_commit() to use the BlockDriver
.bdrv_is_allocated() interface directly. Converting to the public
interface gives us the freedom to drop .bdrv_is_allocated() entirely in
favor of a new .bdrv_co_is_allocated() in the future....

376ae3f1 12/05/2011 03:51 pm Stefan Hajnoczi

block: add .bdrv_co_is_allocated()

This patch adds the .bdrv_co_is_allocated() interface which is identical
to .bdrv_is_allocated() but runs in coroutine context. Running in
coroutine context implies that other coroutines might be performing I/O
at the same time. Therefore it must be safe to run while the following...

0563e191 12/05/2011 03:51 pm Zhi Yong Wu

block: add the blockio limits command line support

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

98f90dba 12/05/2011 03:51 pm Zhi Yong Wu

block: add I/O throttling algorithm

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

727f005e 12/05/2011 03:51 pm Zhi Yong Wu

hmp/qmp: add block_set_io_throttle

Signed-off-by: Zhi Yong Wu <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

0f15423c 11/21/2011 10:58 pm Anthony Liguori

block: allow migration to work with image files (v3)

Image files have two types of data: immutable data that describes things like
image size, backing files, etc. and mutable data that includes offset and
reference count tables.

Today, image formats aggressively cache mutable data to improve performance. In...

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

ca716364 11/11/2011 03:02 pm Kevin Wolf

block: Make cache=unsafe flush to the OS

cache=unsafe completely ignored bdrv_flush, because flushing the host disk
costs a lot of performance. However, this means that qcow2 images (and
potentially any other format) can lose data even after the guest has issued a...

025ccaa7 11/11/2011 03:02 pm Paolo Bonzini

block: add eject request callback

Recent versions of udev always keep the tray locked so that the kernel
can observe "eject request" events (aka tray button presses) even on
discs that aren't mounted. Add support for these events in the ATAPI
and SCSI cd drive device models....

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

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

Conflicts:
block/vmdk.c

03f541bd 10/28/2011 08:25 pm Stefan Hajnoczi

block: reinitialize across bdrv_close()/bdrv_open()

Several BlockDriverState fields are not being reinitialized across
bdrv_close()/bdrv_open(). Make sure they are reset to their default
values.

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

3574c608 10/28/2011 08:25 pm Kevin Wolf

block: Remove dead code

Signed-off-by: Kevin Wolf <>

2b572816 10/28/2011 08:25 pm Kevin Wolf

block: Fix bdrv_open use after free

tmp_filename was used outside the block it was defined in, i.e. after it went
out of scope. Move its declaration to the top level.

Signed-off-by: Kevin Wolf <>

e7c63796 10/28/2011 08:25 pm Stefan Hajnoczi

block: set bs->read_only before .bdrv_open()

Several block drivers set bs->read_only in .bdrv_open() but
block.c:bdrv_open_common() clobbers its value. Additionally, QED uses
bdrv_is_read_only() in .bdrv_open() to decide whether to perform
consistency checks....

d6bf279e 10/27/2011 04:48 pm Luiz Capitulino

block: iostatus: Drop BDRV_IOS_INVAL

A future commit will convert bdrv_info() to the QAPI and it won't
provide IOS_INVAL.

Luckily all we have to do is to add a new 'iostatus_enabled'
member to BlockDriverState and use it instead.

Signed-off-by: Luiz Capitulino <>

58e21ef5 10/27/2011 04:48 pm Luiz Capitulino

block: Rename the BlockIOStatus enum values

The biggest change is to rename its prefix from BDRV_IOS to
BLOCK_DEVICE_IO_STATUS.

Next commit will convert the query-block command to the QAPI
and that's how the enumeration is going to be generated.

Signed-off-by: Luiz Capitulino <>

b2023818 10/27/2011 04:48 pm Luiz Capitulino

qapi: Convert query-block

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

f11f57e4 10/27/2011 04:48 pm Luiz Capitulino

qapi: Convert query-blockstats

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

f795e743 10/27/2011 04:48 pm Luiz Capitulino

Drop qemu-objects.h from modules that don't require it

Previous commits dropped most qobjects usage from qemu modules
(now they are a low level interface used by the QAPI). However,
some modules still include the qemu-objects.h header file.

This commit drops qemu-objects.h from some of those modules...

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

07f07615 10/21/2011 06:34 pm Paolo Bonzini

block: unify flush implementations

Add coroutine support for flush and apply the same emulation that
we already do for read/write. bdrv_aio_flush is simplified to always
go through a coroutine.

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

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

35246a68 10/21/2011 06:34 pm Paolo Bonzini

block: rename bdrv_co_rw_bh

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

8c5873d6 10/14/2011 06:31 pm Stefan Hajnoczi

block: drop emulation functions that use coroutines

Block drivers that implement coroutine functions used to get sync and
aio wrappers. This is no longer necessary since all request processing
now happens in a coroutine. If a block driver implements the coroutine...

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

block: drop .bdrv_read()/.bdrv_write() emulation

There is no need to emulate .bdrv_read()/.bdrv_write() since these
interfaces are only called if aio and coroutine interfaces are not
present. All valid BlockDrivers must implement either sync, aio, or
coroutine interfaces....

09f085d5 10/14/2011 06:31 pm Stefan Hajnoczi

block: drop bdrv_has_async_rw()

Commit cd74d83345e0e3b708330ab8c4cd9111bb82cda6 ("block: switch
bdrv_read()/bdrv_write() to coroutines") removed the bdrv_has_async_rw()
callers. This patch removes bdrv_has_async_rw() since it is no longer
used.

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

b2a61371 10/13/2011 04:02 pm Stefan Hajnoczi

block: switch bdrv_aio_readv() to coroutines

More sync, aio, and coroutine unification. Make bdrv_aio_readv() go
through coroutine request processing.

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

6b7cb247 10/13/2011 04:02 pm Stefan Hajnoczi

block: mark blocks dirty on coroutine write completion

The aio write operation marks blocks dirty when the write operation
completes. The coroutine write operation marks blocks dirty before
issuing the write operation.

It seems safest to mark the block dirty when the operation completes so...

1a6e115b 10/13/2011 04:02 pm Stefan Hajnoczi

block: switch bdrv_aio_writev() to coroutines

More sync, aio, and coroutine unification. Make bdrv_aio_writev() go
through coroutine request processing.

Remove the dirty block callback mechanism which was needed only for aio
processing and can be done more naturally in coroutine context....

1ed20acf 10/13/2011 04:02 pm Stefan Hajnoczi

block: directly invoke .bdrv_* from emulation functions

The emulation functions which supply default BlockDriver .bdrv_*()
functions given another implemented .bdrv_*() function should not use
public bdrv_*() interfaces. This patch ensures they invoke .bdrv_*()...

c5fbe571 10/13/2011 04:02 pm Stefan Hajnoczi

block: split out bdrv_co_do_readv() and bdrv_co_do_writev()

The public interface for I/O in coroutine context is bdrv_co_readv() and
bdrv_co_writev(). Split out the request processing code into
bdrv_co_do_readv() and bdrv_co_writev() so that it can be called...

1c9805a3 10/13/2011 04:02 pm Stefan Hajnoczi

block: switch bdrv_read()/bdrv_write() to coroutines

The bdrv_read()/bdrv_write() functions call .bdrv_read()/.bdrv_write().
They should go through bdrv_co_do_readv() and bdrv_co_do_writev()
instead in order to unify request processing code across sync, aio, and...

a652d160 10/13/2011 04:02 pm Stefan Hajnoczi

block: directly invoke .bdrv_aio_*() in bdrv_co_io_em()

We will unify block layer request processing across sync, aio, and
coroutines and this means a .bdrv_co_*() emulation function should not
call back into the public interface. There's no need here, just call...

d2078cc2 10/11/2011 10:42 am Luiz Capitulino

HMP: Print 'io-status' information

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>