Statistics
| Branch: | Revision:

root / block.h @ e2134eb9

History | View | Annotate | Download (17.2 kB)

# Date Author Comment
90c45b30 10/29/2012 05:34 pm Anthony Liguori

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

  • kwolf/for-anthony: (32 commits)
    osdep: Less restrictive F_SEFL in qemu_dup_flags()
    qemu-iotests: add testcases for mirroring on-source-error/on-target-error
    qmp: add pull_event function...
ac84adac 10/24/2012 11:26 am Paolo Bonzini

block: add bdrv_query_info

Extract it out of the implementation of "info block".

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

9887b616 10/24/2012 11:26 am Paolo Bonzini

block: add bdrv_query_stats

qmp_query_blockstat cannot have errors, remove the Error argument and
create a new public function bdrv_query_stats out of it.

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

9156df12 10/24/2012 11:26 am Paolo Bonzini

block: add bdrv_open_backing_file

Mirroring runs without the backing file so that it can be copied outside
QEMU. However, we need to add it at the time the job is completed and
QEMU switches to the target. Factor out the common bits of opening an
image and completing a mirroring operation....

1755da16 10/24/2012 11:26 am Paolo Bonzini

block: introduce new dirty bitmap functionality

Assert that write_compressed is never used with the dirty bitmap.
Setting the bits early is wrong, because a coroutine might concurrently
examine them and copy incomplete data from the source.

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

d7d512f6 10/23/2012 11:39 pm Paolo Bonzini

block: add close notifiers

The first user of close notifiers will be the embedded NBD server.
It would be possible to use them to do some of the ad hoc processing
(e.g. for block jobs and I/O limits) that is currently done by
bdrv_close.

Acked-by: Kevin Wolf <>...

1ceee0d5 09/28/2012 08:40 pm Paolo Bonzini

iostatus: change is_read to a bool

Do this while we are touching this part of the code, before introducing
more uses of "int is_read".

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

3e1caa5f 09/28/2012 08:40 pm Paolo Bonzini

iostatus: reorganize io error code

Move the common part of IDE/SCSI/virtio error handling to the block
layer. The new function bdrv_error_action subsumes all three of
bdrv_emit_qmp_error_event, vm_stop, bdrv_iostatus_set_err.

The same scheme will be used for errors in block jobs....

92aa5c6d 09/28/2012 08:40 pm Paolo Bonzini

iostatus: move BlockdevOnError declaration to QAPI

This will let block-stream reuse the enum. Places that used the enums
are renamed accordingly.

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

ff06f5f3 09/28/2012 08:14 pm Paolo Bonzini

iostatus: rename BlockErrorAction, BlockQMPEventAction

We want to remove knowledge of BLOCK_ERR_STOP_ENOSPC from drivers;
drivers should only be told whether to stop/report/ignore the error.
On the other hand, we want to keep using the nicer BlockErrorAction...

2f0c9fe6 09/28/2012 08:14 pm Paolo Bonzini

block: move job APIs to separate files

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

79fac568 09/28/2012 07:23 pm Jeff Cody

block: helper function, to find the base image of a chain

This is a simple helper function, that will return the base image
of a given image chain.

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

6ebdcee2 09/28/2012 07:22 pm Jeff Cody

block: add support functions for live commit, to find and delete images.

Add bdrv_find_overlay(), and bdrv_drop_intermediate().

bdrv_find_overlay(): given 'bs' and the active (topmost) BDS of an image chain,
find the image that is the immediate top of 'bs'...

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

block: correctly set the keep_read_only flag

I believe the bs->keep_read_only flag is supposed to reflect
the initial open state of the device. If the device is initially
opened R/O, then commit operations, or reopen operations changing
to R/W, are prohibited....

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

block: Framework for reopening files safely

This is based on Supriya Kannery's bdrv_reopen() patch series.

This provides a transactional method to reopen multiple
images files safely.

Image files are queue for reopen via bdrv_reopen_queue(), and the
reopen occurs when bdrv_reopen_multiple() is called. Changes are...

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

f198fd1c 08/03/2012 04:10 pm Benoît Canet

block: create bdrv_get_backing_file_depth()

Create bdrv_get_backing_file_depth() in order to be able to show
in QMP and HMP how many ancestors backing an image a block device
have.

Signed-off-by: Benoit Canet <>
Reviewed-by: Eric Blake <>...

31e404f4 07/17/2012 05:48 pm Markus Armbruster

hw/block-common: Move BlockConf & friends from block.h

This stuff doesn't belong to block layer, and was put there only
because a better home didn't exist then. Now it does.

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

2b584959 07/17/2012 05:48 pm Markus Armbruster

block: Geometry and translation hints are now useless, purge them

There are two producers of these hints: drive_init() on behalf of
-drive, and hd_geometry_guess().

The only consumer of the hint is hd_geometry_guess().

The callers of hd_geometry_guess() call it only when drive_init()...

9db1c0f7 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Move disk geometry guessing back from block.c

Commit f3d54fc4 factored it out of hw/ide.c for reuse. Sensible,
except it was put into block.c. Device-specific functionality should
be kept in device code, not the block layer. Move it to
hw/hd-geometry.c, and make stylistic changes required to keep...

8a4bc5aa 07/17/2012 05:48 pm Markus Armbruster

qdev: Introduce block geometry properties

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

61a8d649 07/17/2012 05:48 pm Markus Armbruster

fdc: Move floppy geometry guessing back from block.c

Commit 5bbdbb46 moved it to block.c because "other geometry guessing
functions already reside in block.c". Device-specific functionality
should be kept in device code, not the block layer. Move it back....

07d27a44 07/09/2012 06:21 pm Markus Armbruster

block: Factor bdrv_read_unthrottled() out of guess_disk_lchs()

To prepare move of guess_disk_lchs() into hw/, where it poking
BlockDriverState member io_limits_enabled directly would be unclean.

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

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

4ddc07ca 07/09/2012 04:53 pm Paolo Bonzini

block: introduce bdrv_swap, implement bdrv_append on top of it

The new function can be made a bit nicer than bdrv_append. It swaps the
whole contents, and then swaps back (using the usual t=a;a=b;b=t idiom)
the fields that need to stay on top. Thus, it does not need explicit...

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

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

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

ccf34716 06/15/2012 03:03 pm Kevin Wolf

qemu-img check: Print fixed clusters and recheck

When any inconsistencies have been fixed, print the statistics and run
another check to make sure everything is correct now.

Signed-off-by: Kevin Wolf <>

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

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

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

block: Add new BDRV_O_INCOMING flag to notice incoming live migration

From original patch with Patchwork-id: 31110 by
Stefan Hajnoczi <>

"Add a flag to indicate that incoming migration is pending and care needs
to be taken for data consistency. Block drivers should not modify the...

64c79160 04/05/2012 03:54 pm Dong Xu Wang

qemu-img: add dirty flag status

Some block drivers can verify their image files are clean or not. So we can show
it while using "qemu-img info".

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

1fc86bf9 04/05/2012 03:54 pm Stefan Hajnoczi

block: enforce constraints on block size properties

Nicolae Mogoreanu <> noticed that I/O requests can lead
to QEMU crashes when the logical_block_size property is smaller than 512
bytes.

Using the new "blocksize" property we can properly enforce constraints...

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

qemu-img: add image fragmentation statistics

Discussion can be found at:
http://patchwork.ozlabs.org/patch/128730/

This patch add image fragmentation statistics while using qemu-img check.

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

85e8dab1 04/05/2012 03:54 pm Paolo Bonzini

aio: move BlockDriverAIOCB to qemu-aio.h

And remove several block_int.h inclusions that should not be there.

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

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

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

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

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

c2c9a466 12/15/2011 01:40 pm Kevin Wolf

qcow2: Allow >4 GB VM state

This is a compatible extension to the snapshot header format that allows
saving a 64 bit VM state size.

Signed-off-by: Kevin Wolf <>

e7d81004 12/14/2011 01:09 pm Stefan Weil

Fix spelling in comments, documentation and messages

accidently->accidentally
annother->another
choosen->chosen
consideres->considers
decriptor->descriptor
developement->development
paramter->parameter
preceed->precede
preceeding->preceding
priviledge->privilege...

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

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

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

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

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

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

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

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

28a7282a 10/11/2011 10:41 am Luiz Capitulino

block: Keep track of devices' I/O status

This commit adds support to the BlockDriverState type to keep track
of devices' I/O status.

There are three possible status: BDRV_IOS_OK (no error), BDRV_IOS_ENOSPC
(no space error) and BDRV_IOS_FAILED (any other error). The distinction...

7b6f9300 09/12/2011 04:17 pm Markus Armbruster

block: New bdrv_set_buffer_alignment()

Device models should be able to set it without an unclean include of
block_int.h.

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

7d4b4ba5 09/12/2011 04:17 pm Markus Armbruster

block: New change_media_cb() parameter load

To let device models distinguish between eject and load.

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

2c6942fa 09/12/2011 04:17 pm Markus Armbruster

block: Clean up remaining users of "removable"

BlockDriverState member removable is a confused mess. It is true when
an ide-cd, scsi-cd or floppy qdev is attached, or when the
BlockDriverState was created with -drive if={floppy,sd} or -drive
if={ide,scsi,xen,none},media=cdrom ("created removable"), except when...

9e6a4c91 09/12/2011 04:17 pm Markus Armbruster

block: Drop BlockDriverState member removable

It's a confused mess (see previous commit). No users remain.

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

e4def80b 09/12/2011 04:17 pm Markus Armbruster

block: Show whether the virtual tray is open in info block

Need to ask the device, so this requires new BlockDevOps member
is_tray_open().

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

d1a0739d 09/12/2011 04:17 pm Markus Armbruster

block: Move BlockConf & friends from block_int.h to block.h

It's convenience stuff for block device models, so block.h isn't the
ideal home either, but better than block_int.h.

Permits moving some #include "block_int.h" from device model .h into
.c.

Signed-off-by: Markus Armbruster <>...

fdec4404 09/12/2011 04:17 pm Markus Armbruster

block: Leave enforcing tray lock to device models

The device model knows best when to accept the guest's eject command.
No need to detour through the block layer.

bdrv_eject() can't fail anymore. Make it void.

Signed-off-by: Markus Armbruster <>...

f107639a 09/12/2011 04:17 pm Markus Armbruster

block: Drop medium lock tracking, ask device models instead

Requires new BlockDevOps member is_medium_locked(). Implement for IDE
and SCSI CD-ROMs.

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

025e849a 09/12/2011 04:17 pm Markus Armbruster

block: Rename bdrv_set_locked() to bdrv_lock_medium()

While there, make the locked parameter bool.

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

ba5b7ad4 09/06/2011 12:24 pm Markus Armbruster

block: Declare qemu_blockalign() in block.h, not block_int.h

Device models should be able to use it without an unclean include of
block_int.h.

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

fa879d62 09/06/2011 12:23 pm Markus Armbruster

block: Attach non-qdev devices as well

For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()...

0e49de52 09/06/2011 12:23 pm Markus Armbruster

block: Generalize change_cb() to BlockDevOps

So we can more easily add device model callbacks.

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

145feb17 09/06/2011 12:23 pm Markus Armbruster

block: Split change_cb() into change_media_cb(), resize_cb()

Multiplexing callbacks complicates matters needlessly.

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

c488c7f6 08/26/2011 07:18 pm Christoph Hellwig

block: latency accounting

Account the total latency for read/write/flush requests. This allows
management tools to average it based on a snapshot of the nr ops
counters and allow checking for SLAs or provide statistics.

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

a597e79c 08/25/2011 07:18 pm Christoph Hellwig

block: explicit I/O accounting

Decouple the I/O accounting from bdrv_aio_readv/writev/flush and
make the hardware models call directly into the accounting helpers.

This means:
- we do not count internal requests from image formats in addition
to guest originating I/O...

c3993cdc 08/23/2011 03:15 pm Stefan Hajnoczi

block: parse cache mode flags in a single place

This patch introduces bdrv_parse_cache_flags() which sets open flags
given a cache mode. Previously this was duplicated in blockdev.c and
qemu-img.c.

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

da1fa91d 08/02/2011 04:53 pm Kevin Wolf

block: Add bdrv_co_readv/writev

Add new block driver callbacks bdrv_co_readv/writev, which work on a
QEMUIOVector like bdrv_aio_*, but don't need a callback. The function may only
be called inside a coroutine, so a block driver implementing this interface can...

5bf3f8e4 08/01/2011 01:10 pm Frediano Ziglio

block: Removed unused function bdrv_write_sync

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Kevin Wolf <>

4a1d5e1f 07/19/2011 04:39 pm Fam Zheng

block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with...

39aa9a12 06/15/2011 03:36 pm Devin Nakamura

Replaced tabs with spaces in block.h and block_int.h

Signed-off-by: Devin Nakamura <>
Signed-off-by: Kevin Wolf <>

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

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:

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

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

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

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

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

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

ceb25e5c 09/08/2010 01:39 pm Kevin Wolf

block: Fix BDRV_O_CACHE_MASK

BDRV_O_CACHE_MASK should have been extended when cache=unsafe introduced a new
flag BDRV_O_NO_FLUSH. There are currently no users that would change their
behaviour because of this, but let's clean it up before things break.

Signed-off-by: Kevin Wolf <>

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

Fix by copying BDRV_O_SNAPSHOT flag.

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

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

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

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

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

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