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 | $PERL_PROG -ne "s#mtpt=[^,|^\n|^\s]*#mtpt=$FS_ESCAPED\1\2#; print;"
170 _scratch_mount_options()
172 _scratch_options mount
174 echo $SCRATCH_OPTIONS $MOUNT_OPTIONS $* $SCRATCH_DEV $SCRATCH_MNT
179 _mount -t $FSTYP `_scratch_mount_options $*`
185 _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $* $TEST_DEV $TEST_DIR
188 _scratch_mkfs_options()
190 _scratch_options mkfs
191 echo $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
196 _scratch_options mkfs
198 $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
201 if [ "$USE_BIG_LOOPFS" = yes ]; then
202 [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
203 ./tools/ag-wipe -q -r $RETAIN_AG_BYTES $SCRATCH_DEV
219 $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
222 /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null
227 _scratch_xfs_db_options()
230 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
231 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
232 echo $SCRATCH_OPTIONS $* $SCRATCH_DEV
235 _scratch_xfs_logprint()
238 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
239 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
240 $XFS_LOGPRINT_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
243 _scratch_xfs_repair()
246 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
247 SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
248 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
249 SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -r$SCRATCH_RTDEV"
250 [ "$USE_BIG_LOOPFS" = yes ] && SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -t"
251 $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
258 echo "Usage: _get_pids_by_name process-name" 1>&2
262 # Algorithm ... all ps(1) variants have a time of the form MM:SS or
263 # HH:MM:SS before the psargs field, use this as the search anchor.
265 # Matches with $1 (process-name) occur if the first psarg is $1
266 # or ends in /$1 ... the matching uses sed's regular expressions,
267 # so passing a regex into $1 will work.
275 -e "/[0-9]:[0-9][0-9] *[^ ]*\/$1 /s/ .*//p" \
276 -e "/[0-9]:[0-9][0-9] *$1 /s/ .*//p"
284 $NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
287 # fix malloc libs output
291 # filter out the Electric Fence notice
294 if (defined $o && /^\s+Electric Fence/) {
300 print $o if (defined $o);
304 print $o if (defined $o);
308 # check if run as root
312 id=`id | $SED_PROG -e 's/(.*//' -e 's/.*=//'`
315 echo "Arrgh ... you need to be root (not uid=$id) to run this test"
322 # _df_device : get an IRIX style df line for a given device
324 # - returns "" if not mounted
325 # - returns fs type in field two (ala IRIX)
326 # - joins line together if split by fancy df formatting
327 # - strips header etc
334 echo "Usage: _df_device device" 1>&2
338 $DF_PROG 2>/dev/null | $AWK_PROG -v what=$1 '
339 match($1,what) && NF==1 {
353 # _df_dir : get an IRIX style df line for device where a directory resides
355 # - returns fs type in field two (ala IRIX)
356 # - joins line together if split by fancy df formatting
357 # - strips header etc
364 echo "Usage: _df_dir device" 1>&2
368 $DF_PROG $1 2>/dev/null | $AWK_PROG -v what=$1 '
384 # return percentage used disk space for mounted device
390 echo "Usage: _used device" 1>&2
394 _df_device $1 | $AWK_PROG '{ sub("%", "") ; print $6 }'
397 # return the FS type of a mounted device
403 echo "Usage: _fs_type device" 1>&2
407 _df_device $1 | $AWK_PROG '{ print $2 }'
410 # return the FS mount options of a mounted device
412 # should write a version which just parses the output of mount for IRIX
413 # compatibility, but since this isn't used at all, at the moment I'll leave
420 echo "Usage: _fs_options device" 1>&2
424 $AWK_PROG -v dev=$1 '
425 match($1,dev) { print $4 }
429 # returns device number if a file is a block device
435 echo "Usage: _is_block_dev dev" 1>&2
439 [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }'
442 # Do a command, log it to $seq.full, optionally test return status
443 # and die if command fails. If called with one argument _do executes the
444 # command, logs it, and returns its exit status. With two arguments _do
445 # first prints the message passed in the first argument, and then "done"
446 # or "fail" depending on the return status of the command passed in the
447 # second argument. If the command fails and the variable _do_die_on_error
448 # is set to "always" or the two argument form is used and _do_die_on_error
449 # is set to "message_only" _do will print an error message to
454 if [ $# -eq 1 ]; then
456 elif [ $# -eq 2 ]; then
461 echo "Usage: _do [note] cmd" 1>&2
465 (eval "echo '---' \"$_cmd\"") >>$here/$seq.full
466 (eval "$_cmd") >$tmp._out 2>&1; ret=$?
467 cat $tmp._out | _fix_malloc >>$here/$seq.full
468 if [ $# -eq 2 ]; then
469 if [ $ret -eq 0 ]; then
476 && [ "$_do_die_on_error" = "always" \
477 -o \( $# -eq 2 -a "$_do_die_on_error" = "message_only" \) ]
480 eval "echo \"$_cmd\" failed \(returned $ret\): see $seq.full"
487 # bail out, setting up .notrun file
491 echo "$*" >$seq.notrun
492 echo "$seq not run: $*"
497 # just plain bail out
501 echo "$*" | tee -a $here/$seq.full
502 echo "(see $seq.full for details)"
507 # tests whether $FSTYP is one of the supported filesystems for a test
513 if [ "$f" = "$FSTYP" ]
519 _notrun "not suitable for this filesystem type: $FSTYP"
522 # tests whether $FSTYP is one of the supported OSes for a test
528 if [ "$h" = "$HOSTOS" ]
534 _notrun "not suitable for this OS: $HOSTOS"
537 # this test needs a scratch partition - check we're ok & unmount it
543 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
545 _notrun "this test requires a valid \$SCRATCH_DEV"
547 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
549 _notrun "this test requires a valid \$SCRATCH_DEV"
552 nfs*|ext2|ext3|reiserfs)
553 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
554 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
556 _notrun "this test requires a valid \$SCRATCH_DEV"
560 _notrun "\$FSTYP ($FSTYP) unknown or not specified"
565 if _mount | grep -q $SCRATCH_DEV
567 # if it's mounted, make sure its on $SCRATCH_MNT
568 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
570 echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
573 # and then unmount it
574 if ! $UMOUNT_PROG $SCRATCH_DEV
576 echo "failed to unmount $SCRATCH_DEV"
582 # this test needs a logdev
586 [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
587 _notrun "This test requires a valid \$SCRATCH_LOGDEV"
588 [ "$USE_EXTERNAL" != yes ] && \
589 _notrun "This test requires USE_EXTERNAL to be enabled"
591 # ensure its not mounted
592 $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
595 # this test requires loopback device support
599 if [ "$HOSTOS" != "Linux" ]
601 _notrun "This test requires linux for loopback device support"
604 modprobe loop >/dev/null 2>&1
605 if grep loop /proc/devices >/dev/null 2>&1
609 _notrun "This test requires loopback device support"
613 # this test requires that (large) loopback device files are not in use
615 _require_nobigloopfs()
617 [ "$USE_BIG_LOOPFS" = yes ] && \
618 _notrun "Large filesystem testing in progress, skipped this test"
621 # this test requires that a realtime subvolume is in use, and
622 # that the kernel supports realtime as well.
626 [ "$USE_EXTERNAL" = yes ] || \
627 _notrun "External volumes not in use, skipped this test"
628 [ "$SCRATCH_RTDEV" = "" ] && \
629 _notrun "Realtime device required, skipped this test"
632 # this test requires that a specified command (executable) exists
636 [ -x "$1" ] || _notrun "$1 utility required, skipped this test"
639 # this test requires that external log/realtime devices are not in use
641 _require_nonexternal()
643 [ "$USE_EXTERNAL" = yes ] && \
644 _notrun "External device testing in progress, skipped this test"
647 # check for the fsgqa user on the machine
652 cat /etc/passwd | grep -q $qa_user
653 [ "$?" == "0" ] || _notrun "$qa_user user not defined."
656 # check that a FS is mounted as XFS. if so, return mount point
662 echo "Usage: _xfs_mounted device" 1>&2
668 if _mount | grep "$device " | $AWK_PROG '
669 /type xfs/ { print $3 ; exit 0 }
673 echo "_xfs_mounted: $device is not a mounted XFS FS"
679 # remount a FS to a new mode (ro or rw)
685 echo "Usage: _remount device ro/rw" 1>&2
691 if ! mount -o remount,$mode $device
693 echo "_remount: failed to remount filesystem on $device as $mode"
698 # run xfs_check and friends on a FS.
700 # if the filesystem is mounted, it's either remounted ro before being
701 # checked or it's unmounted and then remounted
706 _check_xfs_filesystem()
710 echo "Usage: _check_xfs_filesystem device <logdev>|none <rtdev>|none" 1>&2
714 extra_mount_options=""
716 if [ "$2" != "none" ]; then
717 extra_log_options="-l$2"
718 extra_mount_options="-ologdev=$2"
721 if [ "$3" != "none" ]; then
722 extra_rt_options="-r$3"
723 extra_mount_options=$extra_mount_options" -ortdev=$3"
725 extra_mount_options=$extra_mount_options" $MOUNT_OPTIONS"
727 [ "$FSTYP" != xfs ] && return 0
729 [ "$USE_BIG_LOOPFS" = yes ] && testoption=-t
731 type=`_fs_type $device`
734 if [ "$type" = "xfs" ]
738 if [ $USE_REMOUNT -eq 0 ]
740 mountpoint=`_xfs_mounted $device`
747 $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
748 | tee $tmp.logprint | grep -q "<CLEAN>"
749 if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]
751 echo "_check_xfs_filesystem: filesystem on $device has dirty log (see $seq.full)"
753 echo "_check_xfs_filesystem: filesystem on $device has dirty log" >>$here/$seq.full
754 echo "*** xfs_logprint -t output ***" >>$here/$seq.full
755 cat $tmp.logprint >>$here/$seq.full
756 echo "*** end xfs_logprint output" >>$here/$seq.full
761 $XFS_CHECK_PROG $testoption $extra_log_options $device 2>&1 |\
762 _fix_malloc >$tmp.fs_check
763 if [ -s $tmp.fs_check ]
765 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (c) (see $seq.full)"
767 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
768 echo "*** xfs_check output ***" >>$here/$seq.full
769 cat $tmp.fs_check >>$here/$seq.full
770 echo "*** end xfs_check output" >>$here/$seq.full
774 # repair doesn't scale massively at this stage, optionally skip it for now
775 [ "$USE_BIG_LOOPFS" = yes ] || \
776 $XFS_REPAIR_PROG -n $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
779 echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seq.full)"
781 echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
782 echo "*** xfs_repair -n output ***" >>$here/$seq.full
783 cat $tmp.repair | _fix_malloc >>$here/$seq.full
784 echo "*** end xfs_repair output" >>$here/$seq.full
788 rm -f $tmp.fs_check $tmp.logprint $tmp.repair
792 echo "*** mount output ***" >>$here/$seq.full
793 _mount >>$here/$seq.full
794 echo "*** end mount output" >>$here/$seq.full
795 elif [ "$type" = "xfs" ]
798 if [ $USE_REMOUNT -eq 0 ]
800 if ! _mount -t xfs $extra_mount_options $device $mountpoint
802 echo "!!! failed to remount $device on $mountpoint"
810 [ $ok -eq 0 ] && exit 1
814 # Filter the knowen errors the UDF Verifier reports.
815 _udf_test_known_error_filter()
817 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."
821 _check_udf_filesystem()
823 [ "$DISABLE_UDF_TEST" == "1" ] && return
825 if [ $# -ne 1 -a $# -ne 2 ]
827 echo "Usage: _check_udf_filesystem device [last_block]" 1>&2
831 if [ ! -x $here/src/udf_test ]
833 echo "udf_test not installed, please download and build the Philips"
834 echo "UDF Verification Software from http://www.extra.research.philips.com/udf/."
835 echo "Then copy the udf_test binary to $here/src/."
836 echo "If you do not wish to run udf_test then set environment variable DISABLE_UDF_TEST"
844 LAST_BLOCK=`expr \( $2 - 1 \)`
845 OPT_ARG="-lastvalidblock $LAST_BLOCK"
849 sleep 1 # Due to a problem with time stamps in udf_test
850 $here/src/udf_test $OPT_ARG $device | tee $here/$seq.checkfs | egrep "Error|Warning" | \
851 _udf_test_known_error_filter | \
852 egrep -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning count:.*[0-9]+.*total occurrences:.*[0-9]+" | \
853 sed "s/^.*$/Warning UDF Verifier reported errors see $seq.checkfs./g"
859 if [ "$FSTYP" != "xfs" ]; then
865 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
866 TEST_LOG="$TEST_LOGDEV"
868 [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ] && \
869 TEST_RT="$TEST_RTDEV"
871 _check_xfs_filesystem $TEST_DEV $TEST_LOG $TEST_RT
873 # check for ipath consistency
874 if $XFS_GROWFS_PROG -n $TEST_DIR | grep -q 'inode-paths=1'; then
875 # errors go to stderr
876 xfs_check_ipaths $TEST_DIR >/dev/null
877 xfs_repair_ipaths -n $TEST_DIR >/dev/null
887 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
888 SCRATCH_LOG="$SCRATCH_LOGDEV"
890 [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
891 SCRATCH_RT="$SCRATCH_RTDEV"
893 _check_xfs_filesystem $SCRATCH_DEV $SCRATCH_LOG $SCRATCH_RT
896 _check_udf_filesystem $SCRATCH_DEV $udf_fsize
899 # Don't know how to check an NFS filesystem, yet.
906 _full_fstyp_details()
908 [ -z "$FSTYP" ] && FSTYP=xfs
909 if [ $FSTYP = xfs ]; then
910 if [ -d /proc/fs/xfs ]; then
911 if grep -q 'debug 0' /proc/fs/xfs/stat; then
912 FSTYP="$FSTYP (non-debug)"
913 elif grep -q 'debug 1' /proc/fs/xfs/stat; then
914 FSTYP="$FSTYP (debug)"
917 if uname -a | grep -qi 'debug'; then
918 FSTYP="$FSTYP (debug)"
920 FSTYP="$FSTYP (non-debug)"
927 _full_platform_details()
933 echo "$os/$platform $host $kernel"
948 # Don't know how to check an NFS filesystem, yet.
958 [ "$FSTYP" != "xfs" ] \
959 && _fail "setup_xfs_testdir: \$FSTYP ($FSTYP) is not xfs"
964 _setup_udf_scratchdir()
966 [ "$FSTYP" != "udf" ] \
967 && _fail "setup_udf_testdir: \$FSTYP is not udf"
968 [ -z "$SCRATCH_DEV" -o ! -b "$SCRATCH_DEV" ] \
969 && _notrun "this test requires a valid \$SCRATCH_DEV"
970 [ -z "$SCRATCH_MNT" ] \
971 && _notrun "this test requires a valid \$SCRATCH_MNT"
974 if _mount | grep -q $SCRATCH_DEV
976 # if it's mounted, make sure its on $TEST_RW_DIR
977 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
979 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
981 $UMOUNT_PROG $SCRATCH_DEV
990 _setup_nfs_scratchdir()
992 [ "$FSTYP" != "nfs" ] \
993 && _fail "setup_nfs_testdir: \$FSTYP is not nfs"
994 [ -z "$SCRATCH_DEV" ] \
995 && _notrun "this test requires a valid host fs for \$SCRATCH_DEV"
996 [ -z "$SCRATCH_MNT" ] \
997 && _notrun "this test requires a valid \$SCRATCH_MNT"
1000 if _mount | grep -q $SCRATCH_DEV
1002 # if it's mounted, make sure its on $SCRATCH_MNT
1003 if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
1005 _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
1007 $UMOUNT_PROG $SCRATCH_DEV
1013 testdir=$SCRATCH_MNT
1017 # Warning for UDF and NFS this function calls _setup_udf_scratchdir and
1018 # _setup_udf_scratchdir. This is done because testdir is a persistent
1019 # XFS only partition.
1028 _setup_udf_scratchdir
1031 _setup_nfs_scratchdir
1034 _fail "\$FSTYP is not xfs, udf or nfs"
1043 # do nothing, testdir is $TEST_DIR
1047 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1048 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1051 # umount testdir as it is $SCRATCH_MNT which could be used by xfs next
1052 [ -n "$testdir" ] && $UMOUNT_PROG $testdir
1055 _fail "\$FSTYP is not xfs, udf or nfs"
1062 if [ -z "$1" ]; then
1063 echo Error must pass \$seq.
1067 if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
1069 elif [ "`uname`" == "Linux" ]; then
1072 echo Error test $seq does not run on the operating system: `uname`
1090 if [ $size -gt 0 ]; then
1091 dd if=/dev/zero of=$file bs=1024 count=$size
1097 # takes dirname, depth
1100 dirname=$1; depth=$2
1101 mkdir $dirname || die "mkdir $dirname failed"
1104 _nfiles $files # files for this dir
1106 [ $depth -eq 0 ] && return
1107 deep=`expr $depth - 1` # go 1 down
1109 [ $verbose = true ] && echo "descending, depth from leaves = $deep"
1112 while [ $d -lt $dirs ]
1114 _descend d$d $deep &
1120 # Populate a filesystem with inodes for performance experiments
1122 # usage: populate [-v] [-n ndirs] [-f nfiles] [-d depth] [-r root] [-s size]
1127 dirs=5 # ndirs in each subdir till leaves
1128 size=0 # sizeof files in K
1129 files=100 # num files in _each_ subdir
1130 depth=2 # depth of tree from root to leaves
1132 root=root # path of initial root of directory tree
1134 while getopts "d:f:n:r:s:v" c
1146 _descend $root $depth
1151 [ $verbose = true ] && echo done
1154 # query whether the given file has the given inode flag set
1161 if which $XFS_IO_PROG >/dev/null; then
1162 if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | grep -q "$flag" ; then
1169 # query the given files extsize allocator hint in bytes (if any)
1176 if which $XFS_IO_PROG >/dev/null; then
1177 blocks=`$XFS_IO_PROG -r -c 'stat' "$file" | \
1178 awk '/^xattr.extsize =/ { print $3 }'`
1180 [ -z "$blocks" ] && blocks="0"
1185 ################################################################################
1187 if [ "$iam" != new -a "$iam" != bench ]
1189 # make some further configuration checks here
1191 if [ "$TEST_DEV" = "" ]
1193 echo "common.rc: Error: \$TEST_DEV is not set"
1197 # if $TEST_DEV is not mounted, mount it now as XFS
1198 if [ -z "`_fs_type $TEST_DEV`" ]
1200 # $TEST_DEV is not mounted
1203 echo "common.rc: retrying test device mount with external set"
1204 [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
1207 echo "common.rc: could not mount $TEST_DEV on $TEST_DIR"
1213 if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
1215 echo "common.rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
1221 # make sure this script returns success