1 | # $Id: tstVDDiscard.vd 39520 2011-12-02 21:17:42Z vboxsync $
|
---|
2 | #
|
---|
3 | # Storage: Testcase for discarding data in a disk.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2011 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | # Init I/O RNG for generating random data for writes
|
---|
19 | iorngcreate size=10M mode=manual seed=1234567890
|
---|
20 |
|
---|
21 | print msg=Testing_VDI
|
---|
22 | # Create disk containers, read verification is on.
|
---|
23 | createdisk name=disk verify=yes
|
---|
24 | # Create the disk.
|
---|
25 | create disk=disk mode=base name=tstCompact.vdi type=dynamic backend=VDI size=2G
|
---|
26 | # Fill the disk with random data
|
---|
27 | io disk=disk async=no mode=seq blocksize=64k off=0-2G size=2G writes=100
|
---|
28 | # Read the data to verify it once.
|
---|
29 | io disk=disk async=no mode=seq blocksize=64k off=0-2G size=2G writes=0
|
---|
30 | close disk=disk mode=single delete=no
|
---|
31 |
|
---|
32 | open disk=disk name=tstCompact.vdi backend=VDI async=yes discard=yes
|
---|
33 | printfilesize disk=disk image=0
|
---|
34 | discard async=yes disk=disk ranges=6,0M,512k,1M,512k,2M,512k,3M,512k,4M,512k,5M,512k
|
---|
35 | discard async=yes disk=disk ranges=6,6M,512k,7M,512k,8M,512k,9M,512k,10M,512k,11M,512k
|
---|
36 | discard async=yes disk=disk ranges=1,512k,512k
|
---|
37 | printfilesize disk=disk image=0
|
---|
38 |
|
---|
39 | print msg=Discard_whole_block
|
---|
40 | discard async=yes disk=disk ranges=1,20M,1M
|
---|
41 | printfilesize disk=disk image=0
|
---|
42 |
|
---|
43 | print msg=Split_Discard
|
---|
44 | discard async=yes disk=disk ranges=1,21M,512k
|
---|
45 | printfilesize disk=disk image=0
|
---|
46 | discard async=yes disk=disk ranges=1,22016k,512k
|
---|
47 | printfilesize disk=disk image=0
|
---|
48 |
|
---|
49 | # Cleanup
|
---|
50 | close disk=disk mode=single delete=yes
|
---|
51 | destroydisk name=disk
|
---|
52 |
|
---|
53 | # Destroy RNG and pattern
|
---|
54 | iorngdestroy
|
---|
55 |
|
---|