aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-01-22 09:03:13 +0100
committerKevin Wolf <kwolf@redhat.com>2013-01-25 18:18:34 +0100
commit08e4ed6cdeeee7912072cf14aa8ab6c60dacb4fb (patch)
tree476d2229546a51ab953db9d1622ae7ffa72f82f1 /block
parentbd48bde8f0fa08dfc8edcafc2bc8aa6d43734463 (diff)
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 <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/mirror.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/mirror.c b/block/mirror.c
index fc6b9b7118..896972c297 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -207,7 +207,7 @@ static void coroutine_fn mirror_run(void *opaque)
if (backing_filename[0] && !s->target->backing_hd) {
bdrv_get_info(s->target, &bdi);
if (s->granularity < bdi.cluster_size) {
- s->buf_size = bdi.cluster_size;
+ s->buf_size = MAX(s->buf_size, bdi.cluster_size);
length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
s->cow_bitmap = bitmap_new(length);
}
@@ -416,8 +416,8 @@ static BlockJobType mirror_job_type = {
};
void mirror_start(BlockDriverState *bs, BlockDriverState *target,
- int64_t speed, int64_t granularity, MirrorSyncMode mode,
- BlockdevOnError on_source_error,
+ int64_t speed, int64_t granularity, int64_t buf_size,
+ MirrorSyncMode mode, BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockDriverCompletionFunc *cb,
void *opaque, Error **errp)
@@ -455,7 +455,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target,
s->target = target;
s->mode = mode;
s->granularity = granularity;
- s->buf_size = granularity;
+ s->buf_size = MAX(buf_size, granularity);
bdrv_set_dirty_tracking(bs, granularity);
bdrv_set_enable_write_cache(s->target, true);