summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2014-12-02 18:32:42 +0100
committerKevin Wolf <kwolf@redhat.com>2014-12-10 10:31:19 +0100
commitef8104378c4a0497be079e48ee5ac5a89c68f978 (patch)
treed990ad85348d396320214a2ad02e0de7624a48d7 /block
parent5f535a941e52229d81e55603eb69b2bd449b937a (diff)
downloadqemu-ef8104378c4a0497be079e48ee5ac5a89c68f978.tar.gz
block: Omit bdrv_find_format for essential drivers
We can always assume raw, file and qcow2 being available; so do not use bdrv_find_format() to locate their BlockDriver objects but statically reference the respective objects. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index cbc327b1b4..d597b2d44c 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1915,10 +1915,9 @@ static int qcow2_create2(const char *filename, int64_t total_size,
* refcount of the cluster that is occupied by the header and the refcount
* table)
*/
- BlockDriver* drv = bdrv_find_format("qcow2");
- assert(drv != NULL);
ret = bdrv_open(&bs, filename, NULL, NULL,
- BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, drv, &local_err);
+ BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
+ &bdrv_qcow2, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto out;
@@ -1970,7 +1969,7 @@ 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, NULL,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
- drv, &local_err);
+ &bdrv_qcow2, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto out;