yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 89e6ba9d5ad137ecb8f981f1ec28ee519812bf50 Mon Sep 17 00:00:00 2001
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Date: Wed, 6 Nov 2013 12:37:43 +0100
9ae3a8
Subject: [PATCH 12/81] block: introduce bdrv_get_block_status API
9ae3a8
9ae3a8
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Message-id: <1383741463-25811-1-git-send-email-pbonzini@redhat.com>
9ae3a8
Patchwork-id: 55521
9ae3a8
O-Subject: [RHEL 7.0 qemu-kvm PATCH v2 12/26] block: introduce bdrv_get_block_status API
9ae3a8
Bugzilla: 989646
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
For now, bdrv_get_block_status is just another name for bdrv_is_allocated.
9ae3a8
The next patches will add more flags.
9ae3a8
9ae3a8
This also touches all block drivers with a mostly mechanical rename.  The
9ae3a8
sole exception is cow; because it calls cow_co_is_allocated from the read
9ae3a8
code, we keep that function and make cow_co_get_block_status a wrapper.
9ae3a8
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
(cherry picked from commit b6b8a33354a448ee421f57676c1a93a536a63269)
9ae3a8
---
9ae3a8
 block.c                   | 46 ++++++++++++++++++++++++++--------------------
9ae3a8
 block/cow.c               |  8 +++++++-
9ae3a8
 block/qcow.c              |  4 ++--
9ae3a8
 block/qcow2.c             |  4 ++--
9ae3a8
 block/qed.c               |  4 ++--
9ae3a8
 block/raw-posix.c         |  4 ++--
9ae3a8
 block/raw.c               |  6 +++---
9ae3a8
 block/sheepdog.c          | 12 ++++++------
9ae3a8
 block/vdi.c               |  4 ++--
9ae3a8
 block/vmdk.c              |  4 ++--
9ae3a8
 block/vvfat.c             |  4 ++--
9ae3a8
 include/block/block.h     |  2 ++
9ae3a8
 include/block/block_int.h |  2 +-
9ae3a8
 13 files changed, 59 insertions(+), 45 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block.c                   |   46 +++++++++++++++++++++++++-------------------
9ae3a8
 block/cow.c               |    8 ++++++-
9ae3a8
 block/qcow.c              |    4 +-
9ae3a8
 block/qcow2.c             |    4 +-
9ae3a8
 block/qed.c               |    4 +-
9ae3a8
 block/raw-posix.c         |    4 +-
9ae3a8
 block/raw.c               |    6 ++--
9ae3a8
 block/sheepdog.c          |   12 +++++-----
9ae3a8
 block/vdi.c               |    4 +-
9ae3a8
 block/vmdk.c              |    4 +-
9ae3a8
 block/vvfat.c             |    4 +-
9ae3a8
 include/block/block.h     |    2 +
9ae3a8
 include/block/block_int.h |    2 +-
9ae3a8
 13 files changed, 59 insertions(+), 45 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index f5d6658..772f5b7 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -3010,15 +3010,15 @@ int bdrv_has_zero_init(BlockDriverState *bs)
9ae3a8
     return 1;
9ae3a8
 }
9ae3a8
 
9ae3a8
-typedef struct BdrvCoIsAllocatedData {
9ae3a8
+typedef struct BdrvCoGetBlockStatusData {
9ae3a8
     BlockDriverState *bs;
9ae3a8
     BlockDriverState *base;
9ae3a8
     int64_t sector_num;
9ae3a8
     int nb_sectors;
9ae3a8
     int *pnum;
9ae3a8
-    int ret;
9ae3a8
+    int64_t ret;
9ae3a8
     bool done;
9ae3a8
-} BdrvCoIsAllocatedData;
9ae3a8
+} BdrvCoGetBlockStatusData;
9ae3a8
 
9ae3a8
 /*
9ae3a8
  * Returns true iff the specified sector is present in the disk image. Drivers
9ae3a8
@@ -3035,9 +3035,9 @@ typedef struct BdrvCoIsAllocatedData {
9ae3a8
  * 'nb_sectors' is the max value 'pnum' should be set to.  If nb_sectors goes
9ae3a8
  * beyond the end of the disk image it will be clamped.
9ae3a8
  */
9ae3a8
-static int coroutine_fn bdrv_co_is_allocated(BlockDriverState *bs,
9ae3a8
-                                             int64_t sector_num,
9ae3a8
-                                             int nb_sectors, int *pnum)
9ae3a8
+static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
9ae3a8
+                                                     int64_t sector_num,
9ae3a8
+                                                     int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
     int64_t length;
9ae3a8
     int64_t n;
9ae3a8
@@ -3057,35 +3057,35 @@ static int coroutine_fn bdrv_co_is_allocated(BlockDriverState *bs,
9ae3a8
         nb_sectors = n;
9ae3a8
     }
9ae3a8
 
9ae3a8
-    if (!bs->drv->bdrv_co_is_allocated) {
9ae3a8
+    if (!bs->drv->bdrv_co_get_block_status) {
9ae3a8
         *pnum = nb_sectors;
9ae3a8
         return 1;
9ae3a8
     }
9ae3a8
 
9ae3a8
-    return bs->drv->bdrv_co_is_allocated(bs, sector_num, nb_sectors, pnum);
9ae3a8
+    return bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);
9ae3a8
 }
9ae3a8
 
9ae3a8
-/* Coroutine wrapper for bdrv_is_allocated() */
9ae3a8
-static void coroutine_fn bdrv_is_allocated_co_entry(void *opaque)
9ae3a8
+/* Coroutine wrapper for bdrv_get_block_status() */
9ae3a8
+static void coroutine_fn bdrv_get_block_status_co_entry(void *opaque)
9ae3a8
 {
9ae3a8
-    BdrvCoIsAllocatedData *data = opaque;
9ae3a8
+    BdrvCoGetBlockStatusData *data = opaque;
9ae3a8
     BlockDriverState *bs = data->bs;
9ae3a8
 
9ae3a8
-    data->ret = bdrv_co_is_allocated(bs, data->sector_num, data->nb_sectors,
9ae3a8
-                                     data->pnum);
9ae3a8
+    data->ret = bdrv_co_get_block_status(bs, data->sector_num, data->nb_sectors,
9ae3a8
+                                         data->pnum);
9ae3a8
     data->done = true;
9ae3a8
 }
9ae3a8
 
9ae3a8
 /*
9ae3a8
- * Synchronous wrapper around bdrv_co_is_allocated().
9ae3a8
+ * Synchronous wrapper around bdrv_co_get_block_status().
9ae3a8
  *
9ae3a8
- * See bdrv_co_is_allocated() for details.
9ae3a8
+ * See bdrv_co_get_block_status() for details.
9ae3a8
  */
9ae3a8
-int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
9ae3a8
-                      int *pnum)
9ae3a8
+int64_t bdrv_get_block_status(BlockDriverState *bs, int64_t sector_num,
9ae3a8
+                              int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
     Coroutine *co;
9ae3a8
-    BdrvCoIsAllocatedData data = {
9ae3a8
+    BdrvCoGetBlockStatusData data = {
9ae3a8
         .bs = bs,
9ae3a8
         .sector_num = sector_num,
9ae3a8
         .nb_sectors = nb_sectors,
9ae3a8
@@ -3095,9 +3095,9 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
9ae3a8
 
9ae3a8
     if (qemu_in_coroutine()) {
9ae3a8
         /* Fast-path if already in coroutine context */
9ae3a8
-        bdrv_is_allocated_co_entry(&data);
9ae3a8
+        bdrv_get_block_status_co_entry(&data);
9ae3a8
     } else {
9ae3a8
-        co = qemu_coroutine_create(bdrv_is_allocated_co_entry);
9ae3a8
+        co = qemu_coroutine_create(bdrv_get_block_status_co_entry);
9ae3a8
         qemu_coroutine_enter(co, &data);
9ae3a8
         while (!data.done) {
9ae3a8
             qemu_aio_wait();
9ae3a8
@@ -3106,6 +3106,12 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
9ae3a8
     return data.ret;
9ae3a8
 }
9ae3a8
 
9ae3a8
+int coroutine_fn bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,
9ae3a8
+                                   int nb_sectors, int *pnum)
9ae3a8
+{
9ae3a8
+    return bdrv_get_block_status(bs, sector_num, nb_sectors, pnum);
9ae3a8
+}
9ae3a8
+
9ae3a8
 /*
9ae3a8
  * Given an image chain: ... -> [BASE] -> [INTER1] -> [INTER2] -> [TOP]
9ae3a8
  *
9ae3a8
diff --git a/block/cow.c b/block/cow.c
9ae3a8
index 5a33b46..5e71c76 100644
9ae3a8
--- a/block/cow.c
9ae3a8
+++ b/block/cow.c
9ae3a8
@@ -188,6 +188,12 @@ static int coroutine_fn cow_co_is_allocated(BlockDriverState *bs,
9ae3a8
     return changed;
9ae3a8
 }
9ae3a8
 
9ae3a8
+static int64_t coroutine_fn cow_co_get_block_status(BlockDriverState *bs,
9ae3a8
+        int64_t sector_num, int nb_sectors, int *num_same)
9ae3a8
+{
9ae3a8
+    return cow_co_is_allocated(bs, sector_num, nb_sectors, num_same);
9ae3a8
+}
9ae3a8
+
9ae3a8
 static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num,
9ae3a8
         int nb_sectors)
9ae3a8
 {
9ae3a8
@@ -370,7 +376,7 @@ static BlockDriver bdrv_cow = {
9ae3a8
 
9ae3a8
     .bdrv_read              = cow_co_read,
9ae3a8
     .bdrv_write             = cow_co_write,
9ae3a8
-    .bdrv_co_is_allocated   = cow_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status   = cow_co_get_block_status,
9ae3a8
 
9ae3a8
     .create_options = cow_create_options,
9ae3a8
 };
9ae3a8
diff --git a/block/qcow.c b/block/qcow.c
9ae3a8
index e2a64c7..05af25c 100644
9ae3a8
--- a/block/qcow.c
9ae3a8
+++ b/block/qcow.c
9ae3a8
@@ -395,7 +395,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
9ae3a8
     return cluster_offset;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn qcow_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn qcow_co_get_block_status(BlockDriverState *bs,
9ae3a8
         int64_t sector_num, int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
     BDRVQcowState *s = bs->opaque;
9ae3a8
@@ -895,7 +895,7 @@ static BlockDriver bdrv_qcow = {
9ae3a8
 
9ae3a8
     .bdrv_co_readv          = qcow_co_readv,
9ae3a8
     .bdrv_co_writev         = qcow_co_writev,
9ae3a8
-    .bdrv_co_is_allocated   = qcow_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status   = qcow_co_get_block_status,
9ae3a8
 
9ae3a8
     .bdrv_set_key           = qcow_set_key,
9ae3a8
     .bdrv_make_empty        = qcow_make_empty,
9ae3a8
diff --git a/block/qcow2.c b/block/qcow2.c
9ae3a8
index f6e64d2..8d3bf5d 100644
9ae3a8
--- a/block/qcow2.c
9ae3a8
+++ b/block/qcow2.c
9ae3a8
@@ -640,7 +640,7 @@ static int qcow2_reopen_prepare(BDRVReopenState *state,
9ae3a8
     return 0;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn qcow2_co_get_block_status(BlockDriverState *bs,
9ae3a8
         int64_t sector_num, int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
     BDRVQcowState *s = bs->opaque;
9ae3a8
@@ -1786,7 +1786,7 @@ static BlockDriver bdrv_qcow2 = {
9ae3a8
     .bdrv_close         = qcow2_close,
9ae3a8
     .bdrv_reopen_prepare  = qcow2_reopen_prepare,
9ae3a8
     .bdrv_create        = qcow2_create,
9ae3a8
-    .bdrv_co_is_allocated = qcow2_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = qcow2_co_get_block_status,
9ae3a8
     .bdrv_set_key       = qcow2_set_key,
9ae3a8
     .bdrv_make_empty    = qcow2_make_empty,
9ae3a8
 
9ae3a8
diff --git a/block/qed.c b/block/qed.c
9ae3a8
index 4651403..a573039 100644
9ae3a8
--- a/block/qed.c
9ae3a8
+++ b/block/qed.c
9ae3a8
@@ -667,7 +667,7 @@ static void qed_is_allocated_cb(void *opaque, int ret, uint64_t offset, size_t l
9ae3a8
     }
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn bdrv_qed_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn bdrv_qed_co_get_block_status(BlockDriverState *bs,
9ae3a8
                                                  int64_t sector_num,
9ae3a8
                                                  int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
@@ -1574,7 +1574,7 @@ static BlockDriver bdrv_qed = {
9ae3a8
     .bdrv_close               = bdrv_qed_close,
9ae3a8
     .bdrv_reopen_prepare      = bdrv_qed_reopen_prepare,
9ae3a8
     .bdrv_create              = bdrv_qed_create,
9ae3a8
-    .bdrv_co_is_allocated     = bdrv_qed_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = bdrv_qed_co_get_block_status,
9ae3a8
     .bdrv_make_empty          = bdrv_qed_make_empty,
9ae3a8
     .bdrv_aio_readv           = bdrv_qed_aio_readv,
9ae3a8
     .bdrv_aio_writev          = bdrv_qed_aio_writev,
9ae3a8
diff --git a/block/raw-posix.c b/block/raw-posix.c
9ae3a8
index 90ce9f8..9a7c5a8 100644
9ae3a8
--- a/block/raw-posix.c
9ae3a8
+++ b/block/raw-posix.c
9ae3a8
@@ -1084,7 +1084,7 @@ static int raw_create(const char *filename, QEMUOptionParameter *options)
9ae3a8
  * 'nb_sectors' is the max value 'pnum' should be set to.  If nb_sectors goes
9ae3a8
  * beyond the end of the disk image it will be clamped.
9ae3a8
  */
9ae3a8
-static int coroutine_fn raw_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
9ae3a8
                                             int64_t sector_num,
9ae3a8
                                             int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
@@ -1199,7 +1199,7 @@ static BlockDriver bdrv_file = {
9ae3a8
     .bdrv_reopen_abort = raw_reopen_abort,
9ae3a8
     .bdrv_close = raw_close,
9ae3a8
     .bdrv_create = raw_create,
9ae3a8
-    .bdrv_co_is_allocated = raw_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = raw_co_get_block_status,
9ae3a8
 
9ae3a8
     .bdrv_aio_readv = raw_aio_readv,
9ae3a8
     .bdrv_aio_writev = raw_aio_writev,
9ae3a8
diff --git a/block/raw.c b/block/raw.c
9ae3a8
index f78ff39..844a222 100644
9ae3a8
--- a/block/raw.c
9ae3a8
+++ b/block/raw.c
9ae3a8
@@ -35,11 +35,11 @@ static void raw_close(BlockDriverState *bs)
9ae3a8
 {
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn raw_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
9ae3a8
                                             int64_t sector_num,
9ae3a8
                                             int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
-    return bdrv_is_allocated(bs->file, sector_num, nb_sectors, pnum);
9ae3a8
+    return bdrv_get_block_status(bs->file, sector_num, nb_sectors, pnum);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static int coroutine_fn raw_co_write_zeroes(BlockDriverState *bs,
9ae3a8
@@ -134,7 +134,7 @@ static BlockDriver bdrv_raw = {
9ae3a8
 
9ae3a8
     .bdrv_co_readv          = raw_co_readv,
9ae3a8
     .bdrv_co_writev         = raw_co_writev,
9ae3a8
-    .bdrv_co_is_allocated   = raw_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status   = raw_co_get_block_status,
9ae3a8
     .bdrv_co_write_zeroes   = raw_co_write_zeroes,
9ae3a8
     .bdrv_co_discard        = raw_co_discard,
9ae3a8
 
9ae3a8
diff --git a/block/sheepdog.c b/block/sheepdog.c
9ae3a8
index 2758c26..e5398bb 100644
9ae3a8
--- a/block/sheepdog.c
9ae3a8
+++ b/block/sheepdog.c
9ae3a8
@@ -2289,9 +2289,9 @@ static coroutine_fn int sd_co_discard(BlockDriverState *bs, int64_t sector_num,
9ae3a8
     return acb->ret;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static coroutine_fn int
9ae3a8
-sd_co_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
9ae3a8
-                   int *pnum)
9ae3a8
+static coroutine_fn int64_t
9ae3a8
+sd_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
9ae3a8
+                       int *pnum)
9ae3a8
 {
9ae3a8
     BDRVSheepdogState *s = bs->opaque;
9ae3a8
     SheepdogInode *inode = &s->inode;
9ae3a8
@@ -2356,7 +2356,7 @@ static BlockDriver bdrv_sheepdog = {
9ae3a8
     .bdrv_co_writev = sd_co_writev,
9ae3a8
     .bdrv_co_flush_to_disk  = sd_co_flush_to_disk,
9ae3a8
     .bdrv_co_discard = sd_co_discard,
9ae3a8
-    .bdrv_co_is_allocated = sd_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = sd_co_get_block_status,
9ae3a8
 
9ae3a8
     .bdrv_snapshot_create   = sd_snapshot_create,
9ae3a8
     .bdrv_snapshot_goto     = sd_snapshot_goto,
9ae3a8
@@ -2383,7 +2383,7 @@ static BlockDriver bdrv_sheepdog_tcp = {
9ae3a8
     .bdrv_co_writev = sd_co_writev,
9ae3a8
     .bdrv_co_flush_to_disk  = sd_co_flush_to_disk,
9ae3a8
     .bdrv_co_discard = sd_co_discard,
9ae3a8
-    .bdrv_co_is_allocated = sd_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = sd_co_get_block_status,
9ae3a8
 
9ae3a8
     .bdrv_snapshot_create   = sd_snapshot_create,
9ae3a8
     .bdrv_snapshot_goto     = sd_snapshot_goto,
9ae3a8
@@ -2410,7 +2410,7 @@ static BlockDriver bdrv_sheepdog_unix = {
9ae3a8
     .bdrv_co_writev = sd_co_writev,
9ae3a8
     .bdrv_co_flush_to_disk  = sd_co_flush_to_disk,
9ae3a8
     .bdrv_co_discard = sd_co_discard,
9ae3a8
-    .bdrv_co_is_allocated = sd_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = sd_co_get_block_status,
9ae3a8
 
9ae3a8
     .bdrv_snapshot_create   = sd_snapshot_create,
9ae3a8
     .bdrv_snapshot_goto     = sd_snapshot_goto,
9ae3a8
diff --git a/block/vdi.c b/block/vdi.c
9ae3a8
index 2662d89..1252ad4 100644
9ae3a8
--- a/block/vdi.c
9ae3a8
+++ b/block/vdi.c
9ae3a8
@@ -470,7 +470,7 @@ static int vdi_reopen_prepare(BDRVReopenState *state,
9ae3a8
     return 0;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn vdi_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn vdi_co_get_block_status(BlockDriverState *bs,
9ae3a8
         int64_t sector_num, int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
     /* TODO: Check for too large sector_num (in bdrv_is_allocated or here). */
9ae3a8
@@ -779,7 +779,7 @@ static BlockDriver bdrv_vdi = {
9ae3a8
     .bdrv_close = vdi_close,
9ae3a8
     .bdrv_reopen_prepare = vdi_reopen_prepare,
9ae3a8
     .bdrv_create = vdi_create,
9ae3a8
-    .bdrv_co_is_allocated = vdi_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = vdi_co_get_block_status,
9ae3a8
     .bdrv_make_empty = vdi_make_empty,
9ae3a8
 
9ae3a8
     .bdrv_read = vdi_co_read,
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index 66735ab..a30c3b9 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -1042,7 +1042,7 @@ static VmdkExtent *find_extent(BDRVVmdkState *s,
9ae3a8
     return NULL;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn vmdk_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn vmdk_co_get_block_status(BlockDriverState *bs,
9ae3a8
         int64_t sector_num, int nb_sectors, int *pnum)
9ae3a8
 {
9ae3a8
     BDRVVmdkState *s = bs->opaque;
9ae3a8
@@ -1820,7 +1820,7 @@ static BlockDriver bdrv_vmdk = {
9ae3a8
     .bdrv_close     = vmdk_close,
9ae3a8
     .bdrv_create    = vmdk_create,
9ae3a8
     .bdrv_co_flush_to_disk  = vmdk_co_flush,
9ae3a8
-    .bdrv_co_is_allocated   = vmdk_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = vmdk_co_get_block_status,
9ae3a8
     .bdrv_get_allocated_file_size  = vmdk_get_allocated_file_size,
9ae3a8
 
9ae3a8
     .create_options = vmdk_create_options,
9ae3a8
diff --git a/block/vvfat.c b/block/vvfat.c
9ae3a8
index 87b0279..510a559 100644
9ae3a8
--- a/block/vvfat.c
9ae3a8
+++ b/block/vvfat.c
9ae3a8
@@ -2874,7 +2874,7 @@ static coroutine_fn int vvfat_co_write(BlockDriverState *bs, int64_t sector_num,
9ae3a8
     return ret;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static int coroutine_fn vvfat_co_is_allocated(BlockDriverState *bs,
9ae3a8
+static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs,
9ae3a8
 	int64_t sector_num, int nb_sectors, int* n)
9ae3a8
 {
9ae3a8
     BDRVVVFATState* s = bs->opaque;
9ae3a8
@@ -2981,7 +2981,7 @@ static BlockDriver bdrv_vvfat = {
9ae3a8
 
9ae3a8
     .bdrv_read              = vvfat_co_read,
9ae3a8
     .bdrv_write             = vvfat_co_write,
9ae3a8
-    .bdrv_co_is_allocated   = vvfat_co_is_allocated,
9ae3a8
+    .bdrv_co_get_block_status = vvfat_co_get_block_status,
9ae3a8
 };
9ae3a8
 
9ae3a8
 static void bdrv_vvfat_init(void)
9ae3a8
diff --git a/include/block/block.h b/include/block/block.h
9ae3a8
index ec4d4aa..a733f5f 100644
9ae3a8
--- a/include/block/block.h
9ae3a8
+++ b/include/block/block.h
9ae3a8
@@ -281,6 +281,8 @@ void bdrv_drain_all(void);
9ae3a8
 int bdrv_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors);
9ae3a8
 int bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors);
9ae3a8
 int bdrv_has_zero_init(BlockDriverState *bs);
9ae3a8
+int64_t bdrv_get_block_status(BlockDriverState *bs, int64_t sector_num,
9ae3a8
+                              int nb_sectors, int *pnum);
9ae3a8
 int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
9ae3a8
                       int *pnum);
9ae3a8
 int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base,
9ae3a8
diff --git a/include/block/block_int.h b/include/block/block_int.h
9ae3a8
index 267be48..ea2c811 100644
9ae3a8
--- a/include/block/block_int.h
9ae3a8
+++ b/include/block/block_int.h
9ae3a8
@@ -124,7 +124,7 @@ struct BlockDriver {
9ae3a8
         int64_t sector_num, int nb_sectors);
9ae3a8
     int coroutine_fn (*bdrv_co_discard)(BlockDriverState *bs,
9ae3a8
         int64_t sector_num, int nb_sectors);
9ae3a8
-    int coroutine_fn (*bdrv_co_is_allocated)(BlockDriverState *bs,
9ae3a8
+    int64_t coroutine_fn (*bdrv_co_get_block_status)(BlockDriverState *bs,
9ae3a8
         int64_t sector_num, int nb_sectors, int *pnum);
9ae3a8
 
9ae3a8
     /*
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8