thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
958e1b
From bacd188daed3fa0558836cbb6f7175155355c3d2 Mon Sep 17 00:00:00 2001
958e1b
Message-Id: <bacd188daed3fa0558836cbb6f7175155355c3d2.1418766606.git.jen@redhat.com>
958e1b
In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
958e1b
References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
958e1b
From: Fam Zheng <famz@redhat.com>
958e1b
Date: Thu, 4 Dec 2014 00:05:00 -0600
958e1b
Subject: [CHANGE 06/31] vmdk: Fix big flat extent IO
958e1b
To: rhvirt-patches@redhat.com,
958e1b
    jen@redhat.com
958e1b
958e1b
RH-Author: Fam Zheng <famz@redhat.com>
958e1b
Message-id: <1417651524-18041-7-git-send-email-famz@redhat.com>
958e1b
Patchwork-id: 62679
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 06/30] vmdk: Fix big flat extent IO
958e1b
Bugzilla: 1134241
958e1b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
958e1b
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
958e1b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
958e1b
958e1b
Local variable "n" as int64_t avoids overflow with large sector number
958e1b
calculation. See test case change for failure case.
958e1b
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
958e1b
(cherry picked from commit 585ea0c841df47c1542d33e17c5c6d532316ef74)
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
958e1b
---
958e1b
 block/vmdk.c               |  4 +--
958e1b
 tests/qemu-iotests/059     |  7 +++++
958e1b
 tests/qemu-iotests/059.out | 74 ++++++++++++++++++++++++++++++++++++++++++++++
958e1b
 3 files changed, 83 insertions(+), 2 deletions(-)
958e1b
958e1b
diff --git a/block/vmdk.c b/block/vmdk.c
958e1b
index d77eb37..4226baa 100644
958e1b
--- a/block/vmdk.c
958e1b
+++ b/block/vmdk.c
958e1b
@@ -1344,8 +1344,8 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
958e1b
 {
958e1b
     BDRVVmdkState *s = bs->opaque;
958e1b
     VmdkExtent *extent = NULL;
958e1b
-    int n, ret;
958e1b
-    int64_t index_in_cluster;
958e1b
+    int ret;
958e1b
+    int64_t index_in_cluster, n;
958e1b
     uint64_t extent_begin_sector, extent_relative_sector_num;
958e1b
     uint64_t cluster_offset;
958e1b
     VmdkMetaData m_data;
958e1b
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
958e1b
index 9ef848b..dde4a59 100755
958e1b
--- a/tests/qemu-iotests/059
958e1b
+++ b/tests/qemu-iotests/059
958e1b
@@ -102,6 +102,13 @@ echo "=== Testing version 3 ==="
958e1b
 _use_sample_img iotest-version3.vmdk.bz2
958e1b
 _img_info
958e1b
 
958e1b
+echo
958e1b
+echo "=== Testing 4TB monolithicFlat creation and IO ==="
958e1b
+IMGOPTS="subformat=monolithicFlat" _make_test_img 4T
958e1b
+_img_info
958e1b
+$QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io
958e1b
+$QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io
958e1b
+
958e1b
 # success, all done
958e1b
 echo "*** done"
958e1b
 rm -f $seq.full
958e1b
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
958e1b
index f161651..75d9858 100644
958e1b
--- a/tests/qemu-iotests/059.out
958e1b
+++ b/tests/qemu-iotests/059.out
958e1b
@@ -2047,4 +2047,78 @@ RW 12582912 VMFS "dummy.IMGFMT" 1
958e1b
 image: TEST_DIR/iotest-version3.IMGFMT
958e1b
 file format: IMGFMT
958e1b
 virtual size: 1.0G (1073741824 bytes)
958e1b
+
958e1b
+=== Testing 4TB monolithicFlat creation and IO ===
958e1b
+Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104
958e1b
+image: TEST_DIR/iotest-version3.IMGFMT
958e1b
+file format: IMGFMT
958e1b
+virtual size: 4.0T (4398046511104 bytes)
958e1b
+wrote 512/512 bytes at offset 966367641600
958e1b
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
958e1b
+e100000000:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000010:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000020:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000030:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000040:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000050:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000060:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000070:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000080:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000090:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000000a0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000000b0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000000c0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000000d0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000000e0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000000f0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000100:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000110:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000120:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000130:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000140:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000150:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000160:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000170:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000180:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000190:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000001a0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000001b0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000001c0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000001d0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000001e0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e1000001f0:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................
958e1b
+e100000200:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000210:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000220:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000230:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000240:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000250:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000260:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000270:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000280:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000290:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000002a0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000002b0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000002c0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000002d0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000002e0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000002f0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000300:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000310:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000320:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000330:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000340:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000350:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000360:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000370:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000380:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e100000390:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000003a0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000003b0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000003c0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000003d0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000003e0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+e1000003f0:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
958e1b
+read 1024/1024 bytes at offset 966367641600
958e1b
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
958e1b
 *** done
958e1b
-- 
958e1b
2.1.0
958e1b