[PATCH v2 11/19] qemu: block: Implement helpers for dealing with bitmaps during block commit
Eric Blake
eblake at redhat.com
Wed Mar 11 20:39:50 UTC 2020
On 3/11/20 7:55 AM, Peter Krempa wrote:
> qemuBlockBitmapsHandleCommitStart prepares for disabling the bitmaps in
> the 'base' of the commit job so that the bitmaps are not dirtied by the
> commit job. This needs to be done prior to start of the commit job.
>
> qemuBlockBitmapsHandleCommitFinish then calculates the necessary merges
> that agregate all the bitmaps between the commited images and write them
> into the base bitmap.
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
> src/qemu/qemu_block.c | 219 ++++++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_block.h | 14 +++
> 2 files changed, 233 insertions(+)
>
> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> index edebbcd0ce..6853c021ca 100644
> --- a/src/qemu/qemu_block.c
> +++ b/src/qemu/qemu_block.c
> @@ -2962,6 +2962,225 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr src,
> }
>
>
> +/**
> + * @topsrc: virStorageSource representing 'top' of the job
> + * @basesrc: virStorageSource representing 'base' of the job
> + * @blockNamedNodeData: hash table containing data about bitmaps
> + * @actions: filled with arguments for a 'transaction' command
> + * @disabledBitmapsBase: filled with a list of bitmap names which must be disabled
> + *
> + * Prepares data for correctly hanlding bitmaps during the start of a commit
handling
> + * job. The bitmaps in the 'base' image must be disabled, so that the writes
> + * done by the blockjob don't dirty the enabled bitmaps.
> + *
> + * @actions and @disabledBitmapsBase are untouched if no bitmaps need
> + * to be disabled.
> + */
> +int
> +qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc,
> + virStorageSourcePtr basesrc,
> + virHashTablePtr blockNamedNodeData,
> + virJSONValuePtr *actions,
> + char ***disabledBitmapsBase)
> +{
> +static int
> +qemuBlockBitmapsHandleCommitFinishIterate(void *payload,
> + const void *entryname,
> + void *opaque)
> +{
> + struct qemuBlockBitmapsHandleCommitData *data = payload;
> + const char *bitmapname = entryname;
> + virJSONValuePtr actions = opaque;
> +
> + if (data->skip)
> + return 0;
> +
> + if (data->create) {
> + if (qemuMonitorTransactionBitmapAdd(actions, data->basenode, bitmapname,
> + data->persistent, !data-> enable,
Spurious space.
> +/**
> + * @topsrc: virStorageSource representing 'top' of the job
> + * @basesrc: virStorageSource representing 'base' of the job
> + * @blockNamedNodeData: hash table containing data about bitmaps
> + * @actions: filled with arguments for a 'transaction' command
> + * @disabledBitmapsBase: bitmap names which were disabled
> + *
> + * Calculates the necessary bitmap merges/additions/enablements to properly
> + * handle commit of images from 'top' into 'base'. The necessary operations
> + * in form of argumets of the 'transaction' command are filled into 'actions'
typo and grammar:
in the form of arguments to
> + * if there is anything to do. Otherwise NULL is returned.
> + */
> +int
> +qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc,
> + virStorageSourcePtr basesrc,
> + virHashTablePtr blockNamedNodeData,
> + virJSONValuePtr *actions,
> + char **disabledBitmapsBase)
> +{
> +++ b/src/qemu/qemu_block.h
> @@ -229,6 +229,20 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr src,
> bool shallow,
> virJSONValuePtr *actions);
>
> +int
> +qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc,
> + virStorageSourcePtr basesrc,
> + virHashTablePtr blockNamedNodeData,
> + virJSONValuePtr *actions,
> + char ***disabledBitmapsBase);
> +
> +int
> +qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc,
> + virStorageSourcePtr basesrc,
> + virHashTablePtr blockNamedNodeData,
> + virJSONValuePtr *actions,
> + char **disabledBitmapsBase);
> +
> int
> qemuBlockReopenReadWrite(virDomainObjPtr vm,
> virStorageSourcePtr src,
>
Reviewed-by: Eric Blake <eblake at redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the libvir-list
mailing list