From a9978815f1d701d0f995ec1c8a49b2a05e1fad12 Mon Sep 17 00:00:00 2001
From: Jeffrey Cody <jcody@redhat.com>
Date: Wed, 20 Nov 2013 19:43:56 +0100
Subject: [PATCH 13/25] block: vhdx code movement - move vhdx_close() above vhdx_open()

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <577e97e41700b11687818a8dd0169444f6c58f40.1384975172.git.jcody@redhat.com>
Patchwork-id: 55805
O-Subject: [RHEL7 qemu-kvm PATCH 13/26] block: vhdx code movement - move vhdx_close() above vhdx_open()
Bugzilla: 879234
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit c46415afc2c99ea052f52f9d68ed9a78799f2c10)
---
 block/vhdx.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/vhdx.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/block/vhdx.c b/block/vhdx.c
index 49219df..7d697e4 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -778,6 +778,17 @@ exit:
 }
 
 
+static void vhdx_close(BlockDriverState *bs)
+{
+    BDRVVHDXState *s = bs->opaque;
+    qemu_vfree(s->headers[0]);
+    qemu_vfree(s->headers[1]);
+    qemu_vfree(s->bat);
+    qemu_vfree(s->parent_entries);
+    migrate_del_blocker(s->migration_blocker);
+    error_free(s->migration_blocker);
+}
+
 static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
                      Error **errp)
 {
@@ -1047,17 +1058,6 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
 }
 
 
-static void vhdx_close(BlockDriverState *bs)
-{
-    BDRVVHDXState *s = bs->opaque;
-    qemu_vfree(s->headers[0]);
-    qemu_vfree(s->headers[1]);
-    qemu_vfree(s->bat);
-    qemu_vfree(s->parent_entries);
-    migrate_del_blocker(s->migration_blocker);
-    error_free(s->migration_blocker);
-}
-
 static BlockDriver bdrv_vhdx = {
     .format_name            = "vhdx",
     .instance_size          = sizeof(BDRVVHDXState),
-- 
1.7.1