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
53 # acls & xattrs aren't turned on by default on ext$FOO
54 export MOUNT_OPTIONS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
57 # acls & xattrs aren't turned on by default on reiserfs
58 export MOUNT_OPTIONS="-o acl,user_xattr $REISERFS_MOUNT_OPTIONS"
61 # acls aren't turned on by default on gfs2
62 export MOUNT_OPTIONS="-o acl $GFS2_MOUNT_OPTIONS"
73 export MKFS_OPTIONS=$XFS_MKFS_OPTIONS
76 [ ! -z "$udf_fsize" ] && \
77 UDF_MKFS_OPTIONS="$UDF_MKFS_OPTIONS -s $udf_fsize"
78 export MKFS_OPTIONS=$UDF_MKFS_OPTIONS
81 export MKFS_OPTIONS=$NFS_MKFS_OPTIONS
84 export MKFS_OPTIONS="$REISERFS_MKFS_OPTIONS -q"
87 export MKFS_OPTIONS="$GFS2_MKFS_OPTIONS -O -p lock_nolock"
94 [ -z "$FSTYP" ] && FSTYP=xfs
95 [ -z "$MOUNT_OPTIONS" ] && _mount_opts
96 [ -z "$MKFS_OPTIONS" ] && _mkfs_opts
99 # we need common.config
100 if [ "$iam" != "check" ]
102 if ! . ./common.config
104 echo "$iam: failed to source common.config"
109 # make sure we have a standard umask
114 $MOUNT_PROG `_mount_ops_filter $*`
122 if [ "$FSTYP" != "xfs" ]; then
128 [ "$HOSTOS" != "IRIX" ] && SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f"
137 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
138 SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV"
139 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
140 SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV"
148 if [ "$FSTYP" != "xfs" ]; then
162 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
163 TEST_OPTIONS="$TEST_OPTIONS ${rt_opt}rtdev=$TEST_RTDEV"
164 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
165 TEST_OPTIONS="$TEST_OPTIONS ${log_opt}logdev=$TEST_LOGDEV"
172 #get mount point to handle dmapi mtpt option correctly
174 [ $last_index -gt 0 ] && shift $last_index
177 # irix is fussy about how it is fed its mount options
178 # - multiple -o's are not allowed
179 # - no spaces between comma delimitered options
180 # the sed script replaces all -o's (except the first) with a comma
181 # not required for linux, but won't hurt
183 echo $params | sed -e 's/[[:space:]]*-o[[:space:]]*/UnIqUe/1; s/[[:space:]]*-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
184 | sed -e 's/dmapi/dmi/' \
185 | $PERL_PROG -ne "s#mtpt=[^,|^\n|^\s]*#mtpt=$FS_ESCAPED\1\2#; print;"
189 _scratch_mount_options()
191 _scratch_options mount
193 echo $SCRATCH_OPTIONS $MOUNT_OPTIONS $* $SCRATCH_DEV $SCRATCH_MNT
198 _mount -t $FSTYP `_scratch_mount_options $*`
204 _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $* $TEST_DEV $TEST_DIR
207 _scratch_mkfs_options()
209 _scratch_options mkfs
210 echo $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
215 # extra mkfs options can be added by tests
216 local extra_mkfs_options=$*
220 _scratch_options mkfs
222 # save mkfs output in case conflict means we need to run again.
223 # only the output for the mkfs that applies should be shown
224 $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS $extra_mkfs_options $SCRATCH_DEV \
225 2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd
228 # a mkfs failure may be caused by conflicts between
229 # $MKFS_OPTIONS and $extra_mkfs_options
231 if [ $mkfs_status -ne 0 -a ! -z "$extra_mkfs_options" ]; then
232 echo "** mkfs failed with extra mkfs options added to \"$MKFS_OPTIONS\" by test $seq **" \
234 echo "** attempting to mkfs using only test $seq options: $extra_mkfs_options **" \
236 # running mkfs again. overwrite previous mkfs output files
237 $MKFS_XFS_PROG $SCRATCH_OPTIONS $extra_mkfs_options $SCRATCH_DEV \
238 2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd
242 # output stored mkfs output
243 cat $tmp_dir.mkfserr >&2
245 rm -f $tmp_dir.mkfserr $tmp_dir.mkfsstd
247 if [ "$USE_BIG_LOOPFS" = yes ]; then
248 [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
249 ./tools/ag-wipe -q -r $RETAIN_AG_BYTES $SCRATCH_DEV
265 $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
268 /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
273 _scratch_xfs_db_options()
276 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
277 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
278 echo $SCRATCH_OPTIONS $* $SCRATCH_DEV
281 _scratch_xfs_logprint()
284 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
285 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
286 $XFS_LOGPRINT_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
292 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
293 SCRATCH_OPTIONS="-l $SCRATCH_LOGDEV"
294 $XFS_CHECK_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
297 _scratch_xfs_repair()
300 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
301 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
302 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
303 SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -r$SCRATCH_RTDEV"
304 [ "$USE_BIG_LOOPFS" = yes ] && SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -t"
305 $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
312 echo "Usage: _get_pids_by_name process-name" 1>&2
316 # Algorithm ... all ps(1) variants have a time of the form MM:SS or
317 # HH:MM:SS before the psargs field, use this as the search anchor.
319 # Matches with $1 (process-name) occur if the first psarg is $1
320 # or ends in /$1 ... the matching uses sed's regular expressions,
321 # so passing a regex into $1 will work.
329 -e "/[0-9]:[0-9][0-9] *[^ ]*\/$1 /s/ .*//p" \
330 -e "/[0-9]:[0-9][0-9] *$1 /s/ .*//p"
333 # fix malloc libs output
337 # filter out the Electric Fence notice
340 if (defined $o && /^\s+Electric Fence/) {
346 print $o if (defined $o);
350 print $o if (defined $o);
354 # check if run as root
358 id=`id | $SED_PROG -e 's/(.*//' -e 's/.*=//'`
361 echo "Arrgh ... you need to be root (not uid=$id) to run this test"
368 # _df_device : get an IRIX style df line for a given device
370 # - returns "" if not mounted
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_device device" 1>&2
384 $DF_PROG 2>/dev/null | $AWK_PROG -v what=$1 '
385 match($1,what) && NF==1 {
399 # _df_dir : get an IRIX style df line for device where a directory resides
401 # - returns fs type in field two (ala IRIX)
402 # - joins line together if split by fancy df formatting
403 # - strips header etc
410 echo "Usage: _df_dir device" 1>&2
414 $DF_PROG $1 2>/dev/null | $AWK_PROG -v what=$1 '
430 # return percentage used disk space for mounted device
436 echo "Usage: _used device" 1>&2
440 _df_device $1 | $AWK_PROG '{ sub("%", "") ; print $6 }'
443 # return the FS type of a mounted device
449 echo "Usage: _fs_type device" 1>&2
453 _df_device $1 | $AWK_PROG '{ print $2 }'
456 # return the FS mount options of a mounted device
458 # should write a version which just parses the output of mount for IRIX
459 # compatibility, but since this isn't used at all, at the moment I'll leave
466 echo "Usage: _fs_options device" 1>&2
470 $AWK_PROG -v dev=$1 '
471 match($1,dev) { print $4 }
475 # returns device number if a file is a block device
481 echo "Usage: _is_block_dev dev" 1>&2
485 [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }'
488 # Do a command, log it to $seq.full, optionally test return status
489 # and die if command fails. If called with one argument _do executes the
490 # command, logs it, and returns its exit status. With two arguments _do
491 # first prints the message passed in the first argument, and then "done"
492 # or "fail" depending on the return status of the command passed in the
493 # second argument. If the command fails and the variable _do_die_on_error
494 # is set to "always" or the two argument form is used and _do_die_on_error
495 # is set to "message_only" _do will print an error message to
500 if [ $# -eq 1 ]; then
502 elif [ $# -eq 2 ]; then
507 echo "Usage: _do [note] cmd" 1>&2
511 (eval "echo '---' \"$_cmd\"") >>$here/$seq.full
512 (eval "$_cmd") >$tmp._out 2>&1; ret=$?
513 cat $tmp._out | _fix_malloc >>$here/$seq.full
514 if [ $# -eq 2 ]; then
515 if [ $ret -eq 0 ]; then
522 && [ "$_do_die_on_error" = "always" \
523 -o \( $# -eq 2 -a "$_do_die_on_error" = "message_only" \) ]
526 eval "echo \"$_cmd\" failed \(returned $ret\): see $seq.full"
533 # bail out, setting up .notrun file
537 echo "$*" >$seq.notrun
538 echo "$seq not run: $*"
543 # just plain bail out
547 echo "$*" | tee -a $here/$seq.full
548 echo "(see $seq.full for details)"
553 # tests whether $FSTYP is one of the supported filesystems for a test
559 if [ "$f" = "$FSTYP" -o "$f" = "generic" ]
565 _notrun "not suitable for this filesystem type: $FSTYP"
568 # tests whether $FSTYP is one of the supported OSes for a test
574 if [ "$h" = "$HOSTOS" ]
580 _notrun "not suitable for this OS: $HOSTOS"
583 # this test needs a scratch partition - check we're ok & unmount it
589 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
590 if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]
592 _notrun "this test requires a valid \$SCRATCH_DEV"
596 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
598 _notrun "this test requires a valid \$SCRATCH_DEV"
600 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
602 _notrun "this test requires a valid \$SCRATCH_DEV"
608 if _mount | grep -q $SCRATCH_DEV
610 # if it's mounted, make sure its on $SCRATCH_MNT
611 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
613 echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
616 # and then unmount it
617 if ! $UMOUNT_PROG $SCRATCH_DEV
619 echo "failed to unmount $SCRATCH_DEV"
625 # this test needs a logdev
629 [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
630 _notrun "This test requires a valid \$SCRATCH_LOGDEV"
631 [ "$USE_EXTERNAL" != yes ] && \
632 _notrun "This test requires USE_EXTERNAL to be enabled"
634 # ensure its not mounted
635 $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
638 # this test requires loopback device support
642 if [ "$HOSTOS" != "Linux" ]
644 _notrun "This test requires linux for loopback device support"
647 modprobe loop >/dev/null 2>&1
648 if grep loop /proc/devices >/dev/null 2>&1
652 _notrun "This test requires loopback device support"
656 # this test requires that (large) loopback device files are not in use
658 _require_nobigloopfs()
660 [ "$USE_BIG_LOOPFS" = yes ] && \
661 _notrun "Large filesystem testing in progress, skipped this test"
664 # this test requires that a realtime subvolume is in use, and
665 # that the kernel supports realtime as well.
669 [ "$USE_EXTERNAL" = yes ] || \
670 _notrun "External volumes not in use, skipped this test"
671 [ "$SCRATCH_RTDEV" = "" ] && \
672 _notrun "Realtime device required, skipped this test"
675 # this test requires that a specified command (executable) exists
679 [ -x "$1" ] || _notrun "$1 utility required, skipped this test"
682 # this test requires that external log/realtime devices are not in use
684 _require_nonexternal()
686 [ "$USE_EXTERNAL" = yes ] && \
687 _notrun "External device testing in progress, skipped this test"
690 # check for the fsgqa user on the machine
695 cat /etc/passwd | grep -q $qa_user
696 [ "$?" == "0" ] || _notrun "$qa_user user not defined."
699 # check that xfs_io, glibc, kernel, and filesystem all (!) support
702 _require_xfs_io_falloc() {
703 testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $TEST_DIR/$tmp.io 2>&1`
704 rm -f $TEST_DIR/$tmp.io 2>&1 > /dev/null
705 echo $testio | grep -q "not found" && \
706 _notrun "xfs_io fallocate support is missing"
707 echo $testio | grep -q "Operation not supported" && \
708 _notrun "xfs_io fallocate command failed (old kernel/wrong fs?)"
711 # check that a FS on a device is mounted
712 # if so, return mount point
718 echo "Usage: _is_mounted device" 1>&2
724 if _mount | grep "$device " | $AWK_PROG -v pattern="type $FSTYP" '
725 pattern { print $3 ; exit 0 }
729 echo "_is_mounted: $device is not a mounted $FSTYP FS"
734 # remount a FS to a new mode (ro or rw)
740 echo "Usage: _remount device ro/rw" 1>&2
746 if ! mount -o remount,$mode $device
748 echo "_remount: failed to remount filesystem on $device as $mode"
753 # Run the appropriate repair/check on a filesystem
755 # if the filesystem is mounted, it's either remounted ro before being
756 # checked or it's unmounted and then remounted
759 # If set, we remount ro instead of unmounting for fsck
762 _umount_or_remount_ro()
766 echo "Usage: _umount_or_remount_ro <device>" 1>&2
771 mountpoint=`_is_mounted $device`
773 if [ $USE_REMOUNT -eq 0 ]; then
781 _mount_or_remount_rw()
785 echo "Usage: _mount_or_remount_rw <opts> <device> <mountpoint>" 1>&2
792 if [ $USE_REMOUNT -eq 0 ]
794 if ! _mount -t $FSTYP $mount_opts $device $mountpoint
796 echo "!!! failed to remount $device on $mountpoint"
806 # Check a generic filesystem in no-op mode; this assumes that the
807 # underlying fsck program accepts "-n" for a no-op (check-only) run,
808 # and that it will still return an errno for corruption in this mode.
810 # Filesystems which don't support this will need to define their
813 _check_generic_filesystem()
817 # If type is set, we're mounted
818 type=`_fs_type $device`
821 if [ "$type" = "$FSTYP" ]
824 mountpoint=`_umount_or_remount_ro $device`
827 fsck -t $FSTYP -n $device >$tmp.fsck 2>&1
830 echo "_check_generic_filesystem: filesystem on $device is inconsistent (see $seq.full)"
832 echo "_check_generic filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
833 echo "*** fsck.$FSTYP output ***" >>$here/$seq.full
834 cat $tmp.fsck >>$here/$seq.full
835 echo "*** end fsck.$FSTYP output" >>$here/$seq.full
843 echo "*** mount output ***" >>$here/$seq.full
844 _mount >>$here/$seq.full
845 echo "*** end mount output" >>$here/$seq.full
846 elif [ "$type" = "$FSTYP" ]
849 _mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
853 [ $ok -eq 0 ] && exit 1
857 # run xfs_check and friends on a FS.
859 _check_xfs_filesystem()
863 echo "Usage: _check_xfs_filesystem device <logdev>|none <rtdev>|none" 1>&2
867 extra_mount_options=""
869 if [ "$2" != "none" ]; then
870 extra_log_options="-l$2"
871 extra_mount_options="-ologdev=$2"
874 if [ "$3" != "none" ]; then
875 extra_rt_options="-r$3"
876 extra_mount_options=$extra_mount_options" -ortdev=$3"
878 extra_mount_options=$extra_mount_options" $MOUNT_OPTIONS"
880 [ "$FSTYP" != xfs ] && return 0
882 [ "$USE_BIG_LOOPFS" = yes ] && testoption=-t
884 type=`_fs_type $device`
887 if [ "$type" = "xfs" ]
890 mountpoint=`_umount_or_remount_ro $device`
893 $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
894 | tee $tmp.logprint | grep -q "<CLEAN>"
895 if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]
897 echo "_check_xfs_filesystem: filesystem on $device has dirty log (see $seq.full)"
899 echo "_check_xfs_filesystem: filesystem on $device has dirty log" >>$here/$seq.full
900 echo "*** xfs_logprint -t output ***" >>$here/$seq.full
901 cat $tmp.logprint >>$here/$seq.full
902 echo "*** end xfs_logprint output" >>$here/$seq.full
907 $XFS_CHECK_PROG $testoption $extra_log_options $device 2>&1 |\
908 _fix_malloc >$tmp.fs_check
909 if [ -s $tmp.fs_check ]
911 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (c) (see $seq.full)"
913 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
914 echo "*** xfs_check output ***" >>$here/$seq.full
915 cat $tmp.fs_check >>$here/$seq.full
916 echo "*** end xfs_check output" >>$here/$seq.full
920 # repair doesn't scale massively at this stage, optionally skip it for now
921 [ "$USE_BIG_LOOPFS" = yes ] || \
922 $XFS_REPAIR_PROG -n $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
925 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seq.full)"
927 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
928 echo "*** xfs_repair -n output ***" >>$here/$seq.full
929 cat $tmp.repair | _fix_malloc >>$here/$seq.full
930 echo "*** end xfs_repair output" >>$here/$seq.full
934 rm -f $tmp.fs_check $tmp.logprint $tmp.repair
938 echo "*** mount output ***" >>$here/$seq.full
939 _mount >>$here/$seq.full
940 echo "*** end mount output" >>$here/$seq.full
941 elif [ "$type" = "xfs" ]
943 _mount_or_remount_rw "$extra_mount_options" $device $mountpoint
946 [ $ok -eq 0 ] && exit 1
950 # Filter the knowen errors the UDF Verifier reports.
951 _udf_test_known_error_filter()
953 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."
957 _check_udf_filesystem()
959 [ "$DISABLE_UDF_TEST" == "1" ] && return
961 if [ $# -ne 1 -a $# -ne 2 ]
963 echo "Usage: _check_udf_filesystem device [last_block]" 1>&2
967 if [ ! -x $here/src/udf_test ]
969 echo "udf_test not installed, please download and build the Philips"
970 echo "UDF Verification Software from http://www.extra.research.philips.com/udf/."
971 echo "Then copy the udf_test binary to $here/src/."
972 echo "If you do not wish to run udf_test then set environment variable DISABLE_UDF_TEST"
980 LAST_BLOCK=`expr \( $2 - 1 \)`
981 OPT_ARG="-lastvalidblock $LAST_BLOCK"
985 sleep 1 # Due to a problem with time stamps in udf_test
986 $here/src/udf_test $OPT_ARG $device | tee $here/$seq.checkfs | egrep "Error|Warning" | \
987 _udf_test_known_error_filter | \
988 egrep -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning count:.*[0-9]+.*total occurrences:.*[0-9]+" | \
989 sed "s/^.*$/Warning UDF Verifier reported errors see $seq.checkfs./g"
997 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
998 TEST_LOG="$TEST_LOGDEV"
1000 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
1001 TEST_RT="$TEST_RTDEV"
1003 _check_xfs_filesystem $TEST_DEV $TEST_LOG $TEST_RT
1005 # check for ipath consistency
1006 if $XFS_GROWFS_PROG -n $TEST_DIR | grep -q 'inode-paths=1'; then
1007 # errors go to stderr
1008 xfs_check_ipaths $TEST_DIR >/dev/null
1009 xfs_repair_ipaths -n $TEST_DIR >/dev/null
1020 # no way to check consistency for nfs
1023 # do nothing for now
1026 _check_generic_filesystem $TEST_DEV
1037 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
1038 SCRATCH_LOG="$SCRATCH_LOGDEV"
1040 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
1041 SCRATCH_RT="$SCRATCH_RTDEV"
1043 _check_xfs_filesystem $SCRATCH_DEV $SCRATCH_LOG $SCRATCH_RT
1046 _check_udf_filesystem $SCRATCH_DEV $udf_fsize
1049 # Don't know how to check an NFS filesystem, yet.
1052 _check_generic_filesystem $SCRATCH_DEV
1057 _full_fstyp_details()
1059 [ -z "$FSTYP" ] && FSTYP=xfs
1060 if [ $FSTYP = xfs ]; then
1061 if [ -d /proc/fs/xfs ]; then
1062 if grep -q 'debug 0' /proc/fs/xfs/stat; then
1063 FSTYP="$FSTYP (non-debug)"
1064 elif grep -q 'debug 1' /proc/fs/xfs/stat; then
1065 FSTYP="$FSTYP (debug)"
1068 if uname -a | grep -qi 'debug'; then
1069 FSTYP="$FSTYP (debug)"
1071 FSTYP="$FSTYP (non-debug)"
1078 _full_platform_details()
1084 echo "$os/$platform $host $kernel"
1087 _setup_udf_scratchdir()
1089 [ "$FSTYP" != "udf" ] \
1090 && _fail "setup_udf_testdir: \$FSTYP is not udf"
1091 [ -z "$SCRATCH_DEV" -o ! -b "$SCRATCH_DEV" ] \
1092 && _notrun "this test requires a valid \$SCRATCH_DEV"
1093 [ -z "$SCRATCH_MNT" ] \
1094 && _notrun "this test requires a valid \$SCRATCH_MNT"
1097 if _mount | grep -q $SCRATCH_DEV
1099 # if it's mounted, make sure its on $TEST_RW_DIR
1100 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
1102 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
1104 $UMOUNT_PROG $SCRATCH_DEV
1110 testdir=$SCRATCH_MNT
1113 _setup_nfs_scratchdir()
1115 [ "$FSTYP" != "nfs" ] \
1116 && _fail "setup_nfs_testdir: \$FSTYP is not nfs"
1117 [ -z "$SCRATCH_DEV" ] \
1118 && _notrun "this test requires a valid host fs for \$SCRATCH_DEV"
1119 [ -z "$SCRATCH_MNT" ] \
1120 && _notrun "this test requires a valid \$SCRATCH_MNT"
1123 if _mount | grep -q $SCRATCH_DEV
1125 # if it's mounted, make sure its on $SCRATCH_MNT
1126 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
1128 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
1130 $UMOUNT_PROG $SCRATCH_DEV
1136 testdir=$SCRATCH_MNT
1140 # Warning for UDF and NFS:
1141 # this function calls _setup_udf_scratchdir and _setup_udf_scratchdir
1142 # which actually uses the scratch dir for the test dir.
1144 # This was done because testdir was intended to be a persistent
1145 # XFS only partition. This should eventually change, and treat
1146 # at least local filesystems all the same.
1152 _setup_udf_scratchdir
1155 _setup_nfs_scratchdir
1167 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1168 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1171 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1172 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1175 # do nothing, testdir is $TEST_DIR
1183 if [ -z "$1" ]; then
1184 echo Error must pass \$seq.
1188 if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
1190 elif [ "`uname`" == "Linux" ]; then
1193 echo Error test $seq does not run on the operating system: `uname`
1211 if [ $size -gt 0 ]; then
1212 dd if=/dev/zero of=$file bs=1024 count=$size
1218 # takes dirname, depth
1221 dirname=$1; depth=$2
1222 mkdir $dirname || die "mkdir $dirname failed"
1225 _nfiles $files # files for this dir
1227 [ $depth -eq 0 ] && return
1228 let deep=$depth-1 # go 1 down
1230 [ $verbose = true ] && echo "descending, depth from leaves = $deep"
1233 while [ $d -lt $dirs ]
1235 _descend d$d $deep &
1241 # Populate a filesystem with inodes for performance experiments
1243 # usage: populate [-v] [-n ndirs] [-f nfiles] [-d depth] [-r root] [-s size]
1248 dirs=5 # ndirs in each subdir till leaves
1249 size=0 # sizeof files in K
1250 files=100 # num files in _each_ subdir
1251 depth=2 # depth of tree from root to leaves
1253 root=root # path of initial root of directory tree
1255 while getopts "d:f:n:r:s:v" c
1267 _descend $root $depth
1272 [ $verbose = true ] && echo done
1275 # query whether the given file has the given inode flag set
1282 if which $XFS_IO_PROG >/dev/null; then
1283 if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | grep -q "$flag" ; then
1290 # query the given files extsize allocator hint in bytes (if any)
1297 if which $XFS_IO_PROG >/dev/null; then
1298 blocks=`$XFS_IO_PROG -r -c 'stat' "$file" | \
1299 awk '/^xattr.extsize =/ { print $3 }'`
1301 [ -z "$blocks" ] && blocks="0"
1306 ################################################################################
1308 if [ "$iam" != new -a "$iam" != bench ]
1310 # make some further configuration checks here
1312 if [ "$TEST_DEV" = "" ]
1314 echo "common.rc: Error: \$TEST_DEV is not set"
1318 # if $TEST_DEV is not mounted, mount it now as XFS
1319 if [ -z "`_fs_type $TEST_DEV`" ]
1321 # $TEST_DEV is not mounted
1324 echo "common.rc: retrying test device mount with external set"
1325 [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
1328 echo "common.rc: could not mount $TEST_DEV on $TEST_DIR"
1334 if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
1336 echo "common.rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
1342 # make sure this script returns success