3 # Test lseek influence on qcow2 block-status
5 # Block layer may recursively check block_status in file child of qcow2, if
6 # qcow2 driver returned DATA. There are several test cases to check influence
7 # of lseek on block_status performance. To see real difference run on tmpfs.
9 # Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved.
11 # Tests originally written by Kevin Wolf
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 if [ "$#" -lt 1 ]; then
28 echo "Usage: $0 SOURCE_FILE"
32 ROOT_DIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )/..
/..
/..
/..
" >/dev/null 2>&1 && pwd )"
33 QEMU_IMG
="$ROOT_DIR/qemu-img"
34 QEMU_IO
="$ROOT_DIR/qemu-io"
42 $QEMU_IMG create
-f qcow2
"$src" $size
43 for i
in $
(seq 16384 -1 0); do
44 echo "write $((i * 65536)) 64k"
45 done |
$QEMU_IO "$src"
49 /usr
/bin
/time -f %e
$QEMU_IMG convert
-n "$src" null-co
://
54 $QEMU_IMG create
-f qcow2
"$src" $size
55 for i
in $
(seq 0 2 16384); do
56 echo "write $((i * 65536)) 64k"
57 done |
$QEMU_IO "$src"
58 for i
in $
(seq 1 2 16384); do
59 echo "write $((i * 65536)) 64k"
60 done |
$QEMU_IO "$src"
64 /usr
/bin
/time -f %e
$QEMU_IMG convert
-n "$src" null-co
://
68 $QEMU_IMG create
-f qcow2
-o preallocation
=metadata
"$src" $size > /dev
/null
71 /usr
/bin
/time -f %e
$QEMU_IMG convert
-n "$src" null-co
://