From: Max Reitz <mreitz@redhat.com>
To: Maxim Levitsky <mlevitsk@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] LUKS: support preallocation in qemu-img
Date: Thu, 11 Jul 2019 15:43:46 +0200 [thread overview]
Message-ID: <aab36239-5717-e918-05c9-1876d87fd7a8@redhat.com> (raw)
In-Reply-To: <20190711091127.12988-1-mlevitsk@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 2148 bytes --]
On 11.07.19 11:11, Maxim Levitsky wrote:
> preallocation=off and preallocation=metadata
> both allocate luks header only, and preallocation=falloc/full
> is passed to underlying file.
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534951
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> block/crypto.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
FWIW, do you see the implementation of block_crypto_co_truncate()?
Like, how it just passes preallocation requests through to the
underlying layer? How I said it shouldn’t be done?
Yes, that was me, in commit 7ea37c30660.
So, er, yeah.
> diff --git a/block/crypto.c b/block/crypto.c
> index 8237424ae6..cbc291301e 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
[...]
> @@ -534,12 +537,28 @@ static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
> QCryptoBlockCreateOptions *create_opts = NULL;
> BlockDriverState *bs = NULL;
> QDict *cryptoopts;
> + PreallocMode prealloc;
> + char *buf = NULL;
> int64_t size;
> int ret;
> + Error *local_err = NULL;
>
> /* Parse options */
> size = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0);
>
> + buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
> + prealloc = qapi_enum_parse(&PreallocMode_lookup, buf,
> + PREALLOC_MODE_OFF, &local_err);
Please align such lines to the opening parenthesis.
> + g_free(buf);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return -EINVAL;
> + }
> +
> + if (prealloc == PREALLOC_MODE_METADATA) {
> + prealloc = PREALLOC_MODE_OFF;
There is one space too many here.
> + }
> +
I think you also need to add a @preallocation parameter to
BlockdevCreateOptionsLUKS and handle it in block_crypto_co_create_luks().
Max
> cryptoopts = qemu_opts_to_qdict_filtered(opts, NULL,
> &block_crypto_create_opts_luks,
> true);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-07-11 13:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 17:03 [Qemu-devel] [PATCH] LUKS: support preallocation in qemu-img Maxim Levitsky
2019-07-10 21:24 ` Max Reitz
2019-07-10 21:52 ` Max Reitz
2019-07-11 8:39 ` Maxim Levitsky
2019-07-11 9:11 ` [Qemu-devel] [PATCH v2] " Maxim Levitsky
2019-07-11 13:43 ` Max Reitz [this message]
2019-07-11 14:04 ` Maxim Levitsky
2019-07-11 12:24 ` [Qemu-devel] [PATCH] " Max Reitz
2019-07-11 13:50 ` Eric Blake
2019-07-11 13:56 ` Daniel P. Berrangé
2019-07-11 14:12 ` Kevin Wolf
2019-07-11 9:20 ` Daniel P. Berrangé
2019-07-11 12:23 ` Max Reitz
2019-07-11 12:54 ` Max Reitz
2019-07-11 13:01 ` Daniel P. Berrangé
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=aab36239-5717-e918-05c9-1876d87fd7a8@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).