5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
12 check_and_setup_lustre
14 file_count=${file_count:-100000}
15 dir_count=${dir_count:-4}
19 [ "$SLOW" = no ] && { file_count=50000; dir_count=2; thrhi=4; }
22 ALWAYS_EXCEPT="$MDS_SURVEY_EXCEPT"
24 MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)}
25 if [ -z ${MDSSURVEY} ]; then
26 skip_env "mds-survey not found" && exit
29 # check for available inode, reduce to fit
30 inode_per_thr=$((dir_count * file_count))
31 require_inode=$((inode_per_thr * thrhi * 11/10))
32 avail_inode=$($LFS df -i $MOUNT | grep "filesystem summary:" | \
35 while [ $require_inode -ge $avail_inode ]; do
36 echo "Require $require_inode inode to run, only have $avail_inode"
38 file_count=$((file_count * 8 / 10))
39 inode_per_thr=$((dir_count * file_count))
40 require_inode=$((inode_per_thr * thrhi * 11 / 10))
43 if [ $require_inode -eq 0 ]; then
44 skip_env "Not enough inode to run" && exit
47 ost_count=$($LCTL dl | grep -c osc)
49 # first unmount all the lustre clients
54 local mds=$(facet_host $SINGLEMDS)
55 echo $(do_nodes $mds 'lctl dl' | \
56 awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}")
61 local stripe_count=${2:-0}
62 local mds=$(facet_host $SINGLEMDS)
64 rm -f ${TMP}/mds_survey*
66 local target=$(get_target)
67 local cmd1="file_count=$file_count thrlo=$thrlo thrhi=$thrhi"
68 local cmd2="dir_count=$dir_count layer=$layer stripe_count=$stripe_count"
69 local cmd3="rslt_loc=${TMP} targets=\"$mds:$target\" $MDSSURVEY"
70 local cmd="$cmd1 $cmd2 $cmd3"
73 eval $cmd || error "mds-survey failed"
74 cat ${TMP}/mds_survey*
75 rm -f ${TMP}/mds_survey*
79 mds_survey_run "mdd" "0"
81 run_test 1 "Metadata survey with zero-stripe"
84 if [ $ost_count -eq 0 ]; then
85 skip_env "Need to mount OST to test" && return
87 mds_survey_run "mdd" "1"
89 run_test 2 "Metadata survey with stripe_count = 1"
94 complete $(basename $0) $SECONDS
96 check_and_cleanup_lustre