qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 28/47] block/null: Implement bdrv_get_allocated_file_size


From: Andrey Shinkevich
Subject: Re: [PATCH v7 28/47] block/null: Implement bdrv_get_allocated_file_size
Date: Mon, 20 Jul 2020 18:10:27 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 25.06.2020 18:21, Max Reitz wrote:
It is trivial, so we might as well do it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
  block/null.c               | 7 +++++++
  tests/qemu-iotests/153.out | 2 +-
  tests/qemu-iotests/184.out | 6 ++++--
  3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/block/null.c b/block/null.c
index 15e1d56746..cc9b1d4ea7 100644
--- a/block/null.c
+++ b/block/null.c
@@ -262,6 +262,11 @@ static void null_refresh_filename(BlockDriverState *bs)
               bs->drv->format_name);
  }
+static int64_t null_allocated_file_size(BlockDriverState *bs)
+{
+    return 0;
+}
+
  static const char *const null_strong_runtime_opts[] = {
      BLOCK_OPT_SIZE,
      NULL_OPT_ZEROES,
@@ -277,6 +282,7 @@ static BlockDriver bdrv_null_co = {
      .bdrv_file_open         = null_file_open,
      .bdrv_parse_filename    = null_co_parse_filename,
      .bdrv_getlength         = null_getlength,
+    .bdrv_get_allocated_file_size = null_allocated_file_size,
.bdrv_co_preadv = null_co_preadv,
      .bdrv_co_pwritev        = null_co_pwritev,
@@ -297,6 +303,7 @@ static BlockDriver bdrv_null_aio = {
      .bdrv_file_open         = null_file_open,
      .bdrv_parse_filename    = null_aio_parse_filename,
      .bdrv_getlength         = null_getlength,
+    .bdrv_get_allocated_file_size = null_allocated_file_size,
.bdrv_aio_preadv = null_aio_preadv,
      .bdrv_aio_pwritev       = null_aio_pwritev,
diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out
index b2a90caa6b..8659e6463b 100644
--- a/tests/qemu-iotests/153.out
+++ b/tests/qemu-iotests/153.out
@@ -461,7 +461,7 @@ No conflict:
  image: null-co://
  file format: null-co
  virtual size: 1 GiB (1073741824 bytes)
-disk size: unavailable
+disk size: 0 B
Conflict:
  qemu-img: --force-share/-U conflicts with image options
diff --git a/tests/qemu-iotests/184.out b/tests/qemu-iotests/184.out
index 3deb3cfb94..28b104da89 100644
--- a/tests/qemu-iotests/184.out
+++ b/tests/qemu-iotests/184.out
@@ -29,7 +29,8 @@ Testing:
              "image": {
                  "virtual-size": 1073741824,
                  "filename": "json:{\"throttle-group\": \"group0\", \"driver\": \"throttle\", \"file\": 
{\"driver\": \"null-co\"}}",
-                "format": "throttle"
+                "format": "throttle",
+                "actual-size": SIZE


If we remove the _filter_generated_node_ids() in the current implementation of the test #184, we will get '"actual-size": 0'. It might be more informative when analyzing the output in 184.out.

Andrey


              },
              "iops_wr": 0,
              "ro": false,
@@ -56,7 +57,8 @@ Testing:
              "image": {
                  "virtual-size": 1073741824,
                  "filename": "null-co://",
-                "format": "null-co"
+                "format": "null-co",
+                "actual-size": SIZE
              },
              "iops_wr": 0,
              "ro": false,


Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]