Statistics
| Branch: | Revision:

root / block / stream.c @ feature-archipelago

History | View | Annotate | Download (7 kB)

# Date Author Comment
355ef4ac 01/24/2014 06:40 pm Kevin Wolf

block: Update BlockLimits when they might have changed

When reopening with different flags, or when backing files disappear
from the chain, the limits may change. Make sure they get updated in
these cases.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Wenchao Xia <>...

f4a193e7 11/28/2013 12:39 pm Max Reitz

block/stream: Don't stream unbacked devices

If a block device is unbacked, a streaming blockjob should immediately
finish instead of beginning to try to stream, then noticing the backing
file does not contain even the first sector (since it does not exist)...

3fc4b10a 10/11/2013 11:52 am Fam Zheng

blockjob: rename BlockJobType to BlockJobDriver

We will use BlockJobType as the enum type name of block jobs in QAPI,
rename current BlockJobType to BlockJobDriver, which will eventually
become a set of operations, similar to block drivers.

Signed-off-by: Fam Zheng <>...

79e14bf7 10/11/2013 11:52 am Fam Zheng

qapi: make use of new BlockJobType

Switch the string to enum type BlockJobType in BlockJobDriver.

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

c3e4f43a 09/25/2013 05:21 pm Stefan Weil

block: Fix compiler warning (-Werror=uninitialized)

The patch fixes a warning from gcc (Debian 4.6.3-14+rpi1) 4.6.3:

block/stream.c:141:22: error:
‘copy’ may be used uninitialized in this function [-Werror=uninitialized]

This is not a real bug - a better compiler would not complain....

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

block: remove bdrv_is_allocated_above/bdrv_co_is_allocated_above distinction

Now that bdrv_is_allocated detects coroutine context, the two can
use the same code.

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

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

block: expect errors from bdrv_co_is_allocated

Some bdrv_is_allocated callers do not expect errors, but the fallback
in qcow2.c might make other callers trip on assertion failures or
infinite loops.

Fix the callers to always look for errors.

Cc: ...

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

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

block: make bdrv_co_is_allocated static

bdrv_is_allocated can detect coroutine context and go through a fast
path, similar to other block layer functions.

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

7483d1e5 08/22/2013 08:14 pm Alex Bligh

aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API

Convert block_job_sleep_ns and co_sleep_ns to use the new timer
API.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

88266f5a 08/19/2013 04:45 pm Stefan Hajnoczi

block: stop relying on io_flush() in bdrv_drain_all()

If a block driver has no file descriptors to monitor but there are still
active requests, it can return 1 from .io_flush(). This is used to spin
during synchronous I/O.

Stop relying on .io_flush() and instead check...

f59fee8d 06/28/2013 10:20 am Kevin Wolf

block: Make BlockJobTypes const

Signed-off-by: Kevin Wolf <>

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

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

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

aio: Get rid of qemu_aio_flush()

There are no remaining users, and new users should probably be
using bdrv_drain_all() in the first place.

Signed-off-by: Kevin Wolf <>

65f46322 10/24/2012 11:26 am Paolo Bonzini

block: rename block_job_complete to block_job_completed

The imperative will be used for the QMP command.

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

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

stream: add on-error argument

This patch adds support for error management to streaming.

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

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

571cd9dc 08/29/2012 04:23 pm Stefan Hajnoczi

stream: complete early if end of backing file is reached

It is possible to create an image that is larger than its backing file.
Reading beyond the end of the backing file produces zeroes if no writes
have been made to those sectors in the image file.

This patch finishes streaming early when the end of the backing file is...

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

stream: tweak usage of bdrv_co_is_allocated

is_allocated_base has complex semantics that are not really usable
outside streaming. Split the check in two parts, where the allocated
state for the top bs is moved to the caller. The resulting function
is more generally useful....

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

6ef228fc 06/15/2012 03:03 pm Paolo Bonzini

stream: move rate limiting to a separate header file

Make the code reusable.

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

04120e3b 05/10/2012 05:10 pm Anthony Liguori

block: fix warning introduced in efcc7a23

Signed-off-by: Anthony Liguori <>

f6133def 05/10/2012 12:01 pm Paolo Bonzini

stream: pass new base image format to bdrv_change_backing_file

When an image is modified to point to the new backing file, the backing
file format is set to NULL, which means auto-probe. This is wrong, in
fact it is a small security problem.

Reviewed-by: Kevin Wolf <>...

b21d677e 05/10/2012 12:01 pm Paolo Bonzini

stream: fix ratelimiting corner case

This fixes inability to make progress in streaming if the quota is set
to less than the amount of data that an I/O operation has to write.

In this case, limit->dispatched + n will always be above the quota and,
due to the "goto retry" to recheck cancellation and allocation, streaming...

efcc7a23 05/10/2012 12:01 pm Paolo Bonzini

stream: do not copy unallocated sectors from the base

Unallocated sectors should really never be accessed by the guest,
so there's no need to copy them during the streaming process.
If they are read by the guest during streaming, guest-initiated
copy-on-read will copy them (we're in the base == NULL case, which...

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

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

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

5a67a104 04/05/2012 04:11 pm Marcelo Tosatti

block stream: close unused files and update ->backing_hd

Close the now unused images that were part of the previous backing file
chain and adjust ->backing_hd, backing_filename and backing_format
properly.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=801449...

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

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

block: add support for partial streaming

Add support for streaming data from an intermediate section of the
image chain (see patch and documentation for details).

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

4f1043b4 01/26/2012 12:45 pm Stefan Hajnoczi

block: add image streaming block job

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

5094a6c0 01/26/2012 12:45 pm Stefan Hajnoczi

block: rate-limit streaming operations

This patch implements rate-limiting for image streaming. If we've
exceeded the bandwidth quota for a 100 ms time slice we sleep the
coroutine until the next slice begins.

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