[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 1/3] block: introduce compress filter driver
From: |
Max Reitz |
Subject: |
Re: [PATCH v9 1/3] block: introduce compress filter driver |
Date: |
Wed, 27 Nov 2019 15:01:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 |
On 26.11.19 15:43, Andrey Shinkevich wrote:
> Allow writing all the data compressed through the filter driver.
> The written data will be aligned by the cluster size.
> Based on the QEMU current implementation, that data can be written to
> unallocated clusters only. May be used for a backup job.
>
> Suggested-by: Max Reitz <address@hidden>
> Signed-off-by: Andrey Shinkevich <address@hidden>
> ---
> block/Makefile.objs | 1 +
> block/filter-compress.c | 190
> ++++++++++++++++++++++++++++++++++++++++++++++++
> qapi/block-core.json | 10 ++-
> 3 files changed, 197 insertions(+), 4 deletions(-)
> create mode 100644 block/filter-compress.c
[...]
> diff --git a/block/filter-compress.c b/block/filter-compress.c
> new file mode 100644
> index 0000000..ef4b12b
> --- /dev/null
> +++ b/block/filter-compress.c
[...]
> +#define PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \
> + | BLK_PERM_WRITE \
> + | BLK_PERM_RESIZE)
> +#define PERM_UNCHANGED (BLK_PERM_ALL & ~PERM_PASSTHROUGH)
> +
> +static void compress_child_perm(BlockDriverState *bs, BdrvChild *c,
> + const BdrvChildRole *role,
> + BlockReopenQueue *reopen_queue,
> + uint64_t perm, uint64_t shared,
> + uint64_t *nperm, uint64_t *nshared)
> +{
> + *nperm = perm & PERM_PASSTHROUGH;
> + *nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED;
> +
> + /*
> + * We must not request write permissions for an inactive node, the child
> + * cannot provide it.
> + */
> + if (!(bs->open_flags & BDRV_O_INACTIVE)) {
> + *nperm |= BLK_PERM_WRITE_UNCHANGED;
> + }
The copy-on-read filter has to take the WRITE_UNCHANGED permission
because it will do such writes for every read, but I don’t think this
driver ever needs to take this permission. Therefore it should be
enough to use bdrv_filter_default_perms for .bdrv_child_perm.
Max
signature.asc
Description: OpenPGP digital signature