2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
7 # Test mkfs against thin provision device, which has very small backing size,
8 # mkfs should return error when it hits EIO.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
19 # Initialize dmthin device with very small backing size & very big virtual
20 # size, with the hope that mkfs hit EIO at mkfs time
21 BACKING_SIZE=$((1 * 1024 * 1024 / 512)) # 1M
22 VIRTUAL_SIZE=$((1 * 1024 * 1024 * 1024 * 1024 / 512)) # 1T
31 # get standard environment, filters and checks
36 # remove previous $seqres.full before test
39 # real QA test starts here
41 # $SCRATCH_DEV won't be directly created filesystem on, so fsck isn't required
42 _require_scratch_nocheck
43 _require_dm_target thin-pool
45 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
47 # try mkfs on dmthin device, expect mkfs failure if 1M isn't big enough to hold
48 # all the metadata. But if mkfs returns success, we expect the filesystem is
49 # consistent, make sure it doesn't currupt silently.
50 $MKFS_PROG -t $FSTYP $DMTHIN_VOL_DEV >>$seqres.full 2>&1
55 echo "Silence is golden"