diff mbox

[for-2.7,v2,03/17] blockdev: Add and parse "lock-image" option for block devices

Message ID 1460690887-32751-4-git-send-email-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng April 15, 2016, 3:27 a.m. UTC
Honor the locking switch specified in CLI or QMP, and set the open flags for
the image accordingly.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 blockdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Denis V. Lunev April 16, 2016, 1:15 p.m. UTC | #1
On 04/15/2016 06:27 AM, Fam Zheng wrote:
> Honor the locking switch specified in CLI or QMP, and set the open flags for
> the image accordingly.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   blockdev.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/blockdev.c b/blockdev.c
> index f1f520a..93bd43e 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -382,6 +382,10 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
>                  return;
>               }
>           }
> +
> +        if (!qemu_opt_get_bool(opts, "lock-image", false)) {
> +            *bdrv_flags |= BDRV_O_NO_LOCK;
> +        }
>       }
>   
>       /* disk I/O throttling */
> @@ -4249,6 +4253,10 @@ QemuOptsList qemu_common_drive_opts = {
>               .type = QEMU_OPT_BOOL,
>               .help = "whether to account for failed I/O operations "
>                       "in the statistics",
> +        },{
> +            .name = "lock-image",
> +            .type = QEMU_OPT_BOOL,
> +            .help = "whether to lock the image (default: on)",
>           },
>           { /* end of list */ }
>       },
should you add proper clause into qmp-commands.hx?
Fam Zheng April 19, 2016, 1 p.m. UTC | #2
On Sat, 04/16 16:15, Denis V. Lunev wrote:
> On 04/15/2016 06:27 AM, Fam Zheng wrote:
> >Honor the locking switch specified in CLI or QMP, and set the open flags for
> >the image accordingly.
> >
> >Signed-off-by: Fam Zheng <famz@redhat.com>
> >---
> >  blockdev.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> >diff --git a/blockdev.c b/blockdev.c
> >index f1f520a..93bd43e 100644
> >--- a/blockdev.c
> >+++ b/blockdev.c
> >@@ -382,6 +382,10 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
> >                 return;
> >              }
> >          }
> >+
> >+        if (!qemu_opt_get_bool(opts, "lock-image", false)) {
> >+            *bdrv_flags |= BDRV_O_NO_LOCK;
> >+        }
> >      }
> >      /* disk I/O throttling */
> >@@ -4249,6 +4253,10 @@ QemuOptsList qemu_common_drive_opts = {
> >              .type = QEMU_OPT_BOOL,
> >              .help = "whether to account for failed I/O operations "
> >                      "in the statistics",
> >+        },{
> >+            .name = "lock-image",
> >+            .type = QEMU_OPT_BOOL,
> >+            .help = "whether to lock the image (default: on)",
> >          },
> >          { /* end of list */ }
> >      },
> should you add proper clause into qmp-commands.hx?

Yes, I'll update this patch.
diff mbox

Patch

diff --git a/blockdev.c b/blockdev.c
index f1f520a..93bd43e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -382,6 +382,10 @@  static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
                return;
             }
         }
+
+        if (!qemu_opt_get_bool(opts, "lock-image", false)) {
+            *bdrv_flags |= BDRV_O_NO_LOCK;
+        }
     }
 
     /* disk I/O throttling */
@@ -4249,6 +4253,10 @@  QemuOptsList qemu_common_drive_opts = {
             .type = QEMU_OPT_BOOL,
             .help = "whether to account for failed I/O operations "
                     "in the statistics",
+        },{
+            .name = "lock-image",
+            .type = QEMU_OPT_BOOL,
+            .help = "whether to lock the image (default: on)",
         },
         { /* end of list */ }
     },