qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, vsementsov@virtuozzo.com,
	armbru@redhat.com
Subject: Re: [PATCH v9 1/3] block: introduce compress filter driver
Date: Wed, 27 Nov 2019 15:01:57 +0100	[thread overview]
Message-ID: <f3a68aa4-6e53-747a-8765-b92ed6588b08@redhat.com> (raw)
In-Reply-To: <1574779398-88772-2-git-send-email-andrey.shinkevich@virtuozzo.com>


[-- Attachment #1.1: Type: text/plain, Size: 2085 bytes --]

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 <mreitz@redhat.com>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> ---
>  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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2019-11-27 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 14:43 [PATCH v9 0/3] qcow2: advanced compression options Andrey Shinkevich
2019-11-26 14:43 ` [PATCH v9 1/3] block: introduce compress filter driver Andrey Shinkevich
2019-11-26 15:51   ` Eric Blake
2019-11-27 14:01   ` Max Reitz [this message]
2019-11-26 14:43 ` [PATCH v9 2/3] qcow2: Allow writing compressed data of multiple clusters Andrey Shinkevich
2019-11-27 14:52   ` Max Reitz
2019-11-26 14:43 ` [PATCH v9 3/3] tests/qemu-iotests: add case to write " Andrey Shinkevich
2019-11-27 15:17   ` Max Reitz

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=f3a68aa4-6e53-747a-8765-b92ed6588b08@redhat.com \
    --to=mreitz@redhat.com \
    --cc=andrey.shinkevich@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).