Statistics
| Branch: | Revision:

root / block / qed.c @ feature-archipelago

History | View | Annotate | Download (47.2 kB)

# Date Author Comment
76abe407 02/21/2014 10:02 pm Paolo Bonzini

block: do not abuse EMEDIUMTYPE

Returning "Wrong medium type" for an image that does not have a valid
header is a bit weird. Improve the error by mentioning what format
was trying to open it.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Fam Zheng <>...

0fea6b79 02/21/2014 10:02 pm Paolo Bonzini

qed: correctly propagate errors

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

2e40134b 02/21/2014 10:02 pm Max Reitz

block: Make bdrv_file_open() static

Add the bdrv_open() option BDRV_O_PROTOCOL which results in passing the
call to bdrv_file_open(). Additionally, make bdrv_file_open() static and
therefore bdrv_open() the only way to call it.

Consequently, all existing calls to bdrv_file_open() have to be adjusted...

55aff7f1 01/31/2014 11:05 pm Jeff Cody

block: remove QED .bdrv_make_empty implementation

The QED .bdrv_make_empty() implementation does nothing but return
-ENOTSUP, which causes problems in bdrv_commit(). Since the function
stub exists for QED, it is called, which then always returns an error....

d34682cd 01/24/2014 06:40 pm Kevin Wolf

block: Move initialisation of BlockLimits to bdrv_refresh_limits()

This function separates filling the BlockLimits from bdrv_open(), which
allows it to call it from other operations which may change the limits
(e.g. modifications to the backing file chain or bdrv_reopen)...

72daa72e 01/22/2014 01:07 pm Max Reitz

block: Allow reference for bdrv_file_open()

Allow specifying a reference to an existing block device (by name) for
bdrv_file_open() instead of a filename and/or options.

Signed-off-by: Max Reitz <>
Reviewed-by: Kevin Wolf <>...

95de6d70 12/03/2013 04:26 pm Paolo Bonzini

block drivers: add discard/write_zeroes properties to bdrv_get_info implementation

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

cffb1ec6 12/03/2013 04:26 pm Paolo Bonzini

block drivers: expose requirement for write same alignment from formats

This will let misaligned but large requests use zero clusters. This
is important because the cluster size is not guest visible.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Peter Lieven <>...

aa7bfbff 11/28/2013 11:30 am Peter Lieven

block: add flags to bdrv_*_write_zeroes

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

d5124c00 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for creating images

Add an Error ** parameter to BlockDriver.bdrv_create to allow more
specific error messages.

Signed-off-by: Max Reitz <>

34b5d2c6 09/12/2013 11:12 am Max Reitz

block: Error parameter for open functions

Add an Error ** parameter to bdrv_open, bdrv_file_open and associated
functions to allow more specific error messages.

Signed-off-by: Max Reitz <>

cc84d90f 09/12/2013 11:12 am Max Reitz

block: Error parameter for create functions

Add an Error ** parameter to bdrv_create and its associated functions to
allow more specific error messages.

Signed-off-by: Max Reitz <>

015a1036 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for opening images

Add an Error ** parameter to BlockDriver.bdrv_open and
BlockDriver.bdrv_file_open to allow more specific error messages.

Signed-off-by: Max Reitz <>

b6b8a333 09/06/2013 04:25 pm Paolo Bonzini

block: introduce bdrv_get_block_status API

For now, bdrv_get_block_status is just another name for bdrv_is_allocated.
The next patches will add more flags.

This also touches all block drivers with a mostly mechanical rename. The
sole exception is cow; because it calls cow_co_is_allocated from the read...

4bc74be9 09/06/2013 04:25 pm Paolo Bonzini

block: return get_block_status data and flags for formats

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

4f6fd349 09/06/2013 04:25 pm Fam Zheng

block: make bdrv_delete() static

Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is no
longer public and should be called by bdrv_unref() if refcnt is
decreased to 0.

This is an identical change because effectively, there's no multiple
reference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets...

bc72ad67 08/22/2013 08:14 pm Alex Bligh

aio / timers: Switch entire codebase to the new timer API

This is an autogenerated patch using scripts/switch-timer-api.

Switch the entire code base to using the new timer API.

Note this patch may introduce some line length issues.

Signed-off-by: Alex Bligh <>...

3ac21627 06/28/2013 02:52 pm Peter Lieven

block: change default of .has_zero_init to 0

.has_zero_init defaults to 1 for all formats and protocols.

this is a dangerous default since this means that all
new added drivers need to manually overwrite it to 0 if
they do not ensure that a device is zero initialized...

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

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

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

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

caf71f86 12/19/2012 09:31 am Paolo Bonzini

migration: move include files to include/migration/

Signed-off-by: Paolo Bonzini <>

7b1b5d19 12/19/2012 09:31 am Paolo Bonzini

qapi: move include files to include/qobject/

Signed-off-by: Paolo Bonzini <>

d7331bed 11/14/2012 07:19 pm Stefan Hajnoczi

aio: rename AIOPool to AIOCBInfo

Now that AIOPool no longer keeps a freelist, it isn't really a "pool"
anymore. Rename it to AIOCBInfo and make it const since it no longer
needs to be modified.

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

f9cb20f1 09/24/2012 04:15 pm Jeff Cody

block: qed image file reopen

These are the stubs for the file reopen drivers for the qed format.

There is currently nothing that needs to be done by the qed driver
in reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

ef72f76e 08/29/2012 04:23 pm Stefan Hajnoczi

qed: refuse unaligned zero writes with a backing file

Zero writes have cluster granularity in QED. Therefore they can only be
used to zero entire clusters.

If the zero write request leaves sectors untouched, zeroing the entire
cluster would obscure the backing file. Instead return -ENOTSUP, which...

b10170ac 08/10/2012 11:25 am Stefan Hajnoczi

qed: mark image clean after repair succeeds

The dirty bit is cleared after image repair succeeds in qed_open().
Move this into qed_check() so that all callers benefit from this
behavior when fix=true.

This is necessary so qemu-img check can call .bdrv_check() and mark the...

058f8f16 08/10/2012 11:25 am Stefan Hajnoczi

block: add BLOCK_O_CHECK for qemu-img check

Image formats with a dirty bit, like qed and qcow2, repair dirty image
files upon open with BDRV_O_RDWR. Performing automatic repair when
qemu-img check runs is not ideal because the bdrv_open() call repairs
the image before the actual bdrv_check() call from qemu-img.c....

23797df3 07/09/2012 08:35 pm Anthony Liguori

Merge remote-tracking branch 'mjt/mjt-iov2' into staging

  • mjt/mjt-iov2:
    rewrite iov_send_recv() and move it to iov.c
    cleanup qemu_co_sendv(), qemu_co_recvv() and friends
    export iov_send_recv() and use it in iov_send() and iov_recv()
    rename qemu_sendv to iov_send, change proto and move declarations to iov.h...
820100fd 07/09/2012 04:53 pm Paolo Bonzini

blkdebug: remove sync i/o events

These are unused, except (by mistake more or less) in QED.

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

1b093c48 06/11/2012 10:12 pm Michael Tokarev

consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent

qemu_iovec_concat() is currently a wrapper for
qemu_iovec_copy(), use the former (with extra
"0" arg) in a few places where it is used.

Change skip argument of qemu_iovec_copy() from...

3d9b4925 06/11/2012 10:07 pm Michael Tokarev

consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset()

This patch combines two functions into one, and replaces
the implementation with already existing iov_memset() from
iov.c.

The new prototype of qemu_iovec_memset():...

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

50d30c26 04/05/2012 05:29 pm Benoît Canet

qed: remove incoming live migration blocker

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

2d1f3c23 04/05/2012 05:29 pm Benoît Canet

qed: honor BDRV_O_INCOMING for incoming live migration

From original commit with Patchwork-id: 31108 by
Stefan Hajnoczi <>

"The QED image format includes a file header bit to mark images dirty.
QED normally checks dirty images on open and fixes inconsistent...

c82954e5 04/05/2012 05:28 pm Benoît Canet

qed: add bdrv_invalidate_cache to be called after incoming live migration

The QED image is reopened to flush metadata and check consistency.

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

d68dbee8 04/05/2012 03:54 pm Dong Xu Wang

qed: track dirty flag status

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

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

6e4f59bd 02/09/2012 05:17 pm Stefan Hajnoczi

qed: replace is_write with flags field

Per-request attributes like read/write are currently implemented as bool
fields in the QEDAIOCB struct. This becomes unwiedly as the number of
attributes grows. For example, the qed_aio_setup() function would have...

0e71be19 02/09/2012 05:17 pm Stefan Hajnoczi

qed: add .bdrv_co_write_zeroes() support

Zero writes are a dedicated interface for writing regions of zeroes into
the image file. If clusters are not yet allocated it is possible to use
an efficient metadata representation which keeps the image file compact...

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

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

qed: convert to .bdrv_co_is_allocated()

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

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

qed: add migration blocker (v2)

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

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

Signed-off-by: Anthony Liguori <>

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

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

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

qed: don't pass NULL to memcpy

Spotted by Clang Analyzer

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

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

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

qed: remove unneeded variable assignment

'ret' is unconditionally overwitten by qed_read_l1_table_sync()

Spotted by Clang Analyzer

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

6f6dc656 10/21/2011 06:34 pm Stefan Hajnoczi

block: drop redundant bdrv_flush implementation

Block drivers now only need to provide either of .bdrv_co_flush,
.bdrv_aio_flush() or for legacy drivers .bdrv_flush(). Remove
the redundant .bdrv_flush() implementations.

[Paolo Bonzini: change raw driver to bdrv_co_flush]...

e4fc8781 10/05/2011 06:52 pm Stefan Hajnoczi

qed: fix use-after-free during l2 cache commit

QED's metadata caching strategy allows two parallel requests to race for
metadata lookup. The first one to complete will populate the metadata
cache and the second one will drop the data it just read in favor of the...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

384acbf4 08/02/2011 04:53 pm Kevin Wolf

async: Remove AsyncContext

The purpose of AsyncContexts was to protect qcow and qcow2 against reentrancy
during an emulated bdrv_read/write (which includes a qemu_aio_wait() call and
can run AIO callbacks of different requests if it weren't for AsyncContexts)....

99cce9fa 06/08/2011 12:56 pm Kevin Wolf

qemu-img create: Fix displayed default cluster size

When not specifying a cluster size on the command line, qemu-img printed
a cluster size of 0:

Formatting '/tmp/test.qcow2', fmt=qcow2 size=67108864
encryption=off cluster_size=0

This patch adds the default cluster size to the QEMUOptionParameter list, so...

77a5a000 05/18/2011 03:39 pm Stefan Hajnoczi

qed: support for growing images

The .bdrv_truncate() operation resizes images and growing is easy to
implement in QED. Simply check that the new size is valid and then
update the image_size header field to reflect the new size.

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

6f321e93 05/18/2011 03:38 pm Stefan Hajnoczi

qed: Periodically flush and clear need check bit

One strategy to limit the startup delay of consistency check when
opening image files is to ensure that the file is marked dirty for as
little time as possible.

QED currently marks the image dirty when the first allocating write...

21df65b6 04/13/2011 01:06 pm Anthony Liguori

qed: Add support for zero clusters

Zero clusters are similar to unallocated clusters except instead of reading
their value from a backing file when one is available, the cluster is always
read as zero.

This implements read support only. At this stage, QED will never write a...

10b758e8 02/10/2011 02:23 pm Kevin Wolf

qed: Report error for unsupported features

Instead of just returning -ENOTSUP, generate a more detailed error.

Unfortunately we don't have a helpful text for features that we don't know yet,
so just print the feature mask. It might be useful at least if someone asks for...

0d09c797 01/31/2011 11:03 am Stefan Hajnoczi

qed: Images with backing file do not require QED_F_NEED_CHECK

The consistency check on open is necessary in order to fix inconsistent
table offsets left as a result of a crash mid-operation. Images with a
backing file actually flush before updating table offsets and are...

c743849b 01/24/2011 05:41 pm Stefan Hajnoczi

qed: Refuse to create images on block devices

QED relies on the underlying filesystem to extend the file and maintain
its size. Check that images are not created on a block device.

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

75411d23 12/17/2010 05:11 pm Stefan Hajnoczi

qed: Add QEMU Enhanced Disk image format

This patch introduces the qed on-disk layout and implements image
creation. Later patches add read/write and other functionality.

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

298800ca 12/17/2010 05:11 pm Stefan Hajnoczi

qed: Table, L2 cache, and cluster functions

This patch adds code to look up data cluster offsets in the image via
the L1/L2 tables. The L2 tables are writethrough cached in memory for
performance (each read/write requires a lookup so it is essential to
cache the tables)....

eabba580 12/17/2010 05:11 pm Stefan Hajnoczi

qed: Read/write support

This patch implements the read/write state machine. Operations are
fully asynchronous and multiple operations may be active at any time.

Allocating writes lock tables to ensure metadata updates do not
interfere with each other. If two allocating writes need to update the...

01979a98 12/17/2010 05:11 pm Stefan Hajnoczi

qed: Consistency check support

This patch adds support for the qemu-img check command. It also
introduces a dirty bit in the qed header to mark modified images as
needing a check. This bit is cleared when the image file is closed
cleanly.

If an image file is opened and it has the dirty bit set, a consistency...