qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 08/10] block: Reuse bs->options setting from bdrv_op


From: Max Reitz
Subject: [Qemu-devel] [PATCH 08/10] block: Reuse bs->options setting from bdrv_open()
Date: Sun, 26 Jan 2014 20:02:41 +0100

Setting bs->options in bdrv_file_open() is not necessary if it is
already done in bdrv_open().

Signed-off-by: Max Reitz <address@hidden>
---
 block.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/block.c b/block.c
index 0f2cd3f..f847c4b 100644
--- a/block.c
+++ b/block.c
@@ -956,9 +956,6 @@ static int bdrv_file_open(BlockDriverState *bs, const char 
*filename,
     Error *local_err = NULL;
     int ret;
 
-    bs->options = options;
-    options = qdict_clone_shallow(options);
-
     /* Fetch the file name from the options QDict if necessary */
     if (!filename) {
         filename = qdict_get_try_str(options, "filename");
@@ -1234,6 +1231,9 @@ int bdrv_open(BlockDriverState **pbs, const char 
*filename,
         bs = bdrv_new("");
     }
 
+    bs->options = options;
+    options = qdict_clone_shallow(options);
+
     if (flags & BDRV_O_PROTOCOL) {
         assert(!drv);
         ret = bdrv_file_open(bs, filename, options, flags & ~BDRV_O_PROTOCOL,
@@ -1250,9 +1250,6 @@ int bdrv_open(BlockDriverState **pbs, const char 
*filename,
         return 0;
     }
 
-    bs->options = options;
-    options = qdict_clone_shallow(options);
-
     /* For snapshot=on, create a temporary qcow2 overlay */
     if (flags & BDRV_O_SNAPSHOT) {
         BlockDriverState *bs1 = NULL;
-- 
1.8.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]