2 #-----------------------------------------------------------------------
3 # Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 # Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
20 # Mountain View, CA 94043, USA, or: http://www.sgi.com
21 #-----------------------------------------------------------------------
25 if [ "$HOSTOS" == "Linux" ]
27 command dd --help | grep noxfer > /dev/null 2>&1
31 command dd status=noxfer $@
44 export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
47 export MOUNT_OPTIONS=$UDF_MOUNT_OPTIONS
50 export MOUNT_OPTIONS=$NFS_MOUNT_OPTIONS
61 export MKFS_OPTIONS=$XFS_MKFS_OPTIONS
64 [ ! -z "$udf_fsize" ] && \
65 UDF_MKFS_OPTIONS="$UDF_MKFS_OPTIONS -s $udf_fsize"
66 export MKFS_OPTIONS=$UDF_MKFS_OPTIONS
69 export MKFS_OPTIONS=$NFS_MKFS_OPTIONS
76 [ -z "$FSTYP" ] && FSTYP=xfs
77 [ -z "$MOUNT_OPTIONS" ] && _mount_opts
78 [ -z "$MKFS_OPTIONS" ] && _mkfs_opts
81 # we need common.config
82 if [ "$iam" != "check" ]
84 if ! . ./common.config
86 echo "$iam: failed to source common.config"
91 # make sure we have a standard umask
96 $MOUNT_PROG `_mount_ops_filter $*`
104 if [ "$FSTYP" != "xfs" ]; then
110 [ "$HOSTOS" != "IRIX" ] && SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f"
119 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
120 SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV"
121 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
122 SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV"
130 if [ "$FSTYP" != "xfs" ]; then
144 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
145 TEST_OPTIONS="$TEST_OPTIONS ${rt_opt}rtdev=$TEST_RTDEV"
146 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
147 TEST_OPTIONS="$TEST_OPTIONS ${log_opt}logdev=$TEST_LOGDEV"
154 #get mount point to handle dmapi mtpt option correctly
155 last_index=`expr $# - 1`
156 [ $last_index -gt 0 ] && shift $last_index
159 # irix is fussy about how it is fed its mount options
160 # - multiple -o's are not allowed
161 # - no spaces between comma delimitered options
162 # the sed script replaces all -o's (except the first) with a comma
163 # not required for linux, but won't hurt
165 echo $params | sed -e 's/[[:space:]]*-o[[:space:]]*/UnIqUe/1; s/[[:space:]]*-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
166 | sed -e 's/dmapi/dmi/' \
167 | $PERL_PROG -ne "s#mtpt=[^,|^\n|^\s]*#mtpt=$FS_ESCAPED\1\2#; print;"
171 _scratch_mount_options()
173 _scratch_options mount
175 echo $SCRATCH_OPTIONS $MOUNT_OPTIONS $* $SCRATCH_DEV $SCRATCH_MNT
180 _mount -t $FSTYP `_scratch_mount_options $*`
186 _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $* $TEST_DEV $TEST_DIR
189 _scratch_mkfs_options()
191 _scratch_options mkfs
192 echo $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
197 # extra mkfs options can be added by tests
198 local extra_mkfs_options=$*
200 _scratch_options mkfs
202 $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS $extra_mkfs_options $SCRATCH_DEV
205 # a mkfs failure may be caused by conflicts between
206 # $MKFS_OPTIONS and $extra_mkfs_options
208 if [ $mkfs_status -ne 0 -a ! -z "$extra_mkfs_options" ]; then
209 echo "** mkfs failed with extra mkfs options added to \"$MKFS_OPTIONS\" by test $seq **" \
211 echo "** attempting to mkfs using only test $seq options: $extra_mkfs_options **" \
213 $MKFS_XFS_PROG $SCRATCH_OPTIONS $extra_mkfs_options $SCRATCH_DEV
217 if [ "$USE_BIG_LOOPFS" = yes ]; then
218 [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
219 ./tools/ag-wipe -q -r $RETAIN_AG_BYTES $SCRATCH_DEV
235 $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
238 /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
243 _scratch_xfs_db_options()
246 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
247 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
248 echo $SCRATCH_OPTIONS $* $SCRATCH_DEV
251 _scratch_xfs_logprint()
254 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
255 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
256 $XFS_LOGPRINT_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
259 _scratch_xfs_repair()
262 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
263 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
264 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
265 SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -r$SCRATCH_RTDEV"
266 [ "$USE_BIG_LOOPFS" = yes ] && SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -t"
267 $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
274 echo "Usage: _get_pids_by_name process-name" 1>&2
278 # Algorithm ... all ps(1) variants have a time of the form MM:SS or
279 # HH:MM:SS before the psargs field, use this as the search anchor.
281 # Matches with $1 (process-name) occur if the first psarg is $1
282 # or ends in /$1 ... the matching uses sed's regular expressions,
283 # so passing a regex into $1 will work.
291 -e "/[0-9]:[0-9][0-9] *[^ ]*\/$1 /s/ .*//p" \
292 -e "/[0-9]:[0-9][0-9] *$1 /s/ .*//p"
300 $NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
303 # fix malloc libs output
307 # filter out the Electric Fence notice
310 if (defined $o && /^\s+Electric Fence/) {
316 print $o if (defined $o);
320 print $o if (defined $o);
324 # check if run as root
328 id=`id | $SED_PROG -e 's/(.*//' -e 's/.*=//'`
331 echo "Arrgh ... you need to be root (not uid=$id) to run this test"
338 # _df_device : get an IRIX style df line for a given device
340 # - returns "" if not mounted
341 # - returns fs type in field two (ala IRIX)
342 # - joins line together if split by fancy df formatting
343 # - strips header etc
350 echo "Usage: _df_device device" 1>&2
354 $DF_PROG 2>/dev/null | $AWK_PROG -v what=$1 '
355 match($1,what) && NF==1 {
369 # _df_dir : get an IRIX style df line for device where a directory resides
371 # - returns fs type in field two (ala IRIX)
372 # - joins line together if split by fancy df formatting
373 # - strips header etc
380 echo "Usage: _df_dir device" 1>&2
384 $DF_PROG $1 2>/dev/null | $AWK_PROG -v what=$1 '
400 # return percentage used disk space for mounted device
406 echo "Usage: _used device" 1>&2
410 _df_device $1 | $AWK_PROG '{ sub("%", "") ; print $6 }'
413 # return the FS type of a mounted device
419 echo "Usage: _fs_type device" 1>&2
423 _df_device $1 | $AWK_PROG '{ print $2 }'
426 # return the FS mount options of a mounted device
428 # should write a version which just parses the output of mount for IRIX
429 # compatibility, but since this isn't used at all, at the moment I'll leave
436 echo "Usage: _fs_options device" 1>&2
440 $AWK_PROG -v dev=$1 '
441 match($1,dev) { print $4 }
445 # returns device number if a file is a block device
451 echo "Usage: _is_block_dev dev" 1>&2
455 [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }'
458 # Do a command, log it to $seq.full, optionally test return status
459 # and die if command fails. If called with one argument _do executes the
460 # command, logs it, and returns its exit status. With two arguments _do
461 # first prints the message passed in the first argument, and then "done"
462 # or "fail" depending on the return status of the command passed in the
463 # second argument. If the command fails and the variable _do_die_on_error
464 # is set to "always" or the two argument form is used and _do_die_on_error
465 # is set to "message_only" _do will print an error message to
470 if [ $# -eq 1 ]; then
472 elif [ $# -eq 2 ]; then
477 echo "Usage: _do [note] cmd" 1>&2
481 (eval "echo '---' \"$_cmd\"") >>$here/$seq.full
482 (eval "$_cmd") >$tmp._out 2>&1; ret=$?
483 cat $tmp._out | _fix_malloc >>$here/$seq.full
484 if [ $# -eq 2 ]; then
485 if [ $ret -eq 0 ]; then
492 && [ "$_do_die_on_error" = "always" \
493 -o \( $# -eq 2 -a "$_do_die_on_error" = "message_only" \) ]
496 eval "echo \"$_cmd\" failed \(returned $ret\): see $seq.full"
503 # bail out, setting up .notrun file
507 echo "$*" >$seq.notrun
508 echo "$seq not run: $*"
513 # just plain bail out
517 echo "$*" | tee -a $here/$seq.full
518 echo "(see $seq.full for details)"
523 # tests whether $FSTYP is one of the supported filesystems for a test
529 if [ "$f" = "$FSTYP" ]
535 _notrun "not suitable for this filesystem type: $FSTYP"
538 # tests whether $FSTYP is one of the supported OSes for a test
544 if [ "$h" = "$HOSTOS" ]
550 _notrun "not suitable for this OS: $HOSTOS"
553 # this test needs a scratch partition - check we're ok & unmount it
559 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
561 _notrun "this test requires a valid \$SCRATCH_DEV"
563 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
565 _notrun "this test requires a valid \$SCRATCH_DEV"
568 nfs*|ext2|ext3|reiserfs)
569 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
570 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
572 _notrun "this test requires a valid \$SCRATCH_DEV"
576 _notrun "\$FSTYP ($FSTYP) unknown or not specified"
581 if _mount | grep -q $SCRATCH_DEV
583 # if it's mounted, make sure its on $SCRATCH_MNT
584 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
586 echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
589 # and then unmount it
590 if ! $UMOUNT_PROG $SCRATCH_DEV
592 echo "failed to unmount $SCRATCH_DEV"
598 # this test needs a logdev
602 [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
603 _notrun "This test requires a valid \$SCRATCH_LOGDEV"
604 [ "$USE_EXTERNAL" != yes ] && \
605 _notrun "This test requires USE_EXTERNAL to be enabled"
607 # ensure its not mounted
608 $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
611 # this test requires loopback device support
615 if [ "$HOSTOS" != "Linux" ]
617 _notrun "This test requires linux for loopback device support"
620 modprobe loop >/dev/null 2>&1
621 if grep loop /proc/devices >/dev/null 2>&1
625 _notrun "This test requires loopback device support"
629 # this test requires that (large) loopback device files are not in use
631 _require_nobigloopfs()
633 [ "$USE_BIG_LOOPFS" = yes ] && \
634 _notrun "Large filesystem testing in progress, skipped this test"
637 # this test requires that a realtime subvolume is in use, and
638 # that the kernel supports realtime as well.
642 [ "$USE_EXTERNAL" = yes ] || \
643 _notrun "External volumes not in use, skipped this test"
644 [ "$SCRATCH_RTDEV" = "" ] && \
645 _notrun "Realtime device required, skipped this test"
648 # this test requires that a specified command (executable) exists
652 [ -x "$1" ] || _notrun "$1 utility required, skipped this test"
655 # this test requires that external log/realtime devices are not in use
657 _require_nonexternal()
659 [ "$USE_EXTERNAL" = yes ] && \
660 _notrun "External device testing in progress, skipped this test"
663 # check for the fsgqa user on the machine
668 cat /etc/passwd | grep -q $qa_user
669 [ "$?" == "0" ] || _notrun "$qa_user user not defined."
672 # check that a FS is mounted as XFS. if so, return mount point
678 echo "Usage: _xfs_mounted device" 1>&2
684 if _mount | grep "$device " | $AWK_PROG '
685 /type xfs/ { print $3 ; exit 0 }
689 echo "_xfs_mounted: $device is not a mounted XFS FS"
695 # remount a FS to a new mode (ro or rw)
701 echo "Usage: _remount device ro/rw" 1>&2
707 if ! mount -o remount,$mode $device
709 echo "_remount: failed to remount filesystem on $device as $mode"
714 # run xfs_check and friends on a FS.
716 # if the filesystem is mounted, it's either remounted ro before being
717 # checked or it's unmounted and then remounted
722 _check_xfs_filesystem()
726 echo "Usage: _check_xfs_filesystem device <logdev>|none <rtdev>|none" 1>&2
730 extra_mount_options=""
732 if [ "$2" != "none" ]; then
733 extra_log_options="-l$2"
734 extra_mount_options="-ologdev=$2"
737 if [ "$3" != "none" ]; then
738 extra_rt_options="-r$3"
739 extra_mount_options=$extra_mount_options" -ortdev=$3"
741 extra_mount_options=$extra_mount_options" $MOUNT_OPTIONS"
743 [ "$FSTYP" != xfs ] && return 0
745 [ "$USE_BIG_LOOPFS" = yes ] && testoption=-t
747 type=`_fs_type $device`
750 if [ "$type" = "xfs" ]
754 if [ $USE_REMOUNT -eq 0 ]
756 mountpoint=`_xfs_mounted $device`
763 $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
764 | tee $tmp.logprint | grep -q "<CLEAN>"
765 if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]
767 echo "_check_xfs_filesystem: filesystem on $device has dirty log (see $seq.full)"
769 echo "_check_xfs_filesystem: filesystem on $device has dirty log" >>$here/$seq.full
770 echo "*** xfs_logprint -t output ***" >>$here/$seq.full
771 cat $tmp.logprint >>$here/$seq.full
772 echo "*** end xfs_logprint output" >>$here/$seq.full
777 $XFS_CHECK_PROG $testoption $extra_log_options $device 2>&1 |\
778 _fix_malloc >$tmp.fs_check
779 if [ -s $tmp.fs_check ]
781 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (c) (see $seq.full)"
783 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
784 echo "*** xfs_check output ***" >>$here/$seq.full
785 cat $tmp.fs_check >>$here/$seq.full
786 echo "*** end xfs_check output" >>$here/$seq.full
790 # repair doesn't scale massively at this stage, optionally skip it for now
791 [ "$USE_BIG_LOOPFS" = yes ] || \
792 $XFS_REPAIR_PROG -n $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
795 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seq.full)"
797 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
798 echo "*** xfs_repair -n output ***" >>$here/$seq.full
799 cat $tmp.repair | _fix_malloc >>$here/$seq.full
800 echo "*** end xfs_repair output" >>$here/$seq.full
804 rm -f $tmp.fs_check $tmp.logprint $tmp.repair
808 echo "*** mount output ***" >>$here/$seq.full
809 _mount >>$here/$seq.full
810 echo "*** end mount output" >>$here/$seq.full
811 elif [ "$type" = "xfs" ]
814 if [ $USE_REMOUNT -eq 0 ]
816 if ! _mount -t xfs $extra_mount_options $device $mountpoint
818 echo "!!! failed to remount $device on $mountpoint"
826 [ $ok -eq 0 ] && exit 1
830 # Filter the knowen errors the UDF Verifier reports.
831 _udf_test_known_error_filter()
833 egrep -v "PVD 60 Error: Interchange Level: 1, Maximum Interchange Level: 0|FSD 28 Error: Interchange Level: 1, Maximum Interchange Level: 1,|PVD 72 Warning: Volume Set Identifier: \"\*IRIX UDF\",|Warning: [0-9]+ unused blocks NOT marked as unallocated."
837 _check_udf_filesystem()
839 [ "$DISABLE_UDF_TEST" == "1" ] && return
841 if [ $# -ne 1 -a $# -ne 2 ]
843 echo "Usage: _check_udf_filesystem device [last_block]" 1>&2
847 if [ ! -x $here/src/udf_test ]
849 echo "udf_test not installed, please download and build the Philips"
850 echo "UDF Verification Software from http://www.extra.research.philips.com/udf/."
851 echo "Then copy the udf_test binary to $here/src/."
852 echo "If you do not wish to run udf_test then set environment variable DISABLE_UDF_TEST"
860 LAST_BLOCK=`expr \( $2 - 1 \)`
861 OPT_ARG="-lastvalidblock $LAST_BLOCK"
865 sleep 1 # Due to a problem with time stamps in udf_test
866 $here/src/udf_test $OPT_ARG $device | tee $here/$seq.checkfs | egrep "Error|Warning" | \
867 _udf_test_known_error_filter | \
868 egrep -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning count:.*[0-9]+.*total occurrences:.*[0-9]+" | \
869 sed "s/^.*$/Warning UDF Verifier reported errors see $seq.checkfs./g"
875 if [ "$FSTYP" != "xfs" ]; then
881 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
882 TEST_LOG="$TEST_LOGDEV"
884 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
885 TEST_RT="$TEST_RTDEV"
887 _check_xfs_filesystem $TEST_DEV $TEST_LOG $TEST_RT
889 # check for ipath consistency
890 if $XFS_GROWFS_PROG -n $TEST_DIR | grep -q 'inode-paths=1'; then
891 # errors go to stderr
892 xfs_check_ipaths $TEST_DIR >/dev/null
893 xfs_repair_ipaths -n $TEST_DIR >/dev/null
903 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
904 SCRATCH_LOG="$SCRATCH_LOGDEV"
906 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
907 SCRATCH_RT="$SCRATCH_RTDEV"
909 _check_xfs_filesystem $SCRATCH_DEV $SCRATCH_LOG $SCRATCH_RT
912 _check_udf_filesystem $SCRATCH_DEV $udf_fsize
915 # Don't know how to check an NFS filesystem, yet.
922 _full_fstyp_details()
924 [ -z "$FSTYP" ] && FSTYP=xfs
925 if [ $FSTYP = xfs ]; then
926 if [ -d /proc/fs/xfs ]; then
927 if grep -q 'debug 0' /proc/fs/xfs/stat; then
928 FSTYP="$FSTYP (non-debug)"
929 elif grep -q 'debug 1' /proc/fs/xfs/stat; then
930 FSTYP="$FSTYP (debug)"
933 if uname -a | grep -qi 'debug'; then
934 FSTYP="$FSTYP (debug)"
936 FSTYP="$FSTYP (non-debug)"
943 _full_platform_details()
949 echo "$os/$platform $host $kernel"
964 # Don't know how to check an NFS filesystem, yet.
974 [ "$FSTYP" != "xfs" ] \
975 && _fail "setup_xfs_testdir: \$FSTYP ($FSTYP) is not xfs"
980 _setup_udf_scratchdir()
982 [ "$FSTYP" != "udf" ] \
983 && _fail "setup_udf_testdir: \$FSTYP is not udf"
984 [ -z "$SCRATCH_DEV" -o ! -b "$SCRATCH_DEV" ] \
985 && _notrun "this test requires a valid \$SCRATCH_DEV"
986 [ -z "$SCRATCH_MNT" ] \
987 && _notrun "this test requires a valid \$SCRATCH_MNT"
990 if _mount | grep -q $SCRATCH_DEV
992 # if it's mounted, make sure its on $TEST_RW_DIR
993 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
995 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
997 $UMOUNT_PROG $SCRATCH_DEV
1003 testdir=$SCRATCH_MNT
1006 _setup_nfs_scratchdir()
1008 [ "$FSTYP" != "nfs" ] \
1009 && _fail "setup_nfs_testdir: \$FSTYP is not nfs"
1010 [ -z "$SCRATCH_DEV" ] \
1011 && _notrun "this test requires a valid host fs for \$SCRATCH_DEV"
1012 [ -z "$SCRATCH_MNT" ] \
1013 && _notrun "this test requires a valid \$SCRATCH_MNT"
1016 if _mount | grep -q $SCRATCH_DEV
1018 # if it's mounted, make sure its on $SCRATCH_MNT
1019 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
1021 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
1023 $UMOUNT_PROG $SCRATCH_DEV
1029 testdir=$SCRATCH_MNT
1033 # Warning for UDF and NFS this function calls _setup_udf_scratchdir and
1034 # _setup_udf_scratchdir. This is done because testdir is a persistent
1035 # XFS only partition.
1044 _setup_udf_scratchdir
1047 _setup_nfs_scratchdir
1050 _fail "\$FSTYP is not xfs, udf or nfs"
1059 # do nothing, testdir is $TEST_DIR
1063 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1064 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1067 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1068 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1071 _fail "\$FSTYP is not xfs, udf or nfs"
1078 if [ -z "$1" ]; then
1079 echo Error must pass \$seq.
1083 if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
1085 elif [ "`uname`" == "Linux" ]; then
1088 echo Error test $seq does not run on the operating system: `uname`
1106 if [ $size -gt 0 ]; then
1107 dd if=/dev/zero of=$file bs=1024 count=$size
1113 # takes dirname, depth
1116 dirname=$1; depth=$2
1117 mkdir $dirname || die "mkdir $dirname failed"
1120 _nfiles $files # files for this dir
1122 [ $depth -eq 0 ] && return
1123 deep=`expr $depth - 1` # go 1 down
1125 [ $verbose = true ] && echo "descending, depth from leaves = $deep"
1128 while [ $d -lt $dirs ]
1130 _descend d$d $deep &
1136 # Populate a filesystem with inodes for performance experiments
1138 # usage: populate [-v] [-n ndirs] [-f nfiles] [-d depth] [-r root] [-s size]
1143 dirs=5 # ndirs in each subdir till leaves
1144 size=0 # sizeof files in K
1145 files=100 # num files in _each_ subdir
1146 depth=2 # depth of tree from root to leaves
1148 root=root # path of initial root of directory tree
1150 while getopts "d:f:n:r:s:v" c
1162 _descend $root $depth
1167 [ $verbose = true ] && echo done
1170 # query whether the given file has the given inode flag set
1177 if which $XFS_IO_PROG >/dev/null; then
1178 if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | grep -q "$flag" ; then
1185 # query the given files extsize allocator hint in bytes (if any)
1192 if which $XFS_IO_PROG >/dev/null; then
1193 blocks=`$XFS_IO_PROG -r -c 'stat' "$file" | \
1194 awk '/^xattr.extsize =/ { print $3 }'`
1196 [ -z "$blocks" ] && blocks="0"
1201 ################################################################################
1203 if [ "$iam" != new -a "$iam" != bench ]
1205 # make some further configuration checks here
1207 if [ "$TEST_DEV" = "" ]
1209 echo "common.rc: Error: \$TEST_DEV is not set"
1213 # if $TEST_DEV is not mounted, mount it now as XFS
1214 if [ -z "`_fs_type $TEST_DEV`" ]
1216 # $TEST_DEV is not mounted
1219 echo "common.rc: retrying test device mount with external set"
1220 [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
1223 echo "common.rc: could not mount $TEST_DEV on $TEST_DIR"
1229 if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
1231 echo "common.rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
1237 # make sure this script returns success