From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 347861FF39E for ; Mon, 10 Jun 2024 14:59:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1DC2E17595; Mon, 10 Jun 2024 15:00:20 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 10 Jun 2024 14:59:37 +0200 Message-Id: <20240610125942.116985-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240610125942.116985-1-f.ebner@proxmox.com> References: <20240610125942.116985-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.059 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [RFC qemu 2/7] block/copy-before-write: allow passing additional options for bdrv_cbw_append() X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" In preparation to allow configuring 'on-cbw-error' and 'cbw-timeout' for a backup job. The previously already passed-in 'min-cluster-size' option is also passed-in via the QDict now. Signed-off-by: Fiona Ebner --- block/backup.c | 9 ++++++++- block/copy-before-write.c | 8 ++++---- block/copy-before-write.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/block/backup.c b/block/backup.c index fe69723ada..e0acfe6758 100644 --- a/block/backup.c +++ b/block/backup.c @@ -21,6 +21,7 @@ #include "block/block_backup.h" #include "block/block-copy.h" #include "block/dirty-bitmap.h" +#include "block/qdict.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "sysemu/block-backend.h" @@ -346,6 +347,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, int64_t cluster_size; BlockDriverState *cbw = NULL; BlockCopyState *bcs = NULL; + QDict *cbw_opts = NULL; assert(bs); assert(target); @@ -433,8 +435,13 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, goto error; } + if (perf->has_min_cluster_size) { + cbw_opts = qdict_new(); + qdict_put_int(cbw_opts, "min-cluster-size", perf->min_cluster_size); + } + cbw = bdrv_cbw_append(bs, target, filter_node_name, discard_source, - perf->min_cluster_size, &bcs, errp); + cbw_opts, &bcs, errp); if (!cbw) { goto error; } diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 50cc4c7aae..5e0c1252f6 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -546,26 +546,26 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source, BlockDriverState *target, const char *filter_node_name, bool discard_source, - int64_t min_cluster_size, + QDict *opts, BlockCopyState **bcs, Error **errp) { BDRVCopyBeforeWriteState *state; BlockDriverState *top; - QDict *opts; int flags = BDRV_O_RDWR | (discard_source ? BDRV_O_CBW_DISCARD_SOURCE : 0); assert(source->total_sectors == target->total_sectors); GLOBAL_STATE_CODE(); - opts = qdict_new(); + if (!opts) { + opts = qdict_new(); + } qdict_put_str(opts, "driver", "copy-before-write"); if (filter_node_name) { qdict_put_str(opts, "node-name", filter_node_name); } qdict_put_str(opts, "file", bdrv_get_node_name(source)); qdict_put_str(opts, "target", bdrv_get_node_name(target)); - qdict_put_int(opts, "min-cluster-size", min_cluster_size); top = bdrv_insert_node(source, opts, flags, errp); if (!top) { diff --git a/block/copy-before-write.h b/block/copy-before-write.h index a27d2d7d9f..4c22bd282e 100644 --- a/block/copy-before-write.h +++ b/block/copy-before-write.h @@ -40,7 +40,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source, BlockDriverState *target, const char *filter_node_name, bool discard_source, - int64_t min_cluster_size, + QDict *opts, BlockCopyState **bcs, Error **errp); void bdrv_cbw_drop(BlockDriverState *bs); -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel