block/backup: set copy_range and compress after filter insertion

We are going to publish copy-before-write filter, so it would be
initialized through options. Still we don't want to publish compress
and copy-range options, as

1. Modern way to enable compression is to use compress filter.

2. For copy-range it's unclean how to make proper interface:
 - it's has experimental prefix for backup job anyway
 - the whole BackupPerf structure doesn't make sense for the filter
 So, let's just add copy-range possibility to the filter later if
 needed.

Still, we are going to continue support for compression and
experimental copy-range in backup job. So, set these options after
filter creation.

Note, that we can drop "compress" argument of bdrv_cbw_append() now, as
well as "perf". The only reason not doing so is that now, when I
prepare this patch the big series around it is already reviewed and I
want to avoid extra rebase conflicts to simplify review of the
following version.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20210824083856.17408-9-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2021-08-24 11:38:30 +03:00 committed by Hanna Reitz
parent f8b9504bac
commit 2a6511dfeb
3 changed files with 3 additions and 5 deletions

View File

@ -504,7 +504,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
} }
cbw = bdrv_cbw_append(bs, target, filter_node_name, cbw = bdrv_cbw_append(bs, target, filter_node_name,
cluster_size, perf, compress, &bcs, errp); cluster_size, false, &bcs, errp);
if (!cbw) { if (!cbw) {
goto error; goto error;
} }
@ -530,6 +530,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
job->len = len; job->len = len;
job->perf = *perf; job->perf = *perf;
block_copy_set_copy_opts(bcs, perf->use_copy_range, compress);
block_copy_set_progress_meter(bcs, &job->common.job.progress); block_copy_set_progress_meter(bcs, &job->common.job.progress);
block_copy_set_speed(bcs, speed); block_copy_set_speed(bcs, speed);

View File

@ -170,7 +170,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
BlockDriverState *target, BlockDriverState *target,
const char *filter_node_name, const char *filter_node_name,
uint64_t cluster_size, uint64_t cluster_size,
BackupPerf *perf,
bool compress, bool compress,
BlockCopyState **bcs, BlockCopyState **bcs,
Error **errp) Error **errp)
@ -217,8 +216,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
state->cluster_size = cluster_size; state->cluster_size = cluster_size;
state->bcs = block_copy_state_new(top->backing, state->target, state->bcs = block_copy_state_new(top->backing, state->target,
cluster_size, perf->use_copy_range, cluster_size, false, compress, errp);
compress, errp);
if (!state->bcs) { if (!state->bcs) {
error_prepend(errp, "Cannot create block-copy-state: "); error_prepend(errp, "Cannot create block-copy-state: ");
goto fail; goto fail;

View File

@ -33,7 +33,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
BlockDriverState *target, BlockDriverState *target,
const char *filter_node_name, const char *filter_node_name,
uint64_t cluster_size, uint64_t cluster_size,
BackupPerf *perf,
bool compress, bool compress,
BlockCopyState **bcs, BlockCopyState **bcs,
Error **errp); Error **errp);