From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 7/9] block: Allow changing 'discard' on reopen
Date: Wed, 29 Aug 2018 13:39:10 +0200 [thread overview]
Message-ID: <d3ea4f66-e8f3-35a2-1c3b-dcedb989827a@redhat.com> (raw)
In-Reply-To: <e4b359c3971bb95e1e3cc55e0f69e68404f33f17.1535291602.git.berto@igalia.com>
[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]
On 2018-08-26 16:09, Alberto Garcia wrote:
> 'discard' is one of the basic BlockdevOptions available for all
> drivers, but it's silently ignored by bdrv_reopen_prepare/commit(), so
> the user cannot change it and doesn't get an error explaining that it
> can't be changed.
>
> This should update the discard setting, but does nothing:
>
> (qemu) qemu-io virtio0 "reopen -o discard=on"
>
> Since there's no reason why we shouldn't allow changing it and the
> implementation is simple let's just do it.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> block.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/block.c b/block.c
> index 804d557608..21f1eb9cd1 100644
> --- a/block.c
> +++ b/block.c
> @@ -3178,6 +3178,15 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
>
> update_flags_from_options(&reopen_state->flags, opts);
>
> + value = qemu_opt_get(opts, "discard");
> + if (value != NULL) {
> + if (bdrv_parse_discard_flags(value, &reopen_state->flags) != 0) {
> + error_setg(errp, "Invalid discard option");
> + ret = -EINVAL;
> + goto error;
> + }
> + }
> +
> /* node-name and driver must be unchanged. Put them back into the QDict, so
> * that they are checked at the end of this function. */
> value = qemu_opt_get(opts, "node-name");
Hm. Why not just use the same "trick" here as in your last patch, i.e.
use qemu_opt_get_del() above and then qemu_opts_to_qdict() to return all
unhandled options to the QDict?
(We'd have to use *_del() in update_flags_from_options() as well, but
that would be OK for all callers, I believe.)
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-08-29 11:41 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-26 14:09 [Qemu-devel] [PATCH 0/9] Misc reopen-related patches Alberto Garcia
2018-08-26 14:09 ` [Qemu-devel] [PATCH 1/9] qemu-io: Fix writethrough check in reopen Alberto Garcia
2018-08-29 10:20 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 2/9] file-posix: x-check-cache-dropped should default to false on reopen Alberto Garcia
2018-08-29 10:27 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 3/9] block: Remove child references from bs->{options, explicit_options} Alberto Garcia
2018-08-29 10:43 ` Max Reitz
2018-08-29 11:53 ` Alberto Garcia
2018-08-29 12:18 ` Max Reitz
2018-08-29 14:52 ` Alberto Garcia
2018-08-26 14:09 ` [Qemu-devel] [PATCH 4/9] block: Don't look for child references in append_open_options() Alberto Garcia
2018-08-29 10:47 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 5/9] block: Allow child references on reopen Alberto Garcia
2018-08-29 11:26 ` Max Reitz
2018-08-29 12:29 ` Alberto Garcia
2018-08-29 12:59 ` Max Reitz
2018-08-29 13:00 ` Max Reitz
2018-08-29 14:56 ` Alberto Garcia
2018-08-29 15:03 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 6/9] file-posix: Forbid trying to change unsupported options during reopen Alberto Garcia
2018-08-29 11:33 ` Max Reitz
2018-08-29 12:33 ` Alberto Garcia
2018-08-29 12:59 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 7/9] block: Allow changing 'discard' on reopen Alberto Garcia
2018-08-29 11:39 ` Max Reitz [this message]
2018-08-30 10:04 ` Alberto Garcia
2018-08-30 10:10 ` Alberto Garcia
2018-08-29 11:44 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 8/9] block: Allow changing 'detect-zeroes' " Alberto Garcia
2018-08-29 11:52 ` Max Reitz
2018-08-26 14:09 ` [Qemu-devel] [PATCH 9/9] block: Allow changing 'force-share' " Alberto Garcia
2018-08-29 12:01 ` 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=d3ea4f66-e8f3-35a2-1c3b-dcedb989827a@redhat.com \
--to=mreitz@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@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).