From: Jeff Cody <jcody@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/4] qemu-io: Add -C for opening with copy-on-read
Date: Sat, 30 Sep 2017 23:00:11 -0400 [thread overview]
Message-ID: <20171001030011.GD4313@localhost.localdomain> (raw)
In-Reply-To: <20170930195345.23338-2-eblake@redhat.com>
On Sat, Sep 30, 2017 at 02:53:42PM -0500, Eric Blake wrote:
> Make it easier to enable copy-on-read during iotests, by
> exposing a new bool option to main and open.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
Reviewed-by: Jeff Cody <jcody@redhat.com>
> qemu-io.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/qemu-io.c b/qemu-io.c
> index 265445ad89..c70bde3eb1 100644
> --- a/qemu-io.c
> +++ b/qemu-io.c
> @@ -102,6 +102,7 @@ static void open_help(void)
> " Opens a file for subsequent use by all of the other qemu-io commands.\n"
> " -r, -- open file read-only\n"
> " -s, -- use snapshot file\n"
> +" -C, -- use copy-on-read\n"
> " -n, -- disable host cache, short for -t none\n"
> " -U, -- force shared permissions\n"
> " -k, -- use kernel AIO implementation (on Linux only)\n"
> @@ -120,7 +121,7 @@ static const cmdinfo_t open_cmd = {
> .argmin = 1,
> .argmax = -1,
> .flags = CMD_NOFILE_OK,
> - .args = "[-rsnkU] [-t cache] [-d discard] [-o options] [path]",
> + .args = "[-rsCnkU] [-t cache] [-d discard] [-o options] [path]",
> .oneline = "open the file specified by path",
> .help = open_help,
> };
> @@ -145,7 +146,7 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
> QDict *opts;
> bool force_share = false;
>
> - while ((c = getopt(argc, argv, "snro:kt:d:U")) != -1) {
> + while ((c = getopt(argc, argv, "snCro:kt:d:U")) != -1) {
> switch (c) {
> case 's':
> flags |= BDRV_O_SNAPSHOT;
> @@ -154,6 +155,9 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
> flags |= BDRV_O_NOCACHE;
> writethrough = false;
> break;
> + case 'C':
> + flags |= BDRV_O_COPY_ON_READ;
> + break;
> case 'r':
> readonly = 1;
> break;
> @@ -251,6 +255,7 @@ static void usage(const char *name)
> " -r, --read-only export read-only\n"
> " -s, --snapshot use snapshot file\n"
> " -n, --nocache disable host cache, short for -t none\n"
> +" -C, --copy-on-read enable copy-on-read\n"
> " -m, --misalign misalign allocations for O_DIRECT\n"
> " -k, --native-aio use kernel AIO implementation (on Linux only)\n"
> " -t, --cache=MODE use the given cache mode for the image\n"
> @@ -439,7 +444,7 @@ static QemuOptsList file_opts = {
> int main(int argc, char **argv)
> {
> int readonly = 0;
> - const char *sopt = "hVc:d:f:rsnmkt:T:U";
> + const char *sopt = "hVc:d:f:rsnCmkt:T:U";
> const struct option lopt[] = {
> { "help", no_argument, NULL, 'h' },
> { "version", no_argument, NULL, 'V' },
> @@ -448,6 +453,7 @@ int main(int argc, char **argv)
> { "read-only", no_argument, NULL, 'r' },
> { "snapshot", no_argument, NULL, 's' },
> { "nocache", no_argument, NULL, 'n' },
> + { "copy-on-read", no_argument, NULL, 'C' },
> { "misalign", no_argument, NULL, 'm' },
> { "native-aio", no_argument, NULL, 'k' },
> { "discard", required_argument, NULL, 'd' },
> @@ -492,6 +498,9 @@ int main(int argc, char **argv)
> flags |= BDRV_O_NOCACHE;
> writethrough = false;
> break;
> + case 'C':
> + flags |= BDRV_O_COPY_ON_READ;
> + break;
> case 'd':
> if (bdrv_parse_discard_flags(optarg, &flags) < 0) {
> error_report("Invalid discard option: %s", optarg);
> --
> 2.13.6
>
>
next prev parent reply other threads:[~2017-10-01 3:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 19:53 [Qemu-devel] [PATCH 0/4] block: Avoid copy-on-read assertions Eric Blake
2017-09-30 19:53 ` [Qemu-devel] [PATCH 1/4] qemu-io: Add -C for opening with copy-on-read Eric Blake
2017-10-01 3:00 ` Jeff Cody [this message]
2017-10-02 14:52 ` Kevin Wolf
2017-10-02 18:03 ` John Snow
2017-10-02 19:28 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-09-30 19:53 ` [Qemu-devel] [PATCH 2/4] block: Add blkdebug hook for copy-on-read Eric Blake
2017-10-01 3:00 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-10-02 14:52 ` [Qemu-devel] " Kevin Wolf
2017-10-02 18:08 ` John Snow
2017-10-02 19:28 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-09-30 19:53 ` [Qemu-devel] [PATCH 3/4] block: Perform copy-on-read in loop Eric Blake
2017-09-30 20:11 ` [Qemu-devel] [PATCH 4/4] iotests: Add test 197 for covering copy-on-read Eric Blake
2017-10-01 3:03 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-10-02 13:55 ` Eric Blake
2017-10-02 14:04 ` Jeff Cody
2017-09-30 21:19 ` [Qemu-devel] [PATCH 0/4] block: Avoid copy-on-read assertions no-reply
2017-09-30 22:05 ` Eric Blake
2017-10-02 14:50 ` Kevin Wolf
2017-10-02 15:10 ` Eric Blake
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=20171001030011.GD4313@localhost.localdomain \
--to=jcody@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).