aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-10-01 16:14:09 +0300
committerMax Reitz <mreitz@redhat.com>2019-10-10 10:56:18 +0200
commit00e30f05de1d19586345ec373970ef4c192c6270 (patch)
tree5ac9d5f5464b9f6c8ff64a47495ce3e03a66afc4 /include
parent7df7868b9640402c465eec93c8e0fa9fc2cf5744 (diff)
downloadqemu-00e30f05de1d19586345ec373970ef4c192c6270.zip
qemu-00e30f05de1d19586345ec373970ef4c192c6270.tar.gz
qemu-00e30f05de1d19586345ec373970ef4c192c6270.tar.bz2
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 'include')
-rw-r--r--include/block/block-copy.h14
-rw-r--r--include/block/block_int.h1
2 files changed, 10 insertions, 5 deletions
diff --git a/include/block/block-copy.h b/include/block/block-copy.h
index 340d856..e2e135ff 100644
--- a/include/block/block-copy.h
+++ b/include/block/block-copy.h
@@ -27,8 +27,13 @@ typedef struct BlockCopyInFlightReq {
typedef void (*ProgressBytesCallbackFunc)(int64_t bytes, void *opaque);
typedef void (*ProgressResetCallbackFunc)(void *opaque);
typedef struct BlockCopyState {
- BlockBackend *source;
- BlockBackend *target;
+ /*
+ * BdrvChild objects are not owned or managed by block-copy. They are
+ * provided by block-copy user and user is responsible for appropriate
+ * permissions on these children.
+ */
+ BdrvChild *source;
+ BdrvChild *target;
BdrvDirtyBitmap *copy_bitmap;
int64_t cluster_size;
bool use_copy_range;
@@ -66,8 +71,7 @@ typedef struct BlockCopyState {
void *progress_opaque;
} BlockCopyState;
-BlockCopyState *block_copy_state_new(BlockDriverState *source,
- BlockDriverState *target,
+BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
int64_t cluster_size,
BdrvRequestFlags write_flags,
Error **errp);
@@ -84,6 +88,6 @@ int64_t block_copy_reset_unallocated(BlockCopyState *s,
int64_t offset, int64_t *count);
int coroutine_fn block_copy(BlockCopyState *s, int64_t start, uint64_t bytes,
- bool *error_is_read, bool is_write_notifier);
+ bool *error_is_read);
#endif /* BLOCK_COPY_H */
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 2b113eb..05056b3 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -1197,6 +1197,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
BdrvDirtyBitmap *sync_bitmap,
BitmapSyncMode bitmap_mode,
bool compress,
+ const char *filter_node_name,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
int creation_flags,