All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	Jeff Cody <jcody@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Eric Blake <eblake@redhat.com>, John Snow <jsnow@redhat.com>,
	qemu-block@nongnu.org, berrange@redhat.com, pbonzini@redhat.com,
	den@openvz.org
Subject: [Qemu-devel] [PATCH for-2.7 v2 08/17] qemu-io: Add "-L" option for BDRV_O_NO_LOCK
Date: Fri, 15 Apr 2016 11:27:58 +0800	[thread overview]
Message-ID: <1460690887-32751-9-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1460690887-32751-1-git-send-email-famz@redhat.com>

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 qemu-io.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 288bba8..6bb6232 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -107,6 +107,7 @@ static void open_help(void)
 " -r, -- open file read-only\n"
 " -s, -- use snapshot file\n"
 " -n, -- disable host cache\n"
+" -L, -- disable image lock\n"
 " -o, -- options to be given to the block driver"
 "\n");
 }
@@ -139,12 +140,13 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
 {
     int flags = 0;
     int readonly = 0;
+    int nolock = 0;
     bool writethrough = true;
     int c;
     QemuOpts *qopts;
     QDict *opts;
 
-    while ((c = getopt(argc, argv, "snrgo:")) != -1) {
+    while ((c = getopt(argc, argv, "snrgLo:")) != -1) {
         switch (c) {
         case 's':
             flags |= BDRV_O_SNAPSHOT;
@@ -156,6 +158,9 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
         case 'r':
             readonly = 1;
             break;
+        case 'L':
+            nolock = 1;
+            break;
         case 'o':
             if (imageOpts) {
                 printf("--image-opts and 'open -o' are mutually exclusive\n");
@@ -176,6 +181,10 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
         flags |= BDRV_O_RDWR;
     }
 
+    if (nolock) {
+        flags |= BDRV_O_NO_LOCK;
+    }
+
     if (imageOpts && (optind == argc - 1)) {
         if (!qemu_opts_parse_noisily(&empty_opts, argv[optind], false)) {
             qemu_opts_reset(&empty_opts);
@@ -410,7 +419,8 @@ static QemuOptsList file_opts = {
 int main(int argc, char **argv)
 {
     int readonly = 0;
-    const char *sopt = "hVc:d:f:rsnmgkt:T:";
+    int nolock = 0;
+    const char *sopt = "hVc:d:f:rLsnmgkt:T:";
     const struct option lopt[] = {
         { "help", no_argument, NULL, 'h' },
         { "version", no_argument, NULL, 'V' },
@@ -418,6 +428,7 @@ int main(int argc, char **argv)
         { "cmd", required_argument, NULL, 'c' },
         { "format", required_argument, NULL, 'f' },
         { "read-only", no_argument, NULL, 'r' },
+        { "no-lock", no_argument, NULL, 'L' },
         { "snapshot", no_argument, NULL, 's' },
         { "nocache", no_argument, NULL, 'n' },
         { "misalign", no_argument, NULL, 'm' },
@@ -477,6 +488,9 @@ int main(int argc, char **argv)
         case 'r':
             readonly = 1;
             break;
+        case 'L':
+            nolock = 1;
+            break;
         case 'm':
             qemuio_misalign = true;
             break;
@@ -558,6 +572,10 @@ int main(int argc, char **argv)
         flags |= BDRV_O_RDWR;
     }
 
+    if (nolock) {
+        flags |= BDRV_O_NO_LOCK;
+    }
+
     if ((argc - optind) == 1) {
         if (imageOpts) {
             QemuOpts *qopts = NULL;
-- 
2.8.0

  parent reply	other threads:[~2016-04-15  3:28 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  3:27 [Qemu-devel] [PATCH for-2.7 v2 00/17] block: Lock images when opening Fam Zheng
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 01/17] block: Add BDRV_O_NO_LOCK Fam Zheng
2016-04-16 10:47   ` Denis V. Lunev
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 02/17] qapi: Add lock-image in blockdev-add options Fam Zheng
2016-04-16 10:48   ` Denis V. Lunev
2016-04-26  8:01     ` Fam Zheng
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 03/17] blockdev: Add and parse "lock-image" option for block devices Fam Zheng
2016-04-16 13:15   ` Denis V. Lunev
2016-04-19 13:00     ` Fam Zheng
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 04/17] block: Introduce image file locking Fam Zheng
2016-04-16 13:22   ` Denis V. Lunev
2016-04-18  1:43     ` Fam Zheng
2016-04-16 23:29   ` Max Reitz
2016-04-18  1:33     ` Fam Zheng
2016-04-18  5:34       ` Denis V. Lunev
2016-04-19 19:14         ` Max Reitz
2016-04-20  8:46           ` Denis V. Lunev
2016-04-19 19:13       ` Max Reitz
2016-04-25 23:55   ` Laszlo Ersek
2016-04-26  0:47     ` Fam Zheng
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf Fam Zheng
2016-04-16 13:29   ` Denis V. Lunev
2016-04-18  1:12     ` Fam Zheng
2016-04-18  5:30       ` Denis V. Lunev
2016-04-18  9:34       ` Daniel P. Berrange
2016-04-18  9:38         ` Denis V. Lunev
2016-04-17 19:27   ` Richard W.M. Jones
2016-04-18  1:10     ` Fam Zheng
2016-04-18  8:04       ` Richard W.M. Jones
2016-04-19 12:37         ` Fam Zheng
2016-04-19 13:07           ` Richard W.M. Jones
2016-04-19 13:19             ` Fam Zheng
2016-04-19 13:36               ` Richard W.M. Jones
2016-04-19 13:45                 ` Daniel P. Berrange
2016-04-19 13:34         ` Daniel P. Berrange
2016-04-19 13:40           ` Richard W.M. Jones
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 06/17] gluster: " Fam Zheng
2016-04-15 12:24   ` [Qemu-devel] [Qemu-block] " Niels de Vos
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking Fam Zheng
2016-04-23  1:57   ` Jason Dillaman
2016-04-25  0:42     ` Fam Zheng
2016-04-26 15:42       ` Jason Dillaman
2016-04-27  0:20         ` Fam Zheng
2016-04-27 18:18           ` Jason Dillaman
2016-04-28  1:33             ` Fam Zheng
2016-04-15  3:27 ` Fam Zheng [this message]
2016-04-16 13:46   ` [Qemu-devel] [PATCH for-2.7 v2 08/17] qemu-io: Add "-L" option for BDRV_O_NO_LOCK Denis V. Lunev
2016-04-19 12:59     ` Fam Zheng
2016-04-15  3:27 ` [Qemu-devel] [PATCH for-2.7 v2 09/17] qemu-img: Add "-L" option to sub commands Fam Zheng
2016-04-16 14:29   ` Denis V. Lunev
2016-04-16 14:30     ` Denis V. Lunev
2016-04-19 12:59     ` Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 10/17] qemu-img: Update documentation of "-L" option Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 11/17] qemu-nbd: Add "--no-lock/-L" option Fam Zheng
2016-04-16 14:32   ` Denis V. Lunev
2016-04-19 12:58     ` Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 12/17] qemu-iotests: 140: Disable image lock for qemu-io access Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 13/17] qemu-iotests: 046: Move version detection out from verify_io Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 14/17] qemu-iotests: Wait for QEMU processes before checking image in 091 Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 15/17] qemu-iotests: Disable image lock when checking test image Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 16/17] block: Turn on image locking by default Fam Zheng
2016-04-15  3:28 ` [Qemu-devel] [PATCH for-2.7 v2 17/17] qemu-iotests: Add test case 152 for image locking Fam Zheng
2016-04-16 14:33 ` [Qemu-devel] [PATCH for-2.7 v2 00/17] block: Lock images when opening Denis V. Lunev
2016-04-18  9:53 ` Daniel P. Berrange
2016-04-19 12:40   ` Fam Zheng

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=1460690887-32751-9-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@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 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.