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
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"
150 _scratch_mount_options()
152 _scratch_options mount
153 echo $SCRATCH_OPTIONS $MOUNT_OPTIONS $* $SCRATCH_DEV $SCRATCH_MNT
158 _mount -t $FSTYP `_scratch_mount_options $*`
164 _mount -t $FSTYP $TEST_OPTIONS $MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
167 _scratch_mkfs_options()
169 _scratch_options mkfs
170 echo $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
175 _scratch_options mkfs
177 $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
180 if [ "$USE_BIG_LOOPFS" = yes ]; then
181 [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
182 ./tools/ag-wipe -q -r $RETAIN_AG_BYTES $SCRATCH_DEV
198 $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
201 /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
206 _scratch_xfs_db_options()
209 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
210 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
211 echo $SCRATCH_OPTIONS $* $SCRATCH_DEV
214 _scratch_xfs_logprint()
217 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
218 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
219 $XFS_LOGPRINT_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
222 _scratch_xfs_repair()
225 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
226 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
227 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
228 SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -r$SCRATCH_RTDEV"
229 [ "$USE_BIG_LOOPFS" = yes ] && SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -t"
230 $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
237 echo "Usage: _get_pids_by_name process-name" 1>&2
241 # Algorithm ... all ps(1) variants have a time of the form MM:SS or
242 # HH:MM:SS before the psargs field, use this as the search anchor.
244 # Matches with $1 (process-name) occur if the first psarg is $1
245 # or ends in /$1 ... the matching uses sed's regular expressions,
246 # so passing a regex into $1 will work.
254 -e "/[0-9]:[0-9][0-9] *[^ ]*\/$1 /s/ .*//p" \
255 -e "/[0-9]:[0-9][0-9] *$1 /s/ .*//p"
263 $NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
266 # fix malloc libs output
270 # filter out the Electric Fence notice
273 if (defined $o && /^\s+Electric Fence/) {
279 print $o if (defined $o);
283 print $o if (defined $o);
287 # check if run as root
291 id=`id | $SED_PROG -e 's/(.*//' -e 's/.*=//'`
294 echo "Arrgh ... you need to be root (not uid=$id) to run this test"
301 # _df_device : get an IRIX style df line for a given device
303 # - returns "" if not mounted
304 # - returns fs type in field two (ala IRIX)
305 # - joins line together if split by fancy df formatting
306 # - strips header etc
313 echo "Usage: _df_device device" 1>&2
317 $DF_PROG 2>/dev/null | $AWK_PROG -v what=$1 '
318 match($1,what) && NF==1 {
332 # _df_dir : get an IRIX style df line for device where a directory resides
334 # - returns fs type in field two (ala IRIX)
335 # - joins line together if split by fancy df formatting
336 # - strips header etc
343 echo "Usage: _df_dir device" 1>&2
347 $DF_PROG $1 2>/dev/null | $AWK_PROG -v what=$1 '
363 # return percentage used disk space for mounted device
369 echo "Usage: _used device" 1>&2
373 _df_device $1 | $AWK_PROG '{ sub("%", "") ; print $6 }'
376 # return the FS type of a mounted device
382 echo "Usage: _fs_type device" 1>&2
386 _df_device $1 | $AWK_PROG '{ print $2 }'
389 # return the FS mount options of a mounted device
391 # should write a version which just parses the output of mount for IRIX
392 # compatibility, but since this isn't used at all, at the moment I'll leave
399 echo "Usage: _fs_options device" 1>&2
403 $AWK_PROG -v dev=$1 '
404 match($1,dev) { print $4 }
408 # returns device number if a file is a block device
414 echo "Usage: _is_block_dev dev" 1>&2
418 [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }'
421 # Do a command, log it to $seq.full, optionally test return status
422 # and die if command fails. If called with one argument _do executes the
423 # command, logs it, and returns its exit status. With two arguments _do
424 # first prints the message passed in the first argument, and then "done"
425 # or "fail" depending on the return status of the command passed in the
426 # second argument. If the command fails and the variable _do_die_on_error
427 # is set to "always" or the two argument form is used and _do_die_on_error
428 # is set to "message_only" _do will print an error message to
433 if [ $# -eq 1 ]; then
435 elif [ $# -eq 2 ]; then
440 echo "Usage: _do [note] cmd" 1>&2
444 (eval "echo '---' \"$_cmd\"") >>$here/$seq.full
445 (eval "$_cmd") >$tmp._out 2>&1; ret=$?
446 cat $tmp._out | _fix_malloc >>$here/$seq.full
447 if [ $# -eq 2 ]; then
448 if [ $ret -eq 0 ]; then
455 && [ "$_do_die_on_error" = "always" \
456 -o \( $# -eq 2 -a "$_do_die_on_error" = "message_only" \) ]
459 eval "echo \"$_cmd\" failed \(returned $ret\): see $seq.full"
466 # bail out, setting up .notrun file
470 echo "$*" >$seq.notrun
471 echo "$seq not run: $*"
476 # just plain bail out
480 echo "$*" | tee -a $here/$seq.full
481 echo "(see $seq.full for details)"
486 # tests whether $FSTYP is one of the supported filesystems for a test
492 if [ "$f" = "$FSTYP" ]
498 _notrun "not suitable for this filesystem type: $FSTYP"
501 # tests whether $FSTYP is one of the supported OSes for a test
507 if [ "$h" = "$HOSTOS" ]
513 _notrun "not suitable for this OS: $HOSTOS"
516 # this test needs a scratch partition - check we're ok & unmount it
522 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
524 _notrun "this test requires a valid \$SCRATCH_DEV"
526 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
528 _notrun "this test requires a valid \$SCRATCH_DEV"
531 nfs*|ext2|ext3|reiserfs)
532 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
533 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
535 _notrun "this test requires a valid \$SCRATCH_DEV"
539 _notrun "\$FSTYP ($FSTYP) unknown or not specified"
544 if _mount | grep -q $SCRATCH_DEV
546 # if it's mounted, make sure its on $SCRATCH_MNT
547 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
549 echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
552 # and then unmount it
553 if ! $UMOUNT_PROG $SCRATCH_DEV
555 echo "failed to unmount $SCRATCH_DEV"
561 # this test needs a logdev
565 [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
566 _notrun "This test requires a valid \$SCRATCH_LOGDEV"
567 [ "$USE_EXTERNAL" != yes ] && \
568 _notrun "This test requires USE_EXTERNAL to be enabled"
570 # ensure its not mounted
571 $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
574 # this test requires loopback device support
578 if [ "$HOSTOS" != "Linux" ]
580 _notrun "This test requires linux for loopback device support"
583 modprobe loop >/dev/null 2>&1
584 if grep loop /proc/devices >/dev/null 2>&1
588 _notrun "This test requires loopback device support"
592 # this test requires that (large) loopback device files are not in use
594 _require_nobigloopfs()
596 [ "$USE_BIG_LOOPFS" = yes ] && \
597 _notrun "Large filesystem testing in progress, skipped this test"
600 # this test requires that a realtime subvolume is in use, and
601 # that the kernel supports realtime as well.
605 [ "$USE_EXTERNAL" = yes ] || \
606 _notrun "External volumes not in use, skipped this test"
607 [ "$SCRATCH_RTDEV" = "" ] && \
608 _notrun "Realtime device required, skipped this test"
611 # this test requires that a specified command (executable) exists
615 [ -x "$1" ] || _notrun "$1 utility required, skipped this test"
618 # this test requires that external log/realtime devices are not in use
620 _require_nonexternal()
622 [ "$USE_EXTERNAL" = yes ] && \
623 _notrun "External device testing in progress, skipped this test"
626 # check for the fsgqa user on the machine
631 cat /etc/passwd | grep -q $qa_user
632 [ "$?" == "0" ] || _notrun "$qa_user user not defined."
635 # check that a FS is mounted as XFS. if so, return mount point
641 echo "Usage: _xfs_mounted device" 1>&2
647 if _mount | grep "$device " | $AWK_PROG '
648 /type xfs/ { print $3 ; exit 0 }
652 echo "_xfs_mounted: $device is not a mounted XFS FS"
658 # remount a FS to a new mode (ro or rw)
664 echo "Usage: _remount device ro/rw" 1>&2
670 if ! mount -o remount,$mode $device
672 echo "_remount: failed to remount filesystem on $device as $mode"
677 # run xfs_check and friends on a FS.
679 # if the filesystem is mounted, it's either remounted ro before being
680 # checked or it's unmounted and then remounted
685 _check_xfs_filesystem()
689 echo "Usage: _check_xfs_filesystem device <logdev>|none <rtdev>|none" 1>&2
693 extra_mount_options=""
695 if [ "$2" != "none" ]; then
696 extra_log_options="-l$2"
697 extra_mount_options="-ologdev=$2"
700 if [ "$3" != "none" ]; then
701 extra_rt_options="-r$3"
702 extra_mount_options=$extra_mount_options" -ortdev=$3"
704 extra_mount_options=$extra_mount_options" $MOUNT_OPTIONS"
706 [ "$FSTYP" != xfs ] && return 0
708 [ "$USE_BIG_LOOPFS" = yes ] && testoption=-t
710 type=`_fs_type $device`
713 if [ "$type" = "xfs" ]
717 if [ $USE_REMOUNT -eq 0 ]
719 mountpoint=`_xfs_mounted $device`
726 $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
727 | tee $tmp.logprint | grep -q "<CLEAN>"
728 if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]
730 echo "_check_xfs_filesystem: filesystem on $device has dirty log (see $seq.full)"
732 echo "_check_xfs_filesystem: filesystem on $device has dirty log" >>$here/$seq.full
733 echo "*** xfs_logprint -t output ***" >>$here/$seq.full
734 cat $tmp.logprint >>$here/$seq.full
735 echo "*** end xfs_logprint output" >>$here/$seq.full
740 $XFS_CHECK_PROG $testoption $extra_log_options $device 2>&1 |\
741 _fix_malloc >$tmp.fs_check
742 if [ -s $tmp.fs_check ]
744 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (c) (see $seq.full)"
746 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
747 echo "*** xfs_check output ***" >>$here/$seq.full
748 cat $tmp.fs_check >>$here/$seq.full
749 echo "*** end xfs_check output" >>$here/$seq.full
753 # repair doesn't scale massively at this stage, optionally skip it for now
754 [ "$USE_BIG_LOOPFS" = yes ] || \
755 $XFS_REPAIR_PROG -n $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
758 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seq.full)"
760 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
761 echo "*** xfs_repair -n output ***" >>$here/$seq.full
762 cat $tmp.repair | _fix_malloc >>$here/$seq.full
763 echo "*** end xfs_repair output" >>$here/$seq.full
767 rm -f $tmp.fs_check $tmp.logprint $tmp.repair
771 echo "*** mount output ***" >>$here/$seq.full
772 _mount >>$here/$seq.full
773 echo "*** end mount output" >>$here/$seq.full
774 elif [ "$type" = "xfs" ]
777 if [ $USE_REMOUNT -eq 0 ]
779 if ! _mount -t xfs $extra_mount_options $device $mountpoint
781 echo "!!! failed to remount $device on $mountpoint"
789 [ $ok -eq 0 ] && exit 1
793 # Filter the knowen errors the UDF Verifier reports.
794 _udf_test_known_error_filter()
796 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."
800 _check_udf_filesystem()
802 [ "$DISABLE_UDF_TEST" == "1" ] && return
804 if [ $# -ne 1 -a $# -ne 2 ]
806 echo "Usage: _check_udf_filesystem device [last_block]" 1>&2
810 if [ ! -x $here/src/udf_test ]
812 echo "udf_test not installed, please download and build the Philips"
813 echo "UDF Verification Software from http://www.extra.research.philips.com/udf/."
814 echo "Then copy the udf_test binary to $here/src/."
815 echo "If you do not wish to run udf_test then set environment variable DISABLE_UDF_TEST"
823 LAST_BLOCK=`expr \( $2 - 1 \)`
824 OPT_ARG="-lastvalidblock $LAST_BLOCK"
828 sleep 1 # Due to a problem with time stamps in udf_test
829 $here/src/udf_test $OPT_ARG $device | tee $here/$seq.checkfs | egrep "Error|Warning" | \
830 _udf_test_known_error_filter | \
831 egrep -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning count:.*[0-9]+.*total occurrences:.*[0-9]+" | \
832 sed "s/^.*$/Warning UDF Verifier reported errors see $seq.checkfs./g"
838 if [ "$FSTYP" != "xfs" ]; then
844 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
845 TEST_LOG="$TEST_LOGDEV"
847 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
848 TEST_RT="$TEST_RTDEV"
850 _check_xfs_filesystem $TEST_DEV $TEST_LOG $TEST_RT
852 # check for ipath consistency
853 if $XFS_GROWFS_PROG -n $TEST_DIR | grep -q 'inode-paths=1'; then
854 # errors go to stderr
855 xfs_check_ipaths $TEST_DIR >/dev/null
856 xfs_repair_ipaths -n $TEST_DIR >/dev/null
866 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
867 SCRATCH_LOG="$SCRATCH_LOGDEV"
869 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
870 SCRATCH_RT="$SCRATCH_RTDEV"
872 _check_xfs_filesystem $SCRATCH_DEV $SCRATCH_LOG $SCRATCH_RT
875 _check_udf_filesystem $SCRATCH_DEV $udf_fsize
878 # Don't know how to check an NFS filesystem, yet.
885 _full_fstyp_details()
887 [ -z "$FSTYP" ] && FSTYP=xfs
888 if [ $FSTYP = xfs ]; then
889 if [ -d /proc/fs/xfs ]; then
890 if grep -q 'debug 0' /proc/fs/xfs/stat; then
891 FSTYP="$FSTYP (non-debug)"
892 elif grep -q 'debug 1' /proc/fs/xfs/stat; then
893 FSTYP="$FSTYP (debug)"
896 if uname -a | grep -qi 'debug'; then
897 FSTYP="$FSTYP (debug)"
899 FSTYP="$FSTYP (non-debug)"
906 _full_platform_details()
912 echo "$os/$platform $host $kernel"
927 # Don't know how to check an NFS filesystem, yet.
937 [ "$FSTYP" != "xfs" ] \
938 && _fail "setup_xfs_testdir: \$FSTYP ($FSTYP) is not xfs"
943 _setup_udf_scratchdir()
945 [ "$FSTYP" != "udf" ] \
946 && _fail "setup_udf_testdir: \$FSTYP is not udf"
947 [ -z "$SCRATCH_DEV" -o ! -b "$SCRATCH_DEV" ] \
948 && _notrun "this test requires a valid \$SCRATCH_DEV"
949 [ -z "$SCRATCH_MNT" ] \
950 && _notrun "this test requires a valid \$SCRATCH_MNT"
953 if _mount | grep -q $SCRATCH_DEV
955 # if it's mounted, make sure its on $TEST_RW_DIR
956 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
958 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
960 $UMOUNT_PROG $SCRATCH_DEV
969 _setup_nfs_scratchdir()
971 [ "$FSTYP" != "nfs" ] \
972 && _fail "setup_nfs_testdir: \$FSTYP is not nfs"
973 [ -z "$SCRATCH_DEV" ] \
974 && _notrun "this test requires a valid host fs for \$SCRATCH_DEV"
975 [ -z "$SCRATCH_MNT" ] \
976 && _notrun "this test requires a valid \$SCRATCH_MNT"
979 if _mount | grep -q $SCRATCH_DEV
981 # if it's mounted, make sure its on $SCRATCH_MNT
982 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
984 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
986 $UMOUNT_PROG $SCRATCH_DEV
996 # Warning for UDF and NFS this function calls _setup_udf_scratchdir and
997 # _setup_udf_scratchdir. This is done because testdir is a persistent
998 # XFS only partition.
1007 _setup_udf_scratchdir
1010 _setup_nfs_scratchdir
1013 _fail "\$FSTYP is not xfs, udf or nfs"
1022 # do nothing, testdir is $TEST_DIR
1026 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1027 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1030 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1031 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1034 _fail "\$FSTYP is not xfs, udf or nfs"
1041 if [ -z "$1" ]; then
1042 echo Error must pass \$seq.
1046 if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
1048 elif [ "`uname`" == "Linux" ]; then
1051 echo Error test $seq does not run on the operating system: `uname`
1069 if [ $size -gt 0 ]; then
1070 dd if=/dev/zero of=$file bs=1024 count=$size
1076 # takes dirname, depth
1079 dirname=$1; depth=$2
1080 mkdir $dirname || die "mkdir $dirname failed"
1083 _nfiles $files # files for this dir
1085 [ $depth -eq 0 ] && return
1086 deep=`expr $depth - 1` # go 1 down
1088 [ $verbose = true ] && echo "descending, depth from leaves = $deep"
1091 while [ $d -lt $dirs ]
1093 _descend d$d $deep &
1099 # Populate a filesystem with inodes for performance experiments
1101 # usage: populate [-v] [-n ndirs] [-f nfiles] [-d depth] [-r root] [-s size]
1106 dirs=5 # ndirs in each subdir till leaves
1107 size=0 # sizeof files in K
1108 files=100 # num files in _each_ subdir
1109 depth=2 # depth of tree from root to leaves
1111 root=root # path of initial root of directory tree
1113 while getopts "d:f:n:r:s:v" c
1125 _descend $root $depth
1130 [ $verbose = true ] && echo done
1133 # query whether the given file has the given inode flag set
1140 if which $XFS_IO_PROG >/dev/null; then
1141 if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | grep -q "$flag" ; then
1148 # query the given files extsize allocator hint in bytes (if any)
1155 if which $XFS_IO_PROG >/dev/null; then
1156 blocks=`$XFS_IO_PROG -r -c 'stat' "$file" | \
1157 awk '/^xattr.extsize =/ { print $3 }'`
1159 [ -z "$blocks" ] && blocks="0"
1164 ################################################################################
1166 if [ "$iam" != new -a "$iam" != bench ]
1168 # make some further configuration checks here
1170 if [ "$TEST_DEV" = "" ]
1172 echo "common.rc: Error: \$TEST_DEV is not set"
1176 # if $TEST_DEV is not mounted, mount it now as XFS
1177 if [ -z "`_fs_type $TEST_DEV`" ]
1179 # $TEST_DEV is not mounted
1182 echo "common.rc: retrying test device mount with external set"
1183 [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
1186 echo "common.rc: could not mount $TEST_DEV on $TEST_DIR"
1192 if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
1194 echo "common.rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
1200 # make sure this script returns success