Statistics
| Branch: | Revision:

root / block.c @ a8aec295

History | View | Annotate | Download (125.6 kB)

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

d616b224 06/28/2013 10:20 am Stefan Hajnoczi

block: add bdrv_add_before_write_notifier()

The bdrv_add_before_write_notifier() function installs a callback that
is invoked before a write request is processed. This will be used to
implement copy-on-write point-in-time snapshots where we need to copy...

50b05b6f 06/24/2013 11:25 am Kevin Wolf

block: Always enable discard on the protocol level

Turning on discard options in qcow2 doesn't help a lot when the discard
requests that it issues are thrown away by the raw-posix layer. This
patch always enables discard functionality on the protocol level so that...

d8b6895f 06/17/2013 06:01 pm Luiz Capitulino

block: bdrv_reopen_prepare(): don't use QERR_OPEN_FILE_FAILED

The call to drv->bdrv_reopen_prepare() can fail due to reasons
other than an open failure. Unfortunately, we can't use errno
nor -ret, cause they are not always set.

Stick to a generic error message then....

bf736fe3 06/06/2013 12:27 pm Kevin Wolf

blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events

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

de08c606 06/04/2013 02:56 pm Wenchao Xia

block: move snapshot code in block.c to block/snapshot.c

All snapshot related code, except bdrv_snapshot_dump() and
bdrv_is_snapshot(), is moved to block/snapshot.c. bdrv_snapshot_dump()
will be moved to another file later. bdrv_is_snapshot() is not related...

f364ec65 06/04/2013 02:56 pm Wenchao Xia

block: move qmp and info dump related code to block/qapi.c

This patch is a pure code move patch, except following modification:
1 get_human_readable_size() is changed to static function.
2 dump_human_image_info() is renamed to bdrv_image_info_dump().
3 in qmp_query_block() and qmp_query_blockstats, use bdrv_next(bs)...

29d78271 06/04/2013 02:56 pm Stefan Hajnoczi

block: drop bs_snapshots global variable

The bs_snapshots global variable points to the BlockDriverState which
will be used to save vmstate. This is really a savevm.c concept but was
moved into block.c:bdrv_snapshots() when it became clear that hotplug
could result in a dangling pointer....

b64ec4e4 06/04/2013 01:11 pm Fam Zheng

block: add block driver read only whitelist

We may want to include a driver in the whitelist for read only tasks
such as diagnosing or exporting guest data (with libguestfs as a good
example). This patch introduces a readonly whitelist option, and for
backward compatibility, the old configure option --block-drv-whitelist...

f3f4d2c0 05/14/2013 05:44 pm Kevin Wolf

block: Add hint to -EFBIG error message

The limit of qcow2 files at least depends on the cluster size. If the
image format has a cluster_size option, suggest to increase it.

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

45673671 04/22/2013 07:31 pm Kevin Wolf

block: Fix build with tracing enabled

filename was still uninitialised when it's used as a parameter to a
tracing function, so let's move the initialisation. Also, commit c2ad1b0c
forgot to add a NULL check, which this patch adds while we're at it.

Signed-off-by: Kevin Wolf <>...

1cb6f506 04/22/2013 12:37 pm Kevin Wolf

block: Allow overriding backing.file.filename

If a filename is passed in the driver-specific options from the command
line, the backing file path from the image is ignored now.

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

56d1b4d2 04/22/2013 12:34 pm Kevin Wolf

block: Remove filename parameter from .bdrv_file_open()

It is unused now in all block drivers.

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

2af5ef70 04/22/2013 11:27 am Kevin Wolf

block: Fail gracefully when using a format driver on protocol level

Specifying the wrong driver could fail an assertion:

$ qemu-system-x86_64 -drive file.driver=qcow2,file=x
qemu-system-x86_64: block.c:721: bdrv_open_common: Assertion `file !=
((void *)0)' failed....

31ca6d07 04/22/2013 11:27 am Kevin Wolf

block: Add driver-specific options for backing files

Options starting in "backing." are passed to the backing file now. If
you don't need to specify the filename for the backing file, you can add
it on the command line instead of in the image file:

$ qemu-nbd -t /tmp/test.img...

035fccdf 04/22/2013 11:27 am Kevin Wolf

block: Enable filename option

This allows using the file.filename option instead of the string that
comes from -drive file=... and is passed around as a separate parameter.
The goal is to get rid of this parameter and use the options QDict more
consistently....

cf8074b3 04/15/2013 09:26 am Kevin Wolf

block: Introduce bdrv_writev_vmstate

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

8d3b1a2d 04/15/2013 09:26 am Kevin Wolf

block: Introduce bdrv_pwritev() for qcow2_save_vmstate

Directly pass the QEMUIOVector on instead of linearising it.

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

5905fbc9 04/05/2013 07:58 pm Stefan Hajnoczi

block: fix I/O throttling accounting blind spot

I/O throttling relies on bdrv_acct_done() which is called when a request
completes. This leaves a blind spot since we only charge for completed
requests, not submitted requests.

For example, if there is 1 operation remaining in this time slice the...

ae29d6c6 04/05/2013 07:58 pm Stefan Hajnoczi

block: keep I/O throttling slice time constant

It is not necessary to adjust the slice time at runtime. We already
extend the current slice in order to carry over accounting into the next
slice. Changing the actual slice time value introduces oscillations....

e660fb8b 04/05/2013 07:58 pm Stefan Hajnoczi

block: drop duplicated slice extension code

The current slice is extended when an I/O request exceeds the limit.
There is no need to extend the slice every time we check a request.

Signed-off-by: Stefan Hajnoczi <>
Tested-By: Benoit Canet <>...

0775437f 04/05/2013 07:58 pm Stefan Hajnoczi

block: clean up I/O throttling wait_time code

The wait_time variable is in seconds. Reflect this in a comment and use
NANOSECONDS_PER_SECOND instead of BLOCK_IO_SLICE_TIME * 10 (which
happens to have the right value).

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

5d186eb0 03/28/2013 12:58 pm Kevin Wolf

block: Fix direct use of protocols as driver for bdrv_open()

bdrv_open_common() implements direct use of protocols by copying the
pre-opened BlockDriverStates to bs using bdrv_swap(). It did however
first set some fields in bs, which end up in file after the swap. When...

6963a30d 03/22/2013 06:51 pm Kevin Wolf

block: Introduce .bdrv_parse_filename callback

If a driver needs structured data and not just a string, it can provide
a .bdrv_parse_filename callback now that parses the command line string
into separate options. Keeping this separate from .bdrv_open_filename...

08b392e1 03/22/2013 06:51 pm Kevin Wolf

block: Rename variable to avoid shadowing

bdrv_open() uses two different variables called options. Rename one of
them to avoid confusion and to allow the outer one to be accessed
everywhere.

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

c2ad1b0c 03/22/2013 06:51 pm Kevin Wolf

block: Allow omitting the file name when using driver-specific options

After this patch, using -drive with an empty file name continues to open
the file if driver-specific options are used. If no driver-specific
options are specified, the semantics stay as it was: It defines a drive...

5c916681 03/22/2013 06:51 pm Peter Lieven

Revert "block: complete all IOs before .bdrv_truncate"

brdv_truncate() is also called from readv/writev commands on self-
growing file based storage. this will result in requests waiting
for theirselves to complete.

This reverts commit 9a665b2b8640e464f0a778216fc2dca8d02acf33....

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

707ff828 03/22/2013 06:51 pm Kevin Wolf

block: Pass bdrv_file_open() options to block drivers

Specify -drive file.option=... on the command line to pass the option to
the protocol instead of the format driver.

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

4d70655b 03/19/2013 12:48 pm Stefan Hajnoczi

block: fix BDRV_O_SNAPSHOT protocol detection

realpath(3) is used to get an absolute path to the image file when
creating a -drive snapshot=on temporary qcow2. This does not work for
protocols since their filenames ("proto:foo:...") do not correspond to...

85d126f3 03/15/2013 05:07 pm Stefan Hajnoczi

block: add bdrv_get_aio_context()

For now bdrv_get_aio_context() is just a stub that calls
qemu_aio_get_context() since the block layer is currently tied to the
main loop AioContext.

Add the stub now so that the block layer can begin accessing its
AioContext....

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

de9c0cec 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to bdrv_open() prototype

It doesn't do anything yet except storing the options QDict in the
BlockDriverState.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Hajnoczi <>...

b6ad491a 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to bdrv_open_common()

The options are passed down to the block drivers, which are supposed to
remove all options they have processed. Anything that is left over in
the end is an unknown option and results in an error.

Signed-off-by: Kevin Wolf <>...

272d2d8e 03/04/2013 10:54 am Jeff Cody

block: for HMP commit() operations on 'all', skip non-COW drives

During a commit of 'all' using the HMP non-live commit, the operation
is aborted and returns error on the first error enountered. When
non-COW drives are in use (e.g. ejected floppy, cdrom, or drives without...

9e8f1835 02/22/2013 10:29 pm Paolo Bonzini

block: implement BDRV_O_UNMAP

It is better to present homogeneous hardware independent of the storage
technology that is chosen on the host, hence we make discard a host
parameter; the user can choose whether to pass it down to the image
format and protocol, or to ignore it....

9a665b2b 02/22/2013 10:21 pm Peter Lieven

block: complete all IOs before .bdrv_truncate

bdrv_truncate() invalidates the bdrv_check_request() result for
in-flight requests, so there should better be none.

Cc:
Signed-off-by: Peter Lieven <>
Reported-by: Kevin Wolf <>...

b35b2bba 02/22/2013 10:21 pm Miroslav Rezanina

block: Add synchronous wrapper for bdrv_co_is_allocated_above

There's no synchronous wrapper for bdrv_co_is_allocated_above function
so it's not possible to check for sector allocation in an image with
a backing file.

Signed-off-by: Miroslav Rezanina <>...

f382d43a 02/22/2013 10:21 pm Miroslav Rezanina

qemu-img: Add "Quiet mode" option

There can be a need to turn output to stdout off. This patch adds a -q option
that enable "Quiet mode". In Quiet mode, only errors are printed out.

Signed-off-by: Miroslav Rezanina <>
Reviewed-by: Kevin Wolf <>...

63ba17d3 02/01/2013 03:58 pm Vishvananda Ishaya

block: Fix is_allocated_above with resized files

In an image chain, if the base image is smaller than the current
image, we need to make sure to use the current images count of
unallocated blocks once we get to the end of the base image. Without
this change the code will return 0 blocks when it gets to the end...

50717e94 01/25/2013 07:18 pm Paolo Bonzini

block: allow customizing the granularity of the dirty bitmap

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

8f0720ec 01/25/2013 07:18 pm Paolo Bonzini

block: implement dirty bitmap using HBitmap

This actually uses the dirty bitmap in the block layer, and converts
mirroring to use an HBitmapIter.

Reviewed-by: Laszlo Ersek <> (except block/mirror.c parts)
Reviewed-by: Eric Blake <>...

343bded4 01/25/2013 07:18 pm Paolo Bonzini

block: make round_to_clusters public

This is needed in the following patch.

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

acc906c6 01/25/2013 07:18 pm Paolo Bonzini

block: return count of dirty sectors, not chunks

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

df702c9b 01/15/2013 11:03 am Paolo Bonzini

block: clear dirty bitmap when discarding

Note that resetting bits in the dirty bitmap is done before actually
processing the request. Writes, instead, set bits after the request
is completed.

This way, when there are concurrent write and discard requests, the...

029d091e 01/15/2013 10:24 am Peter Lieven

block: fix initialization in bdrv_io_limits_enable()

bdrv_io_limits_enable() starts a new slice, but does not set io_base
correctly for that slice.

Here is how io_base is used:

bytes_base  = bs->nr_bytes[is_write] - bs->io_base.bytes[is_write];
bytes_res = (unsigned) nb_sectors * BDRV_SECTOR_SIZE;...
8e895599 01/14/2013 11:06 am Paolo Bonzini

block: do not probe zero-sized disks

A blank CD or DVD is visible as a zero-sized disks. Probing such
disks will lead to an EIO and a failure to start the VM. Treating
them as raw is a better solution.

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

c53b1c51 01/14/2013 11:06 am Stefan Hajnoczi

block: make qiov_is_aligned() public

The qiov_is_aligned() function checks whether a QEMUIOVector meets a
BlockDriverState's alignment requirements. This is needed by
virtio-blk-data-plane so:

1. Move the function from block/raw-posix.c to block/block.c....

eb7ff6fb 01/11/2013 10:44 am Stefan Weil

Replace remaining gmtime, localtime by gmtime_r, localtime_r

This allows removing of MinGW specific code and improves
reentrancy for POSIX hosts.

[Removed unused ret variable in qemu_get_timedate() to fix warning:
vl.c: In function ‘qemu_get_timedate’:
vl.c:451:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]...

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

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

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

83c9089e 12/19/2012 09:31 am Paolo Bonzini

monitor: move include files to include/monitor/

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

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

41c695c7 12/12/2012 01:33 pm Kevin Wolf

qemu-io: Add AIO debugging commands

This makes the blkdebug suspend/resume functionality available in
qemu-io. Use it like this:

$ ./qemu-io blkdebug::/tmp/test.qcow2
qemu-io> break write_aio req_a
qemu-io> aio_write 0 4k
qemu-io> blkdebug: Suspended request 'req_a'...
71c79813 12/11/2012 12:05 pm Luiz Capitulino

block: bdrv_img_create(): add Error ** argument

This commit adds an Error ** argument to bdrv_img_create() and set it
appropriately on error.

Callers of bdrv_img_create() pass NULL for the new argument and still
rely on bdrv_img_create()'s return value. Next commits will change...

d92ada22 12/11/2012 12:05 pm Luiz Capitulino

block: bdrv_img_create(): drop unused error handling code

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

d318aea9 12/11/2012 12:04 pm Kevin Wolf

block: Improve bdrv_aio_co_cancel_em

Instead of waiting for all requests to complete, wait just for the
specific request that should be cancelled.

Signed-off-by: Kevin Wolf <>

7b272452 12/11/2012 12:04 pm Kevin Wolf

block: Factor out bdrv_open_flags

Signed-off-by: Kevin Wolf <>

f500a6d3 12/11/2012 12:04 pm Kevin Wolf

block: Avoid second open for format probing

This fixes problems that are caused by the additional open/close cycle
of the existing format probing, for example related to qemu-nbd without
-t option or file descriptor passing.

Signed-off-by: Kevin Wolf <>

89c9bc3d 11/24/2012 09:54 pm Stefan Weil

block: Fix regression for MinGW (assertion caused by short string)

The local string tmp_filename is passed to function get_tmp_filename
which expects a string with minimum size MAX_PATH for w32 hosts.

MAX_PATH is 260 and PATH_MAX is 259, so tmp_filename was too short....

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

aio: use g_slice_alloc() for AIOCB pooling

AIO control blocks are frequently acquired and released because each aio
request involves at least one AIOCB. Therefore, we pool them to avoid
heap allocation overhead.

The problem with the freelist approach in AIOPool is thread-safety. If...

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

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...
3bd293c3 10/24/2012 11:26 am Paolo Bonzini

iostatus: forward block_job_iostatus_reset to block job

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

80168bff 10/24/2012 11:26 am Luiz Capitulino

block: bdrv_create(): don't leak cco.filename on error

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

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

b9a9b3a4 10/24/2012 11:26 am Paolo Bonzini

block: export dirty bitmap information in query-block

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

b1b1d783 10/24/2012 11:26 am Jeff Cody

block: make bdrv_find_backing_image compare canonical filenames

Currently, bdrv_find_backing_image compares bs->backing_file with
what is passed in as a backing_file name. Mismatches may occur,
however, when bs->backing_file and backing_file are not both...

3cbc002c 10/23/2012 11:39 pm Paolo Bonzini

block: prepare code for adding block notifiers

There is no reason in principle to skip job cancellation and draining
of pending I/O when there is no medium in the disk. Do these unconditionally,
which also prepares the code for the next patch.

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

c2cba3d9 10/05/2012 03:58 pm Jim Meyering

block: avoid buffer overrun by using pstrcpy, not strncpy

Also, use PATH_MAX, rather than the arbitrary 1024.
Using PATH_MAX is more consistent with other filename-related
variables in this file, like backing_filename and tmp_filename.

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

32c81a4a 09/28/2012 08:40 pm Paolo Bonzini

block: introduce block job error

The following behaviors are possible:

'report': The behavior is the same as in 1.1. An I/O error,
respectively during a read or a write, will complete the job immediately
with an error code.

'ignore': An I/O error, respectively during a read or a write, will be...

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

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

block: remove keep_read_only flag from BlockDriverState struct

The keep_read_only flag is no longer used, in favor of the bdrv
flag BDRV_O_ALLOW_RDWR.

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

0bce597d 09/24/2012 04:15 pm Jeff Cody

block: convert bdrv_commit() to use bdrv_reopen()

Currently, bdrv_commit() reopens images r/w itself, via risky
_delete() and _open() calls. Use the new safe method for drive reopen.

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

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

55b110f2 09/24/2012 04:15 pm Jeff Cody

block: make bdrv_set_enable_write_cache() modify open_flags

bdrv_set_enable_write_cache() sets the bs->enable_write_cache flag,
but without the flag recorded in bs->open_flags, then next time
a reopen() is performed the enable_write_cache setting may be
inadvertently lost....

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

9ca11154 09/12/2012 04:50 pm Pavel Hrdina

block: fix block tray status

The tray status should change also if you eject empty block device.

Signed-off-by: Pavel Hrdina <>
Signed-off-by: Kevin Wolf <>

fe235a06 09/12/2012 04:50 pm Dunrong Huang

block: Don't forget to delete temporary file

The caller would not delete temporary file after failed get_tmp_filename().

Signed-off-by: Dunrong Huang <>
Signed-off-by: Kevin Wolf <>

d4c82329 08/15/2012 04:14 pm Kevin Wolf

block: Flush parent to OS with cache=unsafe

Commit 29cdb251 already added a comment that no unnecessary flushes to
disk will occur, this patch makes the code even get to the point of the
comment. This is mostly theoretical because in practice we only stack...

c75a1a8a 08/13/2012 07:20 pm Luiz Capitulino

qmp: query-block: add 'encryption_key_missing' field

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

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

block: Use bdrv_get_backing_file_depth()

Use the dedicated counting function in qmp_query_block in order to
propagate the backing file depth to HMP and add backing_file_depth
to qmp-commands.hx

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

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

0ed8b6f6 07/28/2012 12:23 pm Blue Swirl

Avoid returning void

It's silly and non-conforming to standards to return void,
don't do it.

Signed-off-by: Blue Swirl <>

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

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

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