[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 37/41] block: Use BDRV_O_NO_BACKING where appropriate
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 37/41] block: Use BDRV_O_NO_BACKING where appropriate |
Date: |
Fri, 29 Nov 2013 17:45:52 +0100 |
If you open an image temporarily just because you want to check its size
or get it flushed, there's no real reason to open the whole backing file
chain.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
---
block.c | 3 ++-
block/qcow2.c | 3 ++-
block/vmdk.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 08dd7f2..3d78581 100644
--- a/block.c
+++ b/block.c
@@ -1061,7 +1061,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename,
QDict *options,
/* Get the required size from the image */
bs1 = bdrv_new("");
QINCREF(options);
- ret = bdrv_open(bs1, filename, options, 0, drv, &local_err);
+ ret = bdrv_open(bs1, filename, options, BDRV_O_NO_BACKING,
+ drv, &local_err);
if (ret < 0) {
bdrv_unref(bs1);
goto fail;
diff --git a/block/qcow2.c b/block/qcow2.c
index 2fe37ed..8e2b6c7 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1588,7 +1588,8 @@ static int qcow2_create2(const char *filename, int64_t
total_size,
/* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning */
ret = bdrv_open(bs, filename, NULL,
- BDRV_O_RDWR | BDRV_O_CACHE_WB, drv, &local_err);
+ BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
+ drv, &local_err);
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
goto out;
diff --git a/block/vmdk.c b/block/vmdk.c
index 6555663..5fb6c81 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1690,7 +1690,7 @@ static int vmdk_create(const char *filename,
QEMUOptionParameter *options,
}
if (backing_file) {
BlockDriverState *bs = bdrv_new("");
- ret = bdrv_open(bs, backing_file, NULL, 0, NULL, errp);
+ ret = bdrv_open(bs, backing_file, NULL, BDRV_O_NO_BACKING, NULL, errp);
if (ret != 0) {
bdrv_unref(bs);
return ret;
--
1.8.1.4
- [Qemu-devel] [PULL 23/41] qapi: Change BlockDirtyInfo to list, (continued)
- [Qemu-devel] [PULL 23/41] qapi: Change BlockDirtyInfo to list, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 27/41] qdict: Fix memory leak in qdict_do_flatten(), Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 28/41] qdict: Optimise qdict_do_flatten(), Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 29/41] sheepdog: refactor do_sd_create(), Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 31/41] qemu-iotests: Drop local version of cancel_and_wait from 040, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 30/41] sheepdog: support user-defined redundancy option, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 32/41] blkdebug: add "remove_break" command, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 33/41] qemu-iotest: Add pause_drive and resume_drive methods, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 34/41] qemu-iotests: Make test case 030, 040 and 055 deterministic, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 35/41] block: Enable BDRV_O_SNAPSHOT with driver-specific options, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 37/41] block: Use BDRV_O_NO_BACKING where appropriate,
Kevin Wolf <=
- [Qemu-devel] [PULL 36/41] qemu-iotests: Test snapshot mode, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 38/41] qemu-iotests: Filter qemu-io output in 025, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 40/41] vmdk: Allow read only open of VMDK version 3, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 41/41] qemu-iotests: Add sample image and test for VMDK version 3, Kevin Wolf, 2013/11/29