Statistics
| Branch: | Revision:

root / block / mirror.c @ feature-archipelago

History | View | Annotate | Download (22.4 kB)

# Date Author Comment
cc67f4d1 02/14/2014 07:05 pm Jeff Cody

block: mirror - use local_err to avoid NULL errp

When starting a block job, commit_active_start() relies on whether *errp
is set by mirror_start_job. This allows it to determine if the mirror
job start failed, so that it can clean up any changes to open flags from...

39a611a3 02/14/2014 07:05 pm Jeff Cody

block: Don't throw away errno via error_setg

There are a handful of places in the block layer where a failure path
has a valid -errno value, yet error_setg() is used. Those instances
should instead use error_setg_errno(), to preserve as much error
information as possible....

4da83585 01/24/2014 05:12 pm Jeff Cody

block: resize backing image during active layer commit, if needed

If the top image to commit is the active layer, and also larger than
the base image, then an I/O error will likely be returned during
block-commit.

For instance, if we have a base image with a virtual size 10G, and a...

6df3bf8e 01/24/2014 03:33 pm Zhang Min

drive mirror:fix memory leak

In the function mirror_iteration() > qemu_iovec_init(),
it allocates memory for op
>qiov.iov, when the write request calls back,
but in the function mirror_iteration_done(), it only frees the op,
not free the op->qiov.iov, so this causes memory leak....

f95c625c 12/20/2013 05:26 pm Fam Zheng

mirror: Don't close target

Let reference count manage target and don't call bdrv_close here.

Signed-off-by: Fam Zheng <>
Reviewed-by: Kevin Wolf <>
Signed-off-by: Stefan Hajnoczi <>

5bc361b8 12/20/2013 05:26 pm Fam Zheng

mirror: Move base to MirrorBlockJob

This allows setting the base before entering mirror_run, commit will
make use of it.

Signed-off-by: Fam Zheng <>
Reviewed-by: Kevin Wolf <>
Signed-off-by: Stefan Hajnoczi <>

03544a6e 12/20/2013 05:26 pm Fam Zheng

block: Add commit_active_start()

commit_active_start is implemented in block/mirror.c, It will create a
job with "commit" type and designated base in block-commit command. This
will be used for committing active layer of device.

Sync mode is removed from MirrorBlockJob because there's no proper type...

20a63d2c 12/20/2013 05:26 pm Fam Zheng

commit: Support commit active layer

If active is top, it will be mirrored to base, (with block/mirror.c
code), then the image is switched when user completes the block job.

QMP documentation is updated.

Signed-off-by: Fam Zheng <>
Signed-off-by: Stefan Hajnoczi <>

e4654d2d 11/29/2013 02:40 pm Fam Zheng

block: per caller dirty bitmap

Previously a BlockDriverState has only one dirty bitmap, so only one
caller (e.g. a block job) can keep track of writing. This changes the
dirty bitmap to a list and creates a BdrvDirtyBitmap for each caller, the
lifecycle is managed with these new functions:...

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

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

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

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

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

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

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

block: Make BlockJobTypes const

Signed-off-by: Kevin Wolf <>

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

block: mirror_complete(): use error_setg_file_open()

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

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

402a4741 01/25/2013 07:18 pm Paolo Bonzini

mirror: support more than one in-flight AIO operation

With AIO support in place, we can start copying more than one chunk
in parallel. This patch introduces the required infrastructure for
this: the buffer is split into multiple granularity-sized chunks,...

884fea4e 01/25/2013 07:18 pm Paolo Bonzini

mirror: support arbitrarily-sized iterations

Yet another optimization is to extend the mirroring iteration to include more
adjacent dirty blocks. This limits the number of I/O operations and makes
mirroring efficient even with a small granularity. Most of the infrastructure...

88ff0e48 01/25/2013 07:18 pm Paolo Bonzini

mirror: do nothing on zero-sized disk

On a zero-sized disk we need to break out of the job successfully
before bdrv_dirty_iter_init is called, otherwise you will get an
assertion failure with the next patch.

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

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

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

mirror: allow customizing the granularity

The desired granularity may be very different depending on the kind of
operation (e.g. continuous replication vs. collapse-to-raw) and whether
the VM is expected to perform lots of I/O while mirroring is in progress....

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

mirror: switch mirror_iteration to AIO

There is really no change in the behavior of the job here, since
there is still a maximum of one in-flight I/O operation between
the source and the target. However, this patch already introduces
the AIO callbacks (which are unmodified in the next patch)...

08e4ed6c 01/25/2013 07:18 pm Paolo Bonzini

mirror: add buf-size argument to drive-mirror

This makes sense when the next commit starts using the extra buffer space
to perform many I/O operations asynchronously.

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

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

mirror: perform COW if the cluster size is bigger than the granularity

When mirroring runs, the backing files for the target may not yet be
ready. However, this means that a copy-on-write operation on the target
would fill the missing sectors with zeros. Copy-on-write only happens...

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

7191bf31 01/15/2013 06:28 pm Markus Armbruster

block: Fix how mirror_run() frees its buffer

It allocates with qemu_blockalign(), therefore it must free with
qemu_vfree(), not g_free().

Signed-off-by: Markus Armbruster <>
Signed-off-by: Stefan Hajnoczi <>

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

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

mirror: implement completion

Switching to the target of the migration is done mostly asynchronously,
and reported to management via the BLOCK_JOB_COMPLETED event; the only
synchronous phase is opening the backing files. bdrv_open_backing_file
can always be done, even for migration of the full image (aka sync:...

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

mirror: add support for on-source-error/on-target-error

Error management is important for mirroring; otherwise, an error on the
target (even something as "innocent" as ENOSPC) requires to start again
with a full copy. Similar to on_read_error/on_write_error, two separate...

893f7eba 10/24/2012 11:26 am Paolo Bonzini

mirror: introduce mirror job

This patch adds the implementation of a new job that mirrors a disk to
a new image while letting the guest continue using the old image.
The target is treated as a "black box" and data is copied from the
source to the target in the background. This can be used for several...