aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-07-30 19:32:49 +0300
committerJohn Snow <jsnow@redhat.com>2019-08-16 18:29:43 -0400
commit319bd5edb92addc725b2701d73381c415146c287 (patch)
tree386c8c029f130a3fb727ac990a7156caa48b9e2b /blockdev.c
parent590a63d5983c9cdf2e1bf96a519532949963085d (diff)
block/backup: deal with zero detection
We have detect_zeroes option, so at least for blockdev-backup user should define it if zero-detection is needed. For drive-backup leave detection enabled by default but do it through existing option instead of open-coding. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 20190730163251.755248-2-vsementsov@virtuozzo.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/blockdev.c b/blockdev.c
index 64d06d1f67..2e536dde3e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3615,7 +3615,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
BlockDriverState *source = NULL;
BlockJob *job = NULL;
AioContext *aio_context;
- QDict *options = NULL;
+ QDict *options;
Error *local_err = NULL;
int flags;
int64_t size;
@@ -3688,10 +3688,10 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
goto out;
}
+ options = qdict_new();
+ qdict_put_str(options, "discard", "unmap");
+ qdict_put_str(options, "detect-zeroes", "unmap");
if (backup->format) {
- if (!options) {
- options = qdict_new();
- }
qdict_put_str(options, "driver", backup->format);
}