Files
apfstests/tests/generic/204
T
Alexander Tsvetkov 7e07c4bebb generic/204: correct log size for XFS
generic/204 fails on device with Advanced Format of 4096 bytes per
physical sector and when partition starts at the 4K boundary/./In
this case filesystem sector/block size will be of 4096 bytes size
and _scratch_mkfs_sized fails because mkfs reports that 5Mb log size
is not enough to create a filesystem, for example attempt to make
filesystem on such partition:

mkfs.xfs -f -bsize=4096 -l size=5m -d size=109051904 /dev/sdb2"

results to:

"log size 1280 blocks too small, minimum size is 1605 blocks"

and generic/204 fails with ENOSPC before it has finished creating
the necessary files. Log size of 7MB is enough for this test to pass.

Signed-off-by: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-04-11 10:10:25 +10:00

93 lines
2.5 KiB
Bash
Executable File

#! /bin/bash
# FS QA Test No. 204
#
# Test out ENOSPC flushing on small filesystems.
#
#-----------------------------------------------------------------------
# Copyright (c) 2009 Christoph Hellwig.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_scratch
rm -f $seqres.full
# get the block size first
_scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
. $tmp.mkfs
# For xfs, we need to handle the different default log sizes that different
# versions of mkfs create. All should be valid with a 5MB log, so use that.
[ $FSTYP = "xfs" ] && MKFS_OPTIONS="$MKFS_OPTIONS -l size=7m"
SIZE=`expr 106 \* 1024 \* 1024`
_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null \
| _filter_mkfs 2> $tmp.mkfs > /dev/null
_scratch_mount
. $tmp.mkfs
# fix the reserve block pool to a known size so that the enospc calculations
# work out correctly. Space usages is based 22500 files and 1024 reserved blocks
# on a 4k block size 256 byte inode size filesystem.
resv_blks=1024
space=97920000
# decrease files for inode size.
# 22500 * (256 + 4k) = ~97MB
# files * (isize + bsize) = 97MB
# files = (97920000 / (isize + bsize))
files=$((space / (isize + dbsize)))
resv_blks=$((resv_blks * (4096 / dbsize)))
echo files $files, resvblks $resv_blks >> $seqres.full
_scratch_resvblks $resv_blks >> $seqres.full 2>&1
for i in `seq 1 $files`; do
echo -n > $SCRATCH_MNT/$i
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i
done
_check_scratch_fs
# success, all done
echo "*** done"
rm -f $seqres.full
status=0