2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 Red Hat, Inc. All Rights Reserved.
7 # Bmap btree corruption regression test
10 _begin_fstest auto quick rw prealloc metadata
12 # Override the default cleanup function.
16 umount $LOOP_MNT 2>/dev/null
21 # Import common functions.
24 # real QA test starts here
28 _require_xfs_io_command "falloc"
30 LOOP_DEV=$TEST_DIR/$seq.fs
31 LOOP_MNT=$TEST_DIR/$seq.mnt
38 # real QA test starts here
40 echo "*** create loop mount point"
41 rmdir $LOOP_MNT 2>/dev/null
42 mkdir -p $LOOP_MNT || _fail "cannot create loopback mount point"
50 dparam="file,name=$LOOP_DEV,size=$size"
51 if [ -n "$agsize" ]; then
52 dparam="$dparam,agsize=$agsize"
55 echo "*** mkfs loop file (size=$size)"
56 $MKFS_XFS_PROG -d $dparam \
57 | _filter_mkfs 2>/dev/null
59 echo "*** mount loop filesystem"
60 mount -t xfs -o loop $LOOP_DEV $LOOP_MNT
62 echo "*** preallocate large file"
63 $XFS_IO_PROG -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
65 echo "*** unmount loop filesystem"
66 umount $LOOP_MNT > /dev/null 2>&1
68 echo "*** check loop filesystem"
69 _check_xfs_filesystem $LOOP_DEV none none
72 _test_loop 50g 16m 40G