thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Pablo Greco e6a3ae
From 273237507842493f78cd492cd54137e828a986ef Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Date: Fri, 30 Aug 2019 12:56:27 +0100
Pablo Greco e6a3ae
Subject: [PATCH 09/10] block: posix: Always allocate the first block
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190830125628.23668-5-thuth@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 90210
Pablo Greco e6a3ae
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 4/5] block: posix: Always allocate the first block
Pablo Greco e6a3ae
Bugzilla: 1738839
Pablo Greco e6a3ae
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: David Hildenbrand <david@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
From: Nir Soffer <nirsof@gmail.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
When creating an image with preallocation "off" or "falloc", the first
Pablo Greco e6a3ae
block of the image is typically not allocated. When using Gluster
Pablo Greco e6a3ae
storage backed by XFS filesystem, reading this block using direct I/O
Pablo Greco e6a3ae
succeeds regardless of request length, fooling alignment detection.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
In this case we fallback to a safe value (4096) instead of the optimal
Pablo Greco e6a3ae
value (512), which may lead to unneeded data copying when aligning
Pablo Greco e6a3ae
requests.  Allocating the first block avoids the fallback.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Since we allocate the first block even with preallocation=off, we no
Pablo Greco e6a3ae
longer create images with zero disk size:
Pablo Greco e6a3ae
Pablo Greco e6a3ae
    $ ./qemu-img create -f raw test.raw 1g
Pablo Greco e6a3ae
    Formatting 'test.raw', fmt=raw size=1073741824
Pablo Greco e6a3ae
Pablo Greco e6a3ae
    $ ls -lhs test.raw
Pablo Greco e6a3ae
    4.0K -rw-r--r--. 1 nsoffer nsoffer 1.0G Aug 16 23:48 test.raw
Pablo Greco e6a3ae
Pablo Greco e6a3ae
And converting the image requires additional cluster:
Pablo Greco e6a3ae
Pablo Greco e6a3ae
    $ ./qemu-img measure -f raw -O qcow2 test.raw
Pablo Greco e6a3ae
    required size: 458752
Pablo Greco e6a3ae
    fully allocated size: 1074135040
Pablo Greco e6a3ae
Pablo Greco e6a3ae
When using format like vmdk with multiple files per image, we allocate
Pablo Greco e6a3ae
one block per file:
Pablo Greco e6a3ae
Pablo Greco e6a3ae
    $ ./qemu-img create -f vmdk -o subformat=twoGbMaxExtentFlat test.vmdk 4g
Pablo Greco e6a3ae
    Formatting 'test.vmdk', fmt=vmdk size=4294967296 compat6=off hwversion=undefined subformat=twoGbMaxExtentFlat
Pablo Greco e6a3ae
Pablo Greco e6a3ae
    $ ls -lhs test*.vmdk
Pablo Greco e6a3ae
    4.0K -rw-r--r--. 1 nsoffer nsoffer 2.0G Aug 27 03:23 test-f001.vmdk
Pablo Greco e6a3ae
    4.0K -rw-r--r--. 1 nsoffer nsoffer 2.0G Aug 27 03:23 test-f002.vmdk
Pablo Greco e6a3ae
    4.0K -rw-r--r--. 1 nsoffer nsoffer  353 Aug 27 03:23 test.vmdk
Pablo Greco e6a3ae
Pablo Greco e6a3ae
I did quick performance test for copying disks with qemu-img convert to
Pablo Greco e6a3ae
new raw target image to Gluster storage with sector size of 512 bytes:
Pablo Greco e6a3ae
Pablo Greco e6a3ae
    for i in $(seq 10); do
Pablo Greco e6a3ae
        rm -f dst.raw
Pablo Greco e6a3ae
        sleep 10
Pablo Greco e6a3ae
        time ./qemu-img convert -f raw -O raw -t none -T none src.raw dst.raw
Pablo Greco e6a3ae
    done
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Here is a table comparing the total time spent:
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Type    Before(s)   After(s)    Diff(%)
Pablo Greco e6a3ae
---------------------------------------
Pablo Greco e6a3ae
real      530.028    469.123      -11.4
Pablo Greco e6a3ae
user       17.204     10.768      -37.4
Pablo Greco e6a3ae
sys        17.881      7.011      -60.7
Pablo Greco e6a3ae
Pablo Greco e6a3ae
We can see very clear improvement in CPU usage.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Pablo Greco e6a3ae
Message-id: 20190827010528.8818-2-nsoffer@redhat.com
Pablo Greco e6a3ae
Reviewed-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit 3f900188502670a15f8915d5363533512ecd035f)
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Conflicts:
Pablo Greco e6a3ae
	block/file-posix.c (simple contextual conflict)
Pablo Greco e6a3ae
	tests/qemu-iotests/059.out (Needed to adapt output a little bit)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 block/file-posix.c               | 51 ++++++++++++++++++++++++++++++++++++++++
Pablo Greco e6a3ae
 tests/qemu-iotests/059.out       |  2 +-
Pablo Greco e6a3ae
 tests/qemu-iotests/150.out       | 11 ---------
Pablo Greco e6a3ae
 tests/qemu-iotests/150.out.qcow2 | 11 +++++++++
Pablo Greco e6a3ae
 tests/qemu-iotests/150.out.raw   | 12 ++++++++++
Pablo Greco e6a3ae
 tests/qemu-iotests/175           | 19 ++++++++++-----
Pablo Greco e6a3ae
 tests/qemu-iotests/175.out       |  8 +++----
Pablo Greco e6a3ae
 tests/qemu-iotests/178.out.qcow2 |  4 ++--
Pablo Greco e6a3ae
 tests/qemu-iotests/221.out       | 12 ++++++----
Pablo Greco e6a3ae
 tests/qemu-iotests/253.out       | 12 ++++++----
Pablo Greco e6a3ae
 10 files changed, 110 insertions(+), 32 deletions(-)
Pablo Greco e6a3ae
 delete mode 100644 tests/qemu-iotests/150.out
Pablo Greco e6a3ae
 create mode 100644 tests/qemu-iotests/150.out.qcow2
Pablo Greco e6a3ae
 create mode 100644 tests/qemu-iotests/150.out.raw
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/block/file-posix.c b/block/file-posix.c
Pablo Greco e6a3ae
index 84c5a31..dfe0bca 100644
Pablo Greco e6a3ae
--- a/block/file-posix.c
Pablo Greco e6a3ae
+++ b/block/file-posix.c
Pablo Greco e6a3ae
@@ -1605,6 +1605,43 @@ static ssize_t handle_aiocb_discard(RawPosixAIOData *aiocb)
Pablo Greco e6a3ae
     return ret;
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+/*
Pablo Greco e6a3ae
+ * Help alignment probing by allocating the first block.
Pablo Greco e6a3ae
+ *
Pablo Greco e6a3ae
+ * When reading with direct I/O from unallocated area on Gluster backed by XFS,
Pablo Greco e6a3ae
+ * reading succeeds regardless of request length. In this case we fallback to
Pablo Greco e6a3ae
+ * safe alignment which is not optimal. Allocating the first block avoids this
Pablo Greco e6a3ae
+ * fallback.
Pablo Greco e6a3ae
+ *
Pablo Greco e6a3ae
+ * fd may be opened with O_DIRECT, but we don't know the buffer alignment or
Pablo Greco e6a3ae
+ * request alignment, so we use safe values.
Pablo Greco e6a3ae
+ *
Pablo Greco e6a3ae
+ * Returns: 0 on success, -errno on failure. Since this is an optimization,
Pablo Greco e6a3ae
+ * caller may ignore failures.
Pablo Greco e6a3ae
+ */
Pablo Greco e6a3ae
+static int allocate_first_block(int fd, size_t max_size)
Pablo Greco e6a3ae
+{
Pablo Greco e6a3ae
+    size_t write_size = (max_size < MAX_BLOCKSIZE)
Pablo Greco e6a3ae
+        ? BDRV_SECTOR_SIZE
Pablo Greco e6a3ae
+        : MAX_BLOCKSIZE;
Pablo Greco e6a3ae
+    size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize());
Pablo Greco e6a3ae
+    void *buf;
Pablo Greco e6a3ae
+    ssize_t n;
Pablo Greco e6a3ae
+    int ret;
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    buf = qemu_memalign(max_align, write_size);
Pablo Greco e6a3ae
+    memset(buf, 0, write_size);
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    do {
Pablo Greco e6a3ae
+        n = pwrite(fd, buf, write_size, 0);
Pablo Greco e6a3ae
+    } while (n == -1 && errno == EINTR);
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    ret = (n == -1) ? -errno : 0;
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    qemu_vfree(buf);
Pablo Greco e6a3ae
+    return ret;
Pablo Greco e6a3ae
+}
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 static int handle_aiocb_truncate(RawPosixAIOData *aiocb)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     int result = 0;
Pablo Greco e6a3ae
@@ -1642,6 +1679,17 @@ static int handle_aiocb_truncate(RawPosixAIOData *aiocb)
Pablo Greco e6a3ae
                 /* posix_fallocate() doesn't set errno. */
Pablo Greco e6a3ae
                 error_setg_errno(errp, -result,
Pablo Greco e6a3ae
                                  "Could not preallocate new data");
Pablo Greco e6a3ae
+            } else if (current_length == 0) {
Pablo Greco e6a3ae
+                /*
Pablo Greco e6a3ae
+                 * posix_fallocate() uses fallocate() if the filesystem
Pablo Greco e6a3ae
+                 * supports it, or fallback to manually writing zeroes. If
Pablo Greco e6a3ae
+                 * fallocate() was used, unaligned reads from the fallocated
Pablo Greco e6a3ae
+                 * area in raw_probe_alignment() will succeed, hence we need to
Pablo Greco e6a3ae
+                 * allocate the first block.
Pablo Greco e6a3ae
+                 *
Pablo Greco e6a3ae
+                 * Optimize future alignment probing; ignore failures.
Pablo Greco e6a3ae
+                 */
Pablo Greco e6a3ae
+                allocate_first_block(fd, offset);
Pablo Greco e6a3ae
             }
Pablo Greco e6a3ae
         } else {
Pablo Greco e6a3ae
             result = 0;
Pablo Greco e6a3ae
@@ -1700,6 +1748,9 @@ static int handle_aiocb_truncate(RawPosixAIOData *aiocb)
Pablo Greco e6a3ae
         if (ftruncate(fd, offset) != 0) {
Pablo Greco e6a3ae
             result = -errno;
Pablo Greco e6a3ae
             error_setg_errno(errp, -result, "Could not resize file");
Pablo Greco e6a3ae
+        } else if (current_length == 0 && offset > current_length) {
Pablo Greco e6a3ae
+            /* Optimize future alignment probing; ignore failures. */
Pablo Greco e6a3ae
+            allocate_first_block(fd, offset);
Pablo Greco e6a3ae
         }
Pablo Greco e6a3ae
         return result;
Pablo Greco e6a3ae
     default:
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
Pablo Greco e6a3ae
index f6dce79..19cd591 100644
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/059.out
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/059.out
Pablo Greco e6a3ae
@@ -27,7 +27,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMax
Pablo Greco e6a3ae
 image: TEST_DIR/t.vmdk
Pablo Greco e6a3ae
 file format: vmdk
Pablo Greco e6a3ae
 virtual size: 1.0T (1073741824000 bytes)
Pablo Greco e6a3ae
-disk size: 16K
Pablo Greco e6a3ae
+disk size: 2.0M
Pablo Greco e6a3ae
 Format specific information:
Pablo Greco e6a3ae
     cid: XXXXXXXX
Pablo Greco e6a3ae
     parent cid: XXXXXXXX
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/150.out b/tests/qemu-iotests/150.out
Pablo Greco e6a3ae
deleted file mode 100644
Pablo Greco e6a3ae
index 2a54e8d..0000000
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/150.out
Pablo Greco e6a3ae
+++ /dev/null
Pablo Greco e6a3ae
@@ -1,11 +0,0 @@
Pablo Greco e6a3ae
-QA output created by 150
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-=== Mapping sparse conversion ===
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-Offset          Length          File
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-=== Mapping non-sparse conversion ===
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-Offset          Length          File
Pablo Greco e6a3ae
-0               0x100000        TEST_DIR/t.IMGFMT
Pablo Greco e6a3ae
-*** done
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/150.out.qcow2 b/tests/qemu-iotests/150.out.qcow2
Pablo Greco e6a3ae
new file mode 100644
Pablo Greco e6a3ae
index 0000000..2a54e8d
Pablo Greco e6a3ae
--- /dev/null
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/150.out.qcow2
Pablo Greco e6a3ae
@@ -0,0 +1,11 @@
Pablo Greco e6a3ae
+QA output created by 150
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+=== Mapping sparse conversion ===
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+Offset          Length          File
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+=== Mapping non-sparse conversion ===
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+Offset          Length          File
Pablo Greco e6a3ae
+0               0x100000        TEST_DIR/t.IMGFMT
Pablo Greco e6a3ae
+*** done
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/150.out.raw b/tests/qemu-iotests/150.out.raw
Pablo Greco e6a3ae
new file mode 100644
Pablo Greco e6a3ae
index 0000000..3cdc772
Pablo Greco e6a3ae
--- /dev/null
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/150.out.raw
Pablo Greco e6a3ae
@@ -0,0 +1,12 @@
Pablo Greco e6a3ae
+QA output created by 150
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+=== Mapping sparse conversion ===
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+Offset          Length          File
Pablo Greco e6a3ae
+0               0x1000          TEST_DIR/t.IMGFMT
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+=== Mapping non-sparse conversion ===
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+Offset          Length          File
Pablo Greco e6a3ae
+0               0x100000        TEST_DIR/t.IMGFMT
Pablo Greco e6a3ae
+*** done
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
Pablo Greco e6a3ae
index 2e37c9a..b3b7712 100755
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/175
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/175
Pablo Greco e6a3ae
@@ -38,14 +38,16 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
Pablo Greco e6a3ae
 # the file size.  This function hides the resulting difference in the
Pablo Greco e6a3ae
 # stat -c '%b' output.
Pablo Greco e6a3ae
 # Parameter 1: Number of blocks an empty file occupies
Pablo Greco e6a3ae
-# Parameter 2: Image size in bytes
Pablo Greco e6a3ae
+# Parameter 2: Minimal number of blocks in an image
Pablo Greco e6a3ae
+# Parameter 3: Image size in bytes
Pablo Greco e6a3ae
 _filter_blocks()
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     extra_blocks=$1
Pablo Greco e6a3ae
-    img_size=$2
Pablo Greco e6a3ae
+    min_blocks=$2
Pablo Greco e6a3ae
+    img_size=$3
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    sed -e "s/blocks=$extra_blocks\\(\$\\|[^0-9]\\)/nothing allocated/" \
Pablo Greco e6a3ae
-        -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/everything allocated/"
Pablo Greco e6a3ae
+    sed -e "s/blocks=$min_blocks\\(\$\\|[^0-9]\\)/min allocation/" \
Pablo Greco e6a3ae
+        -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/max allocation/"
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 # get standard environment, filters and checks
Pablo Greco e6a3ae
@@ -61,16 +63,21 @@ size=$((1 * 1024 * 1024))
Pablo Greco e6a3ae
 touch "$TEST_DIR/empty"
Pablo Greco e6a3ae
 extra_blocks=$(stat -c '%b' "$TEST_DIR/empty")
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+# We always write the first byte; check how many blocks this filesystem
Pablo Greco e6a3ae
+# allocates to match empty image alloation.
Pablo Greco e6a3ae
+printf "\0" > "$TEST_DIR/empty"
Pablo Greco e6a3ae
+min_blocks=$(stat -c '%b' "$TEST_DIR/empty")
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 echo
Pablo Greco e6a3ae
 echo "== creating image with default preallocation =="
Pablo Greco e6a3ae
 _make_test_img $size | _filter_imgfmt
Pablo Greco e6a3ae
-stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $size
Pablo Greco e6a3ae
+stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 for mode in off full falloc; do
Pablo Greco e6a3ae
     echo
Pablo Greco e6a3ae
     echo "== creating image with preallocation $mode =="
Pablo Greco e6a3ae
     IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt
Pablo Greco e6a3ae
-    stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $size
Pablo Greco e6a3ae
+    stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size
Pablo Greco e6a3ae
 done
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 # success, all done
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out
Pablo Greco e6a3ae
index 6d9a5ed..263e521 100644
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/175.out
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/175.out
Pablo Greco e6a3ae
@@ -2,17 +2,17 @@ QA output created by 175
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 == creating image with default preallocation ==
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
Pablo Greco e6a3ae
-size=1048576, nothing allocated
Pablo Greco e6a3ae
+size=1048576, min allocation
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 == creating image with preallocation off ==
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off
Pablo Greco e6a3ae
-size=1048576, nothing allocated
Pablo Greco e6a3ae
+size=1048576, min allocation
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 == creating image with preallocation full ==
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full
Pablo Greco e6a3ae
-size=1048576, everything allocated
Pablo Greco e6a3ae
+size=1048576, max allocation
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 == creating image with preallocation falloc ==
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc
Pablo Greco e6a3ae
-size=1048576, everything allocated
Pablo Greco e6a3ae
+size=1048576, max allocation
Pablo Greco e6a3ae
  *** done
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/178.out.qcow2 b/tests/qemu-iotests/178.out.qcow2
Pablo Greco e6a3ae
index d42d4a4..12edc3d 100644
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/178.out.qcow2
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/178.out.qcow2
Pablo Greco e6a3ae
@@ -96,7 +96,7 @@ converted image file size in bytes: 196608
Pablo Greco e6a3ae
 == raw input image with data (human) ==
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.qcow2', fmt=IMGFMT size=1073741824
Pablo Greco e6a3ae
-required size: 393216
Pablo Greco e6a3ae
+required size: 458752
Pablo Greco e6a3ae
 fully allocated size: 1074135040
Pablo Greco e6a3ae
 wrote 512/512 bytes at offset 512
Pablo Greco e6a3ae
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Pablo Greco e6a3ae
@@ -240,7 +240,7 @@ converted image file size in bytes: 196608
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.qcow2', fmt=IMGFMT size=1073741824
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
-    "required": 393216,
Pablo Greco e6a3ae
+    "required": 458752,
Pablo Greco e6a3ae
     "fully-allocated": 1074135040
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 wrote 512/512 bytes at offset 512
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/221.out b/tests/qemu-iotests/221.out
Pablo Greco e6a3ae
index 9f9dd52..dca024a 100644
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/221.out
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/221.out
Pablo Greco e6a3ae
@@ -3,14 +3,18 @@ QA output created by 221
Pablo Greco e6a3ae
 === Check mapping of unaligned raw image ===
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65537
Pablo Greco e6a3ae
-[{ "start": 0, "length": 66048, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
-[{ "start": 0, "length": 66048, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 61952, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 61952, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
 wrote 1/1 bytes at offset 65536
Pablo Greco e6a3ae
 1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Pablo Greco e6a3ae
-[{ "start": 0, "length": 65536, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 61440, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
 { "start": 65536, "length": 1, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
 { "start": 65537, "length": 511, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
-[{ "start": 0, "length": 65536, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 61440, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
 { "start": 65536, "length": 1, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
 { "start": 65537, "length": 511, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
 *** done
Pablo Greco e6a3ae
diff --git a/tests/qemu-iotests/253.out b/tests/qemu-iotests/253.out
Pablo Greco e6a3ae
index 607c0ba..3d08b30 100644
Pablo Greco e6a3ae
--- a/tests/qemu-iotests/253.out
Pablo Greco e6a3ae
+++ b/tests/qemu-iotests/253.out
Pablo Greco e6a3ae
@@ -3,12 +3,16 @@ QA output created by 253
Pablo Greco e6a3ae
 === Check mapping of unaligned raw image ===
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048575
Pablo Greco e6a3ae
-[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
-[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
Pablo Greco e6a3ae
 wrote 65535/65535 bytes at offset 983040
Pablo Greco e6a3ae
 63.999 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Pablo Greco e6a3ae
-[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 978944, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
 { "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}]
Pablo Greco e6a3ae
-[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
Pablo Greco e6a3ae
+{ "start": 4096, "length": 978944, "depth": 0, "zero": true, "data": false, "offset": OFFSET},
Pablo Greco e6a3ae
 { "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}]
Pablo Greco e6a3ae
 *** done
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae