From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [HACK qemu 06/13] block/{copy-before-write, snapshot-access}: implement bdrv_co_get_info driver callback
Date: Thu, 25 Jan 2024 15:41:42 +0100 [thread overview]
Message-ID: <20240125144149.216064-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20240125144149.216064-1-f.ebner@proxmox.com>
In preparation to fix an issue for backup fleecing where discarding
the source would lead to an assertion failure when the fleecing image
has larger granularity than the backup target.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Still need to wait on a response from upstream. For now this hack, so
that the RFC as a whole doesn't have to wait.
block/copy-before-write.c | 30 ++++++++++++++++++++++++++++++
block/snapshot-access.c | 7 +++++++
2 files changed, 37 insertions(+)
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index 87f047ad5f..961e7439ad 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -322,6 +322,35 @@ cbw_co_snapshot_block_status(BlockDriverState *bs,
return ret;
}
+static int coroutine_fn
+cbw_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+ BDRVCopyBeforeWriteState *s = bs->opaque;
+
+ BlockDriverInfo local_bdi;
+ int64_t cluster_size = 0;
+
+ int ret, ret2;
+
+ ret = bdrv_co_get_info(bs->file->bs, &local_bdi);
+ if (ret == 0) {
+ cluster_size = MAX(cluster_size, local_bdi.cluster_size);
+ }
+
+ ret2 = bdrv_co_get_info(s->target->bs, &local_bdi);
+ if (ret2 == 0) {
+ cluster_size = MAX(cluster_size, local_bdi.cluster_size);
+ }
+
+ if (ret != 0 && ret2 != 0) {
+ return ret;
+ }
+
+ bdi->cluster_size = cluster_size;
+
+ return 0;
+}
+
static int coroutine_fn GRAPH_RDLOCK
cbw_co_pdiscard_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes)
{
@@ -531,6 +560,7 @@ BlockDriver bdrv_cbw_filter = {
.bdrv_co_preadv_snapshot = cbw_co_preadv_snapshot,
.bdrv_co_pdiscard_snapshot = cbw_co_pdiscard_snapshot,
.bdrv_co_snapshot_block_status = cbw_co_snapshot_block_status,
+ .bdrv_co_get_info = cbw_co_get_info,
.bdrv_refresh_filename = cbw_refresh_filename,
diff --git a/block/snapshot-access.c b/block/snapshot-access.c
index 67ea339da9..5aa20aaa1f 100644
--- a/block/snapshot-access.c
+++ b/block/snapshot-access.c
@@ -25,6 +25,7 @@
#include "sysemu/block-backend.h"
#include "qemu/cutils.h"
#include "block/block_int.h"
+#include "block/copy-before-write.h"
static int coroutine_fn GRAPH_RDLOCK
snapshot_access_co_preadv_part(BlockDriverState *bs,
@@ -72,6 +73,11 @@ snapshot_access_co_pwritev_part(BlockDriverState *bs,
return -ENOTSUP;
}
+static int coroutine_fn
+snapshot_access_co_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+ return bdrv_co_get_info(bs->file->bs, bdi);
+}
static void snapshot_access_refresh_filename(BlockDriverState *bs)
{
@@ -118,6 +124,7 @@ BlockDriver bdrv_snapshot_access_drv = {
.bdrv_co_pwrite_zeroes = snapshot_access_co_pwrite_zeroes,
.bdrv_co_pdiscard = snapshot_access_co_pdiscard,
.bdrv_co_block_status = snapshot_access_co_block_status,
+ .bdrv_co_get_info = snapshot_access_co_get_info,
.bdrv_refresh_filename = snapshot_access_refresh_filename,
--
2.39.2
next prev parent reply other threads:[~2024-01-25 14:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 14:41 [pve-devel] [RFC qemu/guest-common/manager/qemu-server/docs 00/13] fix #4136: implement backup fleecing Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [PATCH qemu 01/13] backup: factor out gathering device info into helper Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [PATCH qemu 02/13] backup: get device info: code cleanup Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [PATCH qemu 03/13] block/io: clear BDRV_BLOCK_RECURSE flag after recursing in bdrv_co_block_status Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC qemu 04/13] block/copy-before-write: create block_copy bitmap in filter node Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC qemu 05/13] qapi: blockdev-backup: add discard-source parameter Fiona Ebner
2024-01-25 14:41 ` Fiona Ebner [this message]
2024-01-29 14:35 ` [pve-devel] [HACK qemu 06/13] block/{copy-before-write, snapshot-access}: implement bdrv_co_get_info driver callback Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [HACK qemu 07/13] block/block-copy: always consider source cluster size too Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC qemu 08/13] PVE backup: add fleecing option Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC guest-common 09/13] vzdump: schema: add fleecing property string Fiona Ebner
2024-01-29 15:41 ` Fiona Ebner
2024-01-30 14:03 ` DERUMIER, Alexandre
2024-02-01 8:28 ` Fiona Ebner
2024-02-01 12:39 ` DERUMIER, Alexandre
2024-02-01 13:11 ` Fiona Ebner
2024-02-01 13:20 ` DERUMIER, Alexandre
2024-02-01 13:27 ` Fiona Ebner
2024-02-01 21:33 ` DERUMIER, Alexandre
2024-02-02 8:30 ` Fiona Ebner
2024-02-01 13:30 ` Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC manager 10/13] vzdump: handle new 'fleecing' " Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC qemu-server 11/13] backup: disk info: also keep track of size Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC qemu-server 12/13] backup: implement fleecing option Fiona Ebner
2024-01-29 15:28 ` Fiona Ebner
2024-01-25 14:41 ` [pve-devel] [RFC docs 13/13] vzdump: add section about backup fleecing Fiona Ebner
2024-01-25 16:13 ` Dietmar Maurer
2024-01-25 16:41 ` DERUMIER, Alexandre
2024-01-25 18:18 ` Dietmar Maurer
2024-01-26 8:39 ` Fiona Ebner
2024-01-25 16:02 ` [pve-devel] [RFC qemu/guest-common/manager/qemu-server/docs 00/13] fix #4136: implement " DERUMIER, Alexandre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240125144149.216064-7-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.