[Qemu-devel] [PATCH v3 00/16] block/mirror: Add active-sync mirroring

Max Reitz posted 16 patches 7 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180228180507.3964-1-mreitz@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x passed
There is a newer version of this series
qapi/block-core.json         |  29 ++-
include/block/block_int.h    |   6 +-
include/block/dirty-bitmap.h |   2 +
include/qemu/hbitmap.h       |   5 +-
block.c                      |  44 +++-
block/backup.c               |   2 +-
block/dirty-bitmap.c         |  57 +++-
block/io.c                   |  59 ++++-
block/mirror.c               | 605 ++++++++++++++++++++++++++++++++++---------
blockdev.c                   |   9 +-
tests/test-bdrv-drain.c      | 165 ++++++++++++
tests/test-hbitmap.c         |  38 ++-
util/hbitmap.c               |  10 +-
tests/qemu-iotests/151       | 120 +++++++++
tests/qemu-iotests/151.out   |   5 +
tests/qemu-iotests/group     |   1 +
16 files changed, 995 insertions(+), 162 deletions(-)
create mode 100755 tests/qemu-iotests/151
create mode 100644 tests/qemu-iotests/151.out
[Qemu-devel] [PATCH v3 00/16] block/mirror: Add active-sync mirroring
Posted by Max Reitz 7 years, 7 months ago
This series implements an active and synchronous mirroring mode.

Currently, the mirror block job is passive an asynchronous: Depending on
your start conditions, some part of the source disk starts as "dirty".
Then, the block job will (as a background operation) continuously copy
dirty parts to the target disk until all of the source disk is clean.
In the meantime, any write to the source disk dirties the affected area.

One effect of this operational mode is that the job may never converge:
If the writes to the source happen faster than the block job copies data
to the target, the job can never finish.

When the active mode implemented in this series is enabled, every write
request to the source will automatically trigger a synchronous write to
the target right afterwards.  Therefore, the source can never get dirty
faster than data is copied to the target.  Most importantly, once source
and target are in sync (BLOCK_JOB_READY is emitted), they will not
diverge (unless e.g. an I/O error occurs).

Active mirroring also improves on a second issue of the passive mode: We
do not have to read data from the source in order to write it to the
target.  When new data is written to the source in active mode, it is
automatically mirrored to the target, which saves us the superfluous
read from the source.


Things to do on top of this series:
- Allow switching between active and passive mode at runtime: Mainly
  hinges on the question of how to expose it to the user (ideally
  through a generic block-job-set-option command)

- Implement an asynchronous active mode (launch both write operations to
  the source and the target at the same time, and do not wait for the
  target operation to finish)

- Integrate the mirror BDS more tightly into the BDS graph:  Both source
  and target should be BdrvChildren (and the source should not be the
  "backing" child).  I'm working on this in a follow-up.

- Improve the mirror job coroutine use: Currently more of a hack, a
  follow-up will make this nicer.

- Add read-write-blocking mode: This series adds the write-blocking
  mode, where every write blocks until the data has been mirrored to the
  target.  read-write-blocking would also mirror data on reads from the
  source, which saves some performance (because that data does not have
  to be read twice) at the cost of latency on mirroring read operations.
  (Will be in the same follow-up.)


v3: [Fam]
- Patch 5: Drop shadowing ret declaration
- Patch 11: Added
- Patch 12: Add comment on how @iter is modified by
            bdrv_dirty_iter_next_area()
- Patch 14:
  - Squashed old patch 12 into this one
  - Don't forget write_zeroes and discard
- Patch 15: %s/passive/background/
- Patch 16: Write some zeroes so we can see those are actively copied,
            too (i.e. test the changes to patch 14 from v2)


git-backport-diff to v2:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/16:[----] [--] 'block: BDS deletion during bdrv_drain_recurse'
002/16:[----] [--] 'block: BDS deletion in bdrv_do_drained_begin()'
003/16:[----] [--] 'tests: Add bdrv-drain test for node deletion'
004/16:[----] [--] 'block/mirror: Pull out mirror_perform()'
005/16:[0002] [FC] 'block/mirror: Convert to coroutines'
006/16:[----] [--] 'block/mirror: Use CoQueue to wait on in-flight ops'
007/16:[----] [--] 'block/mirror: Wait for in-flight op conflicts'
008/16:[----] [--] 'block/mirror: Use source as a BdrvChild'
009/16:[----] [--] 'block: Generalize should_update_child() rule'
010/16:[----] [--] 'hbitmap: Add @advance param to hbitmap_iter_next()'
011/16:[down] 'test-hbitmap: Add non-advancing iter_next tests'
012/16:[0004] [FC] 'block/dirty-bitmap: Add bdrv_dirty_iter_next_area'
013/16:[----] [--] 'block/mirror: Add MirrorBDSOpaque'
014/16:[0114] [FC] 'block/mirror: Add active mirroring'
015/16:[0004] [FC] 'block/mirror: Add copy mode QAPI interface'
016/16:[0014] [FC] 'iotests: Add test for active mirroring'


Max Reitz (16):
  block: BDS deletion during bdrv_drain_recurse
  block: BDS deletion in bdrv_do_drained_begin()
  tests: Add bdrv-drain test for node deletion
  block/mirror: Pull out mirror_perform()
  block/mirror: Convert to coroutines
  block/mirror: Use CoQueue to wait on in-flight ops
  block/mirror: Wait for in-flight op conflicts
  block/mirror: Use source as a BdrvChild
  block: Generalize should_update_child() rule
  hbitmap: Add @advance param to hbitmap_iter_next()
  test-hbitmap: Add non-advancing iter_next tests
  block/dirty-bitmap: Add bdrv_dirty_iter_next_area
  block/mirror: Add MirrorBDSOpaque
  block/mirror: Add active mirroring
  block/mirror: Add copy mode QAPI interface
  iotests: Add test for active mirroring

 qapi/block-core.json         |  29 ++-
 include/block/block_int.h    |   6 +-
 include/block/dirty-bitmap.h |   2 +
 include/qemu/hbitmap.h       |   5 +-
 block.c                      |  44 +++-
 block/backup.c               |   2 +-
 block/dirty-bitmap.c         |  57 +++-
 block/io.c                   |  59 ++++-
 block/mirror.c               | 605 ++++++++++++++++++++++++++++++++++---------
 blockdev.c                   |   9 +-
 tests/test-bdrv-drain.c      | 165 ++++++++++++
 tests/test-hbitmap.c         |  38 ++-
 util/hbitmap.c               |  10 +-
 tests/qemu-iotests/151       | 120 +++++++++
 tests/qemu-iotests/151.out   |   5 +
 tests/qemu-iotests/group     |   1 +
 16 files changed, 995 insertions(+), 162 deletions(-)
 create mode 100755 tests/qemu-iotests/151
 create mode 100644 tests/qemu-iotests/151.out

-- 
2.14.3


Re: [Qemu-devel] [PATCH v3 00/16] block/mirror: Add active-sync mirroring
Posted by no-reply@patchew.org 7 years, 7 months ago
Hi,

This series failed docker-build@min-glib build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 20180228180507.3964-1-mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v3 00/16] block/mirror: Add active-sync mirroring

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-build@min-glib
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
error: Could not fetch 3c8cf5a9c21ff8782164d1def7f44bd888713384
Traceback (most recent call last):
  File "/usr/bin/patchew", line 442, in test_one
    git_clone_repo(clone, r["repo"], r["head"], logf)
  File "/usr/bin/patchew", line 48, in git_clone_repo
    stdout=logf, stderr=logf)
  File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'remote', 'add', '-f', '--mirror=fetch', '3c8cf5a9c21ff8782164d1def7f44bd888713384', 'https://github.com/patchew-project/qemu']' returned non-zero exit status 1.



---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PATCH v3 00/16] block/mirror: Add active-sync mirroring
Posted by Fam Zheng 7 years, 7 months ago
On Wed, 02/28 19:04, Max Reitz wrote:
> v3: [Fam]
> - Patch 5: Drop shadowing ret declaration
> - Patch 11: Added
> - Patch 12: Add comment on how @iter is modified by
>             bdrv_dirty_iter_next_area()
> - Patch 14:
>   - Squashed old patch 12 into this one
>   - Don't forget write_zeroes and discard
> - Patch 15: %s/passive/background/
> - Patch 16: Write some zeroes so we can see those are actively copied,
>             too (i.e. test the changes to patch 14 from v2)

Reviewed-by: Fam Zheng <famz@redhat.com>