Skip to contentSkip to conversation

vmdk: Fix big flat extent IO

PATCH Applied Fam Zheng 2 participants 2 messages Jan 8, 2014 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 vmdk: Fix big flat extent IO

Local variable "n" as int64_t avoids overflow with large sector number calculation. See test case change for failure case.

---
 block/vmdk.c               |  4 +--
 tests/qemu-iotests/059     |  7 +++++
 tests/qemu-iotests/059.out | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 2 deletions(-)
block/vmdk.c +2 -2
index 0734bc2..3404cd0 100644
@@ -1320,8 +1320,8 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
 {
     BDRVVmdkState *s = bs->opaque;
     VmdkExtent *extent = NULL;
-    int n, ret;
-    int64_t index_in_cluster;
+    int ret;
+    int64_t index_in_cluster, n;
     uint64_t extent_begin_sector, extent_relative_sector_num;
     uint64_t cluster_offset;
     VmdkMetaData m_data;
tests/qemu-iotests/059 +7 -0
index 73941c3..9376596 100755
@@ -85,6 +85,13 @@ echo "=== Testing version 3 ==="
 _use_sample_img iotest-version3.vmdk.bz2
 _img_info
 
+echo
+echo "=== Testing 4TB monolithicFlat creation and IO ==="
+IMGOPTS="subformat=monolithicFlat" _make_test_img 4T
+_img_info
+$QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io
+$QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
tests/qemu-iotests/059.out +74 -0

78 lines not on this page · raw message

Signature · 1 line
1.8.5.1
Applied
#1 lore raw

Am 08.01.2014 um 02:42 hat Fam Zheng geschrieben:

Quoted 4 lines

Local variable "n" as int64_t avoids overflow with large sector number calculation. See test case change for failure case.

Thanks, applied to the block branch.

Kevin