block: Use BDRV_O_NO_BACKING where appropriate
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 <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
diff --git a/block.c b/block.c
index 08dd7f2..3d78581 100644
--- a/block.c
+++ b/block.c
@@ -1061,7 +1061,8 @@
/* 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;