From ef8104378c4a0497be079e48ee5ac5a89c68f978 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 2 Dec 2014 18:32:42 +0100 Subject: 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 Signed-off-by: Kevin Wolf --- block/qcow2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'block') diff --git a/block/qcow2.c b/block/qcow2.c index cbc327b..d597b2d 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; -- cgit v1.1