mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
2529c9486a
Fully scripted conversion, see script in initial SPDX license commit message. tests/xfs/044 was hand massaged to remove duplicate copyright and divider lines before running the script. Signed-off-by: Dave Chinner <dchinner@redhat.com>
78 lines
1.7 KiB
Bash
Executable File
78 lines
1.7 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2015 Red Hat, Inc. All Rights Reserved.
|
|
#
|
|
# FS QA Test 074-extsz-hints-vs-maxextlen
|
|
#
|
|
# Check some extent size hint boundary conditions that can result in
|
|
# MAXEXTLEN overflows.
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
_destroy_loop_device $LOOP_DEV
|
|
rm -f $tmp.* $LOOP_FILE
|
|
}
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
_supported_fs xfs
|
|
_supported_os Linux
|
|
|
|
rm -f $seqres.full
|
|
|
|
_require_test
|
|
_require_xfs_io_command "falloc"
|
|
|
|
# we use loop devices for this so that we can create large files for prealloc
|
|
# without having to care about the underlying device size.
|
|
_require_loop
|
|
|
|
LOOP_FILE=$TEST_DIR/$seq.img
|
|
LOOP_MNT=$TEST_DIR/$seq.mnt
|
|
mkdir -p $LOOP_MNT
|
|
$XFS_IO_PROG -ft -c "truncate 1t" $LOOP_FILE >> $seqres.full
|
|
LOOP_DEV=`_create_loop_device $LOOP_FILE`
|
|
|
|
_mkfs_dev -d size=156452m,agcount=4 -l size=32m $LOOP_DEV
|
|
_mount $LOOP_DEV $LOOP_MNT
|
|
|
|
# Corrupt the BMBT by creating extents larger than MAXEXTLEN
|
|
$XFS_IO_PROG -ft \
|
|
-c "extsize 16m" \
|
|
-c "falloc 0 30g" \
|
|
$LOOP_MNT/foo >> $seqres.full
|
|
|
|
umount $LOOP_MNT
|
|
_check_xfs_filesystem $LOOP_DEV none none
|
|
|
|
_mkfs_dev -f -l size=32m $LOOP_DEV
|
|
_mount $LOOP_DEV $LOOP_MNT
|
|
|
|
# check we trim both ends of the extent approproiately; this will fail
|
|
# on 1k block size filesystems without the correct fixes in place.
|
|
$XFS_IO_PROG -ft \
|
|
-c "extsize 1g" \
|
|
-c "falloc 1023m 2g" \
|
|
$LOOP_MNT/foo >> $seqres.full
|
|
|
|
umount $LOOP_MNT
|
|
_check_xfs_filesystem $LOOP_DEV none none
|
|
|
|
# success, all done
|
|
echo "Silence is golden"
|
|
status=0
|
|
exit
|