All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH v3 10/14] qemu-io: Remove "growable" option
Date: Mon, 26 Jan 2015 10:00:40 -0500	[thread overview]
Message-ID: <1422284444-12529-11-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1422284444-12529-1-git-send-email-mreitz@redhat.com>

Remove "growable" option from the "open" command and from the qemu-io
command line. qemu-io is about to be converted to BlockBackend which
will make sure that no request exceeds the image size, so the only way
to keep "growable" would be to use BlockBackend if it is not given and
to directly access the BDS if it is.

qemu-io is a debugging tool, therefore removing a rarely used option
will have only a very small impact, if any. There was only one
qemu-iotest which used the option; since it is not critical, this patch
just removes it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 qemu-io.c                  | 23 +++------------
 tests/qemu-iotests/016     | 73 ----------------------------------------------
 tests/qemu-iotests/016.out | 23 ---------------
 tests/qemu-iotests/group   |  1 -
 4 files changed, 4 insertions(+), 116 deletions(-)
 delete mode 100755 tests/qemu-iotests/016
 delete mode 100644 tests/qemu-iotests/016.out

diff --git a/qemu-io.c b/qemu-io.c
index 81f8f64..0237ecb 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -50,7 +50,7 @@ static const cmdinfo_t close_cmd = {
     .oneline    = "close the current open file",
 };
 
-static int openfile(char *name, int flags, int growable, QDict *opts)
+static int openfile(char *name, int flags, QDict *opts)
 {
     Error *local_err = NULL;
 
@@ -60,10 +60,6 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
         return 1;
     }
 
-    if (growable) {
-        flags |= BDRV_O_PROTOCOL;
-    }
-
     qemuio_blk = blk_new_open("hda", name, NULL, opts, flags, &local_err);
     if (!qemuio_blk) {
         fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
@@ -90,7 +86,6 @@ static void open_help(void)
 " -r, -- open file read-only\n"
 " -s, -- use snapshot file\n"
 " -n, -- disable host cache\n"
-" -g, -- allow file to grow (only applies to protocols)\n"
 " -o, -- options to be given to the block driver"
 "\n");
 }
@@ -123,7 +118,6 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
 {
     int flags = 0;
     int readonly = 0;
-    int growable = 0;
     int c;
     QemuOpts *qopts;
     QDict *opts;
@@ -139,9 +133,6 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
         case 'r':
             readonly = 1;
             break;
-        case 'g':
-            growable = 1;
-            break;
         case 'o':
             if (!qemu_opts_parse(&empty_opts, optarg, 0)) {
                 printf("could not parse option list -- %s\n", optarg);
@@ -164,9 +155,9 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
     qemu_opts_reset(&empty_opts);
 
     if (optind == argc - 1) {
-        return openfile(argv[optind], flags, growable, opts);
+        return openfile(argv[optind], flags, opts);
     } else if (optind == argc) {
-        return openfile(NULL, flags, growable, opts);
+        return openfile(NULL, flags, opts);
     } else {
         QDECREF(opts);
         return qemuio_command_usage(&open_cmd);
@@ -200,7 +191,6 @@ static void usage(const char *name)
 "  -r, --read-only      export read-only\n"
 "  -s, --snapshot       use snapshot file\n"
 "  -n, --nocache        disable host cache\n"
-"  -g, --growable       allow file to grow (only applies to protocols)\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"
@@ -359,7 +349,6 @@ static void reenable_tty_echo(void)
 int main(int argc, char **argv)
 {
     int readonly = 0;
-    int growable = 0;
     const char *sopt = "hVc:d:f:rsnmgkt:T:";
     const struct option lopt[] = {
         { "help", 0, NULL, 'h' },
@@ -371,7 +360,6 @@ int main(int argc, char **argv)
         { "snapshot", 0, NULL, 's' },
         { "nocache", 0, NULL, 'n' },
         { "misalign", 0, NULL, 'm' },
-        { "growable", 0, NULL, 'g' },
         { "native-aio", 0, NULL, 'k' },
         { "discard", 1, NULL, 'd' },
         { "cache", 1, NULL, 't' },
@@ -422,9 +410,6 @@ int main(int argc, char **argv)
         case 'm':
             qemuio_misalign = true;
             break;
-        case 'g':
-            growable = 1;
-            break;
         case 'k':
             flags |= BDRV_O_NATIVE_AIO;
             break;
@@ -482,7 +467,7 @@ int main(int argc, char **argv)
     }
 
     if ((argc - optind) == 1) {
-        openfile(argv[optind], flags, growable, opts);
+        openfile(argv[optind], flags, opts);
     }
     command_loop();
 
diff --git a/tests/qemu-iotests/016 b/tests/qemu-iotests/016
deleted file mode 100755
index 52397aa..0000000
--- a/tests/qemu-iotests/016
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-#
-# Test I/O after EOF for growable images.
-#
-# Copyright (C) 2009 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-# creator
-owner=hch@lst.de
-
-seq=`basename $0`
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-
-_cleanup()
-{
-	_cleanup_test_img
-}
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-. ./common.rc
-. ./common.filter
-
-_supported_fmt raw
-_supported_proto file sheepdog nfs
-_supported_os Linux
-
-
-# No -f, use probing for the protocol driver
-QEMU_IO_PROTO="$QEMU_IO_PROG -g --cache $CACHEMODE"
-
-size=128M
-_make_test_img $size
-
-echo
-echo "== reading at EOF =="
-$QEMU_IO_PROTO -c "read -P 0 $size 512" "$TEST_IMG" | _filter_qemu_io
-
-echo
-echo "== reading far past EOF =="
-$QEMU_IO_PROTO -c "read -P 0 256M 512" "$TEST_IMG" | _filter_qemu_io
-
-echo
-echo "== writing at EOF =="
-$QEMU_IO_PROTO -c "write -P 66 $size 512" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "read -P 66 $size 512" "$TEST_IMG" | _filter_qemu_io
-
-echo
-echo "== writing far past EOF =="
-$QEMU_IO_PROTO -c "write -P 66 256M 512" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "read -P 66 256M 512" "$TEST_IMG" | _filter_qemu_io
-
-# success, all done
-echo "*** done"
-rm -f $seq.full
-status=0
diff --git a/tests/qemu-iotests/016.out b/tests/qemu-iotests/016.out
deleted file mode 100644
index acbd60b..0000000
--- a/tests/qemu-iotests/016.out
+++ /dev/null
@@ -1,23 +0,0 @@
-QA output created by 016
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
-
-== reading at EOF ==
-read 512/512 bytes at offset 134217728
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-
-== reading far past EOF ==
-read 512/512 bytes at offset 268435456
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-
-== writing at EOF ==
-wrote 512/512 bytes at offset 134217728
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 512/512 bytes at offset 134217728
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-
-== writing far past EOF ==
-wrote 512/512 bytes at offset 268435456
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 512/512 bytes at offset 268435456
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 4b2b93b..ddfedb5 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -22,7 +22,6 @@
 013 rw auto
 014 rw auto
 015 rw snapshot auto
-016 rw auto quick
 017 rw backing auto quick
 018 rw backing auto quick
 019 rw backing auto quick
-- 
2.1.0

  parent reply	other threads:[~2015-01-26 15:01 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 15:00 [Qemu-devel] [PATCH v3 00/14] block: Remove "growable", add blk_new_open() Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 01/14] block: Lift some BDS functions to the BlockBackend Max Reitz
2015-01-26 21:48   ` Eric Blake
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 02/14] block: Add blk_new_open() Max Reitz
2015-01-26 21:56   ` Eric Blake
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 03/14] blockdev: Use blk_new_open() in blockdev_init() Max Reitz
2015-01-26 22:37   ` Eric Blake
2015-01-27  2:08     ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 04/14] block/xen: Use blk_new_open() in blk_connect() Max Reitz
2015-01-26 22:46   ` Eric Blake
2015-02-02 18:27   ` Kevin Wolf
2015-02-02 19:41     ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 05/14] qemu-img: Use blk_new_open() in img_open() Max Reitz
2015-01-26 22:47   ` Eric Blake
2015-02-02 18:35   ` Kevin Wolf
2015-02-02 19:42     ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 06/14] qemu-img: Use blk_new_open() in img_rebase() Max Reitz
2015-01-27  3:05   ` Eric Blake
2015-01-27 15:01     ` Max Reitz
2015-02-02 19:00   ` Kevin Wolf
2015-02-02 19:47     ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 07/14] qemu-img: Use BlockBackend as far as possible Max Reitz
2015-01-27  3:38   ` Eric Blake
2015-01-27 15:07     ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 08/14] qemu-nbd: Use blk_new_open() in main() Max Reitz
2015-01-27  4:59   ` Eric Blake
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 09/14] qemu-io: Use blk_new_open() in openfile() Max Reitz
2015-01-27 16:23   ` Eric Blake
2015-02-02 19:34   ` Kevin Wolf
2015-02-02 19:51     ` Max Reitz
2015-01-26 15:00 ` Max Reitz [this message]
2015-01-27 16:59   ` [Qemu-devel] [PATCH v3 10/14] qemu-io: Remove "growable" option Eric Blake
2015-01-27 17:04     ` Max Reitz
2015-01-27 17:10       ` Eric Blake
2015-01-27 17:11         ` Max Reitz
2015-02-02 19:36           ` Kevin Wolf
2015-02-02 19:52             ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 11/14] qemu-io: Use BlockBackend Max Reitz
2015-01-27 17:08   ` Eric Blake
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 12/14] block: Clamp BlockBackend requests Max Reitz
2015-01-27 17:15   ` Eric Blake
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 13/14] block: Remove "growable" from BDS Max Reitz
2015-01-27 17:29   ` Eric Blake
2015-02-02 19:46   ` Kevin Wolf
2015-02-02 19:54     ` Max Reitz
2015-01-26 15:00 ` [Qemu-devel] [PATCH v3 14/14] block: Keep bdrv_check*_request()'s return value Max Reitz
2015-01-27 17:36   ` Eric Blake
2015-01-26 15:49 ` [Qemu-devel] [PATCH v3 00/14] block: Remove "growable", add blk_new_open() Stefano Stabellini
2015-02-02 19:50 ` Kevin Wolf

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=1422284444-12529-11-git-send-email-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=stefano.stabellini@eu.citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.