11ef7d010SKevin Wolf#!/bin/bash 21ef7d010SKevin Wolf# 3*74021bc4SEric Blake# qcow2 specific bdrv_pwrite_zeroes tests with backing files (complements 034) 41ef7d010SKevin Wolf# 51ef7d010SKevin Wolf# Copyright (C) 2016 Red Hat, Inc. 61ef7d010SKevin Wolf# 71ef7d010SKevin Wolf# This program is free software; you can redistribute it and/or modify 81ef7d010SKevin Wolf# it under the terms of the GNU General Public License as published by 91ef7d010SKevin Wolf# the Free Software Foundation; either version 2 of the License, or 101ef7d010SKevin Wolf# (at your option) any later version. 111ef7d010SKevin Wolf# 121ef7d010SKevin Wolf# This program is distributed in the hope that it will be useful, 131ef7d010SKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of 141ef7d010SKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 151ef7d010SKevin Wolf# GNU General Public License for more details. 161ef7d010SKevin Wolf# 171ef7d010SKevin Wolf# You should have received a copy of the GNU General Public License 181ef7d010SKevin Wolf# along with this program. If not, see <http://www.gnu.org/licenses/>. 191ef7d010SKevin Wolf# 201ef7d010SKevin Wolf 211ef7d010SKevin Wolf# creator 221ef7d010SKevin Wolfowner=kwolf@redhat.com 231ef7d010SKevin Wolf 241ef7d010SKevin Wolfseq=`basename $0` 251ef7d010SKevin Wolfecho "QA output created by $seq" 261ef7d010SKevin Wolf 271ef7d010SKevin Wolfhere=`pwd` 281ef7d010SKevin Wolfstatus=1 # failure is the default! 291ef7d010SKevin Wolf 301ef7d010SKevin Wolf_cleanup() 311ef7d010SKevin Wolf{ 321ef7d010SKevin Wolf _cleanup_test_img 331ef7d010SKevin Wolf} 341ef7d010SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 351ef7d010SKevin Wolf 361ef7d010SKevin Wolf# get standard environment, filters and checks 371ef7d010SKevin Wolf. ./common.rc 381ef7d010SKevin Wolf. ./common.filter 391ef7d010SKevin Wolf 401ef7d010SKevin Wolf_supported_fmt qcow2 411ef7d010SKevin Wolf_supported_proto file 421ef7d010SKevin Wolf_supported_os Linux 431ef7d010SKevin Wolf 441ef7d010SKevin WolfCLUSTER_SIZE=4k 451ef7d010SKevin Wolfsize=128M 461ef7d010SKevin Wolf 471ef7d010SKevin Wolfecho 481ef7d010SKevin Wolfecho == backing file contains zeros == 491ef7d010SKevin Wolf 501ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 511ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 521ef7d010SKevin Wolf 531ef7d010SKevin Wolf# Make sure that the whole cluster is allocated even for partial write_zeroes 541ef7d010SKevin Wolf# when the backing file contains zeros 551ef7d010SKevin Wolf 561ef7d010SKevin Wolf# X = non-zero data sector in backing file 571ef7d010SKevin Wolf# - = sector unallocated in whole backing chain 581ef7d010SKevin Wolf# 0 = sector touched by write_zeroes request 591ef7d010SKevin Wolf 601ef7d010SKevin Wolf# 1. Tail unaligned: 00 00 -- -- 611ef7d010SKevin Wolf# 2. Head unaligned: -- -- 00 00 621ef7d010SKevin Wolf# 3. Both unaligned: -- 00 00 -- 631ef7d010SKevin Wolf# 4. Both, 2 clusters: -- -- -- 00 | 00 -- -- -- 641ef7d010SKevin Wolf 651ef7d010SKevin Wolf$QEMU_IO -c "write -z 0 2k" "$TEST_IMG" | _filter_qemu_io 661ef7d010SKevin Wolf$QEMU_IO -c "write -z 10k 2k" "$TEST_IMG" | _filter_qemu_io 671ef7d010SKevin Wolf$QEMU_IO -c "write -z 17k 2k" "$TEST_IMG" | _filter_qemu_io 681ef7d010SKevin Wolf$QEMU_IO -c "write -z 27k 2k" "$TEST_IMG" | _filter_qemu_io 691ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 701ef7d010SKevin Wolf 711ef7d010SKevin Wolfecho 721ef7d010SKevin Wolfecho == backing file contains non-zero data before write_zeroes == 731ef7d010SKevin Wolf 741ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 751ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 761ef7d010SKevin Wolf 771ef7d010SKevin Wolf# Single cluster; non-zero data at the cluster start 781ef7d010SKevin Wolf# ... | XX -- 00 -- | ... 791ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 32k 1k" "$TEST_IMG.base" | _filter_qemu_io 801ef7d010SKevin Wolf$QEMU_IO -c "write -z 34k 1k" "$TEST_IMG" | _filter_qemu_io 811ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 32k 1k" "$TEST_IMG" | _filter_qemu_io 821ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 33k 3k" "$TEST_IMG" | _filter_qemu_io 831ef7d010SKevin Wolf 841ef7d010SKevin Wolf# Single cluster; non-zero data exists, but not at the cluster start 851ef7d010SKevin Wolf# ... | -- XX 00 -- | ... 861ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 65k 1k" "$TEST_IMG.base" | _filter_qemu_io 871ef7d010SKevin Wolf$QEMU_IO -c "write -z 66k 1k" "$TEST_IMG" | _filter_qemu_io 881ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 65k 1k" "$TEST_IMG" | _filter_qemu_io 891ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 64k 1k" "$TEST_IMG" | _filter_qemu_io 901ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 66k 2k" "$TEST_IMG" | _filter_qemu_io 911ef7d010SKevin Wolf 921ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 931ef7d010SKevin Wolf 941ef7d010SKevin Wolfecho 951ef7d010SKevin Wolfecho == backing file contains non-zero data after write_zeroes == 961ef7d010SKevin Wolf 971ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 981ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 991ef7d010SKevin Wolf 1001ef7d010SKevin Wolf# Single cluster; non-zero data directly after request 1011ef7d010SKevin Wolf# ... | -- 00 XX -- | ... 1021ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 34k 1k" "$TEST_IMG.base" | _filter_qemu_io 1031ef7d010SKevin Wolf$QEMU_IO -c "write -z 33k 1k" "$TEST_IMG" | _filter_qemu_io 1041ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 32k 2k" "$TEST_IMG" | _filter_qemu_io 1051ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 34k 1k" "$TEST_IMG" | _filter_qemu_io 1061ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 35k 1k" "$TEST_IMG" | _filter_qemu_io 1071ef7d010SKevin Wolf 1081ef7d010SKevin Wolf# Single cluster; non-zero data exists, but not directly after request 1091ef7d010SKevin Wolf# ... | -- 00 -- XX | ... 1101ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 43k 1k" "$TEST_IMG.base" | _filter_qemu_io 1111ef7d010SKevin Wolf$QEMU_IO -c "write -z 41k 1k" "$TEST_IMG" | _filter_qemu_io 1121ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 43k 1k" "$TEST_IMG" | _filter_qemu_io 1131ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 40k 3k" "$TEST_IMG" | _filter_qemu_io 1141ef7d010SKevin Wolf 1151ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 1161ef7d010SKevin Wolf 1171ef7d010SKevin Wolfecho 11831ad4fdfSEric Blakeecho == write_zeroes covers non-zero data == 11931ad4fdfSEric Blake 12031ad4fdfSEric BlakeCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 12131ad4fdfSEric Blake_make_test_img -b "$TEST_IMG.base" 12231ad4fdfSEric Blake 12331ad4fdfSEric Blake# non-zero data at front of request 12431ad4fdfSEric Blake# Backing file: -- XX -- -- 12531ad4fdfSEric Blake# Active layer: -- 00 00 -- 12631ad4fdfSEric Blake 12731ad4fdfSEric Blake$QEMU_IO -c "write -P 0x11 5k 1k" "$TEST_IMG.base" | _filter_qemu_io 12831ad4fdfSEric Blake$QEMU_IO -c "write -z 5k 2k" "$TEST_IMG" | _filter_qemu_io 12931ad4fdfSEric Blake$QEMU_IO -c "read -P 0 4k 4k" "$TEST_IMG" | _filter_qemu_io 13031ad4fdfSEric Blake 13131ad4fdfSEric Blake# non-zero data at end of request 13231ad4fdfSEric Blake# Backing file: -- -- XX -- 13331ad4fdfSEric Blake# Active layer: -- 00 00 -- 13431ad4fdfSEric Blake 13531ad4fdfSEric Blake$QEMU_IO -c "write -P 0x11 14k 1k" "$TEST_IMG.base" | _filter_qemu_io 13631ad4fdfSEric Blake$QEMU_IO -c "write -z 13k 2k" "$TEST_IMG" | _filter_qemu_io 13731ad4fdfSEric Blake$QEMU_IO -c "read -P 0 12k 4k" "$TEST_IMG" | _filter_qemu_io 13831ad4fdfSEric Blake 13931ad4fdfSEric Blake# non-zero data matches size of request 14031ad4fdfSEric Blake# Backing file: -- XX XX -- 14131ad4fdfSEric Blake# Active layer: -- 00 00 -- 14231ad4fdfSEric Blake 14331ad4fdfSEric Blake$QEMU_IO -c "write -P 0x11 21k 2k" "$TEST_IMG.base" | _filter_qemu_io 14431ad4fdfSEric Blake$QEMU_IO -c "write -z 21k 2k" "$TEST_IMG" | _filter_qemu_io 14531ad4fdfSEric Blake$QEMU_IO -c "read -P 0 20k 4k" "$TEST_IMG" | _filter_qemu_io 14631ad4fdfSEric Blake 14731ad4fdfSEric Blake# non-zero data smaller than request 14831ad4fdfSEric Blake# Backing file: -- -X X- -- 14931ad4fdfSEric Blake# Active layer: -- 00 00 -- 15031ad4fdfSEric Blake 15131ad4fdfSEric Blake$QEMU_IO -c "write -P 0x11 30208 1k" "$TEST_IMG.base" | _filter_qemu_io 15231ad4fdfSEric Blake$QEMU_IO -c "write -z 29k 2k" "$TEST_IMG" | _filter_qemu_io 15331ad4fdfSEric Blake$QEMU_IO -c "read -P 0 28k 4k" "$TEST_IMG" | _filter_qemu_io 15431ad4fdfSEric Blake 15531ad4fdfSEric Blake$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 15631ad4fdfSEric Blake 15731ad4fdfSEric Blakeecho 1581ef7d010SKevin Wolfecho == spanning two clusters, non-zero before request == 1591ef7d010SKevin Wolf 1601ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 1611ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 1621ef7d010SKevin Wolf 1631ef7d010SKevin Wolf# Two clusters; non-zero data before request: 1641ef7d010SKevin Wolf# 1. At cluster start: 32k: XX -- -- 00 | 00 -- -- -- 1651ef7d010SKevin Wolf# 2. Between unallocated space: 48k: -- XX -- 00 | 00 -- -- -- 1661ef7d010SKevin Wolf# 3. Directly before request: 64k: -- -- XX 00 | 00 -- -- -- 1671ef7d010SKevin Wolf 1681ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 32k 1k" "$TEST_IMG.base" | _filter_qemu_io 1691ef7d010SKevin Wolf$QEMU_IO -c "write -z 35k 2k" "$TEST_IMG" | _filter_qemu_io 1701ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 32k 1k" "$TEST_IMG" | _filter_qemu_io 1711ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 33k 7k" "$TEST_IMG" | _filter_qemu_io 1721ef7d010SKevin Wolf 1731ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 49k 1k" "$TEST_IMG.base" | _filter_qemu_io 1741ef7d010SKevin Wolf$QEMU_IO -c "write -z 51k 2k" "$TEST_IMG" | _filter_qemu_io 1751ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 48k 1k" "$TEST_IMG" | _filter_qemu_io 1761ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 49k 1k" "$TEST_IMG" | _filter_qemu_io 1771ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 50k 6k" "$TEST_IMG" | _filter_qemu_io 1781ef7d010SKevin Wolf 1791ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 66k 1k" "$TEST_IMG.base" | _filter_qemu_io 1801ef7d010SKevin Wolf$QEMU_IO -c "write -z 67k 2k" "$TEST_IMG" | _filter_qemu_io 1811ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 64k 2k" "$TEST_IMG" | _filter_qemu_io 1821ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 66k 1k" "$TEST_IMG" | _filter_qemu_io 1831ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 67k 5k" "$TEST_IMG" | _filter_qemu_io 1841ef7d010SKevin Wolf 1851ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 1861ef7d010SKevin Wolf 1871ef7d010SKevin Wolfecho 1881ef7d010SKevin Wolfecho == spanning two clusters, non-zero after request == 1891ef7d010SKevin Wolf 1901ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 1911ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 1921ef7d010SKevin Wolf 1931ef7d010SKevin Wolf# Two clusters; non-zero data after request: 1941ef7d010SKevin Wolf# 1. Directly after request: 32k: -- -- -- 00 | 00 XX -- -- 1951ef7d010SKevin Wolf# 2. Between unallocated space: 48k: -- -- -- 00 | 00 -- XX -- 1961ef7d010SKevin Wolf# 3. At cluster end: 64k: -- -- -- 00 | 00 -- -- XX 1971ef7d010SKevin Wolf 1981ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 37k 1k" "$TEST_IMG.base" | _filter_qemu_io 1991ef7d010SKevin Wolf$QEMU_IO -c "write -z 35k 2k" "$TEST_IMG" | _filter_qemu_io 2001ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 32k 5k" "$TEST_IMG" | _filter_qemu_io 2011ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 37k 1k" "$TEST_IMG" | _filter_qemu_io 2021ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 38k 2k" "$TEST_IMG" | _filter_qemu_io 2031ef7d010SKevin Wolf 2041ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 54k 1k" "$TEST_IMG.base" | _filter_qemu_io 2051ef7d010SKevin Wolf$QEMU_IO -c "write -z 51k 2k" "$TEST_IMG" | _filter_qemu_io 2061ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 48k 6k" "$TEST_IMG" | _filter_qemu_io 2071ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 54k 1k" "$TEST_IMG" | _filter_qemu_io 2081ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 55k 1k" "$TEST_IMG" | _filter_qemu_io 2091ef7d010SKevin Wolf 2101ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 71k 1k" "$TEST_IMG.base" | _filter_qemu_io 2111ef7d010SKevin Wolf$QEMU_IO -c "write -z 67k 2k" "$TEST_IMG" | _filter_qemu_io 2121ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 64k 7k" "$TEST_IMG" | _filter_qemu_io 2131ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 71k 1k" "$TEST_IMG" | _filter_qemu_io 2141ef7d010SKevin Wolf 2151ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 2161ef7d010SKevin Wolf 2171ef7d010SKevin Wolfecho 2181ef7d010SKevin Wolfecho == spanning two clusters, partially overwriting backing file == 2191ef7d010SKevin Wolf 2201ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 2211ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 2221ef7d010SKevin Wolf 2231ef7d010SKevin Wolf# Backing file: -- -- XX XX | XX XX -- -- 2241ef7d010SKevin Wolf# Active layer: -- -- XX 00 | 00 XX -- -- 2251ef7d010SKevin Wolf 2261ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 2k 4k" "$TEST_IMG.base" | _filter_qemu_io 2271ef7d010SKevin Wolf$QEMU_IO -c "write -z 3k 2k" "$TEST_IMG" | _filter_qemu_io 2281ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 0k 2k" "$TEST_IMG" | _filter_qemu_io 2291ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 2k 1k" "$TEST_IMG" | _filter_qemu_io 2301ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 3k 2k" "$TEST_IMG" | _filter_qemu_io 2311ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 5k 1k" "$TEST_IMG" | _filter_qemu_io 2321ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 6k 2k" "$TEST_IMG" | _filter_qemu_io 2331ef7d010SKevin Wolf 2341ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 2351ef7d010SKevin Wolf 2361ef7d010SKevin Wolfecho 2371ef7d010SKevin Wolfecho == spanning multiple clusters, non-zero in first cluster == 2381ef7d010SKevin Wolf 2391ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 2401ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 2411ef7d010SKevin Wolf 2421ef7d010SKevin Wolf# Backing file: 64k: XX XX -- -- | -- -- -- -- | -- -- -- -- 2431ef7d010SKevin Wolf# Active layer: 64k: XX XX 00 00 | 00 00 00 00 | 00 -- -- -- 2441ef7d010SKevin Wolf 2451ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 64k 2k" "$TEST_IMG.base" | _filter_qemu_io 2461ef7d010SKevin Wolf$QEMU_IO -c "write -z 66k 7k" "$TEST_IMG" | _filter_qemu_io 2471ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 64k 2k" "$TEST_IMG" | _filter_qemu_io 2481ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 66k 10k" "$TEST_IMG" | _filter_qemu_io 2491ef7d010SKevin Wolf 2501ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 2511ef7d010SKevin Wolf 2521ef7d010SKevin Wolfecho 2531ef7d010SKevin Wolfecho == spanning multiple clusters, non-zero in intermediate cluster == 2541ef7d010SKevin Wolf 2551ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 2561ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 2571ef7d010SKevin Wolf 2581ef7d010SKevin Wolf# Backing file: 64k: -- -- -- -- | -- XX XX -- | -- -- -- -- 2591ef7d010SKevin Wolf# Active layer: 64k: -- -- 00 00 | 00 00 00 00 | 00 -- -- -- 2601ef7d010SKevin Wolf 2611ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 69k 2k" "$TEST_IMG.base" | _filter_qemu_io 2621ef7d010SKevin Wolf$QEMU_IO -c "write -z 66k 7k" "$TEST_IMG" | _filter_qemu_io 2631ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 64k 12k" "$TEST_IMG" | _filter_qemu_io 2641ef7d010SKevin Wolf 2651ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 2661ef7d010SKevin Wolf 2671ef7d010SKevin Wolfecho 2681ef7d010SKevin Wolfecho == spanning multiple clusters, non-zero in final cluster == 2691ef7d010SKevin Wolf 2701ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 2711ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 2721ef7d010SKevin Wolf 2731ef7d010SKevin Wolf# Backing file: 64k: -- -- -- -- | -- -- -- -- | -- -- XX XX 2741ef7d010SKevin Wolf# Active layer: 64k: -- -- 00 00 | 00 00 00 00 | 00 -- XX XX 2751ef7d010SKevin Wolf 2761ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 74k 2k" "$TEST_IMG.base" | _filter_qemu_io 2771ef7d010SKevin Wolf$QEMU_IO -c "write -z 66k 7k" "$TEST_IMG" | _filter_qemu_io 2781ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 64k 10k" "$TEST_IMG" | _filter_qemu_io 2791ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 74k 2k" "$TEST_IMG" | _filter_qemu_io 2801ef7d010SKevin Wolf 2811ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 2821ef7d010SKevin Wolf 2831ef7d010SKevin Wolfecho 2841ef7d010SKevin Wolfecho == spanning multiple clusters, partially overwriting backing file == 2851ef7d010SKevin Wolf 2861ef7d010SKevin WolfCLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size 2871ef7d010SKevin Wolf_make_test_img -b "$TEST_IMG.base" 2881ef7d010SKevin Wolf 2891ef7d010SKevin Wolf# Backing file: 64k: -- XX XX XX | XX XX XX XX | XX XX XX -- 2901ef7d010SKevin Wolf# Active layer: 64k: -- XX 00 00 | 00 00 00 00 | 00 XX XX -- 2911ef7d010SKevin Wolf 2921ef7d010SKevin Wolf$QEMU_IO -c "write -P 0x11 65k 10k" "$TEST_IMG.base" | _filter_qemu_io 2931ef7d010SKevin Wolf$QEMU_IO -c "write -z 66k 7k" "$TEST_IMG" | _filter_qemu_io 2941ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 64k 1k" "$TEST_IMG" | _filter_qemu_io 2951ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 65k 1k" "$TEST_IMG" | _filter_qemu_io 2961ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 66k 7k" "$TEST_IMG" | _filter_qemu_io 2971ef7d010SKevin Wolf$QEMU_IO -c "read -P 0x11 73k 2k" "$TEST_IMG" | _filter_qemu_io 2981ef7d010SKevin Wolf$QEMU_IO -c "read -P 0 75k 1k" "$TEST_IMG" | _filter_qemu_io 2991ef7d010SKevin Wolf 3001ef7d010SKevin Wolf$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map 3011ef7d010SKevin Wolf 3021ef7d010SKevin Wolf# success, all done 3031ef7d010SKevin Wolfecho "*** done" 3041ef7d010SKevin Wolfrm -f $seq.full 3051ef7d010SKevin Wolfstatus=0 306