4 # Test mkfs against thin provision device, which has very small backing size,
5 # mkfs should return error when it hits EIO.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
34 # Initialize dmthin device with very small backing size & very big virtual
35 # size, with the hope that mkfs hit EIO at mkfs time
36 BACKING_SIZE=$((1 * 1024 * 1024 / 512)) # 1M
37 VIRTUAL_SIZE=$((1 * 1024 * 1024 * 1024 * 1024 / 512)) # 1T
46 # get standard environment, filters and checks
51 # remove previous $seqres.full before test
54 # real QA test starts here
57 # $SCRATCH_DEV won't be directly created filesystem on, so fsck isn't required
58 _require_scratch_nocheck
59 _require_dm_target thin-pool
61 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
63 # try mkfs on dmthin device, expect mkfs failure if 1M isn't big enough to hold
64 # all the metadata. But if mkfs returns success, we expect the filesystem is
65 # consistent, make sure it doesn't currupt silently.
66 $MKFS_PROG -t $FSTYP $DMTHIN_VOL_DEV >>$seqres.full 2>&1
71 echo "Silence is golden"