From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNPlU-00007v-0V for qemu-devel@nongnu.org; Tue, 11 Mar 2014 12:42:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNPlO-0004YT-2B for qemu-devel@nongnu.org; Tue, 11 Mar 2014 12:42:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNPlN-0004YN-QX for qemu-devel@nongnu.org; Tue, 11 Mar 2014 12:42:45 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2BGgjHT001916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Mar 2014 12:42:45 -0400 From: Kevin Wolf Date: Tue, 11 Mar 2014 17:42:41 +0100 Message-Id: <1394556161-16030-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] qcow2: Keep option in qcow2_invalidate_cache() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com Instead of manually building a list of all options from BDRVQcowState values just reuse the options that were used to open the image. qcow2_open() won't fully use all of the options in the QDict, but that's okay. This fixes all of the driver-specific options in qcow2, except for lazy-refcounts, which was special cased before. Signed-off-by: Kevin Wolf --- block/qcow2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index da82646..945c9d6 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1180,11 +1180,8 @@ static void qcow2_invalidate_cache(BlockDriverState *bs) bdrv_invalidate_cache(bs->file); - options = qdict_new(); - qdict_put(options, QCOW2_OPT_LAZY_REFCOUNTS, - qbool_from_int(s->use_lazy_refcounts)); - memset(s, 0, sizeof(BDRVQcowState)); + options = qdict_clone_shallow(bs->options); qcow2_open(bs, options, flags, NULL); QDECREF(options); -- 1.8.1.4