diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2019-10-01 16:14:09 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-10-10 10:56:18 +0200 |
commit | 00e30f05de1d19586345ec373970ef4c192c6270 (patch) | |
tree | 5ac9d5f5464b9f6c8ff64a47495ce3e03a66afc4 /block/backup-top.c | |
parent | 7df7868b9640402c465eec93c8e0fa9fc2cf5744 (diff) |
block/backup: use backup-top instead of write notifiers
Drop write notifiers and use filter node instead.
= Changes =
1. Add filter-node-name argument for backup qmp api. We have to do it
in this commit, as 257 needs to be fixed.
2. There are no more write notifiers here, so is_write_notifier
parameter is dropped from block-copy paths.
3. To sync with in-flight requests at job finish we now have drained
removing of the filter, we don't need rw-lock.
4. Block-copy is now using BdrvChildren instead of BlockBackends
5. As backup-top owns these children, we also move block-copy state
into backup-top's ownership.
= Iotest changes =
56: op-blocker doesn't shoot now, as we set it on source, but then
check on filter, when trying to start second backup.
To keep the test we instead can catch another collision: both jobs will
get 'drive0' job-id, as job-id parameter is unspecified. To prevent
interleaving with file-posix locks (as they are dependent on config)
let's use another target for second backup.
Also, it's obvious now that we'd like to drop this op-blocker at all
and add a test-case for two backups from one node (to different
destinations) actually works. But not in these series.
141: Output changed: prepatch, "Node is in use" comes from bdrv_has_blk
check inside qmp_blockdev_del. But we've dropped block-copy blk
objects, so no more blk objects on source bs (job blk is on backup-top
filter bs). New message is from op-blocker, which is the next check in
qmp_blockdev_add.
257: The test wants to emulate guest write during backup. They should
go to filter node, not to original source node, of course. Therefore we
need to specify filter node name and use it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20191001131409.14202-6-vsementsov@virtuozzo.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/backup-top.c')
-rw-r--r-- | block/backup-top.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/block/backup-top.c b/block/backup-top.c index 75a315744d..7cdb1f8eba 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -50,12 +50,11 @@ static coroutine_fn int backup_top_co_preadv( static coroutine_fn int backup_top_cbw(BlockDriverState *bs, uint64_t offset, uint64_t bytes) { - /* - * Here we'd like to use block_copy(), but block-copy need to be moved to - * use BdrvChildren to correctly use it in backup-top filter. It's a TODO. - */ + BDRVBackupTopState *s = bs->opaque; + uint64_t end = QEMU_ALIGN_UP(offset + bytes, s->bcs->cluster_size); + uint64_t off = QEMU_ALIGN_DOWN(offset, s->bcs->cluster_size); - abort(); + return block_copy(s->bcs, off, end - off, NULL); } static int coroutine_fn backup_top_co_pdiscard(BlockDriverState *bs, @@ -228,14 +227,10 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source, goto failed_after_append; } - /* - * TODO: Create block-copy-state here (which will utilize @cluster_size and - * @write_flags parameters which are unused now). For this, block-copy - * should be refactored to use BdrvChildren. - */ - state->bcs = NULL; - if (!state->bcs) { - error_setg(&local_err, "Cannot create block-copy-state"); + state->bcs = block_copy_state_new(top->backing, state->target, + cluster_size, write_flags, &local_err); + if (local_err) { + error_prepend(&local_err, "Cannot create block-copy-state: "); goto failed_after_append; } *bcs = state->bcs; |