5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
11 file_count=${file_count:-150000}
12 dir_count=${dir_count:-4}
16 [ "$SLOW" = no ] && { file_count=50000; dir_count=2; thrhi=4; }
19 ALWAYS_EXCEPT="$MDS_SURVEY_EXCEPT"
21 MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)}
22 if [ -z ${MDSSURVEY} ]; then
23 skip_env "mds-survey not found" && exit
26 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.51) ]; then
27 skip_env "Need MDS version at least 2.3.51" && exit
31 check_and_setup_lustre
35 local avail_mdt_inode=0
36 local avail_ost_inode=0
38 require_inode=$((file_count * thrhi))
39 # get available inode for mdt
40 avail_mdt_inode=$(lfs_df -i $MOUNT | grep "summary" | awk '{print $4}')
41 avail_mdt_inode=$((avail_mdt_inode * 9 / 10))
43 # get available inode for ost
44 for i in $($LFS df -i | grep ${FSNAME}-OST | awk '{print $4}'); do
45 avail_ost_inode=$((avail_ost_inode + i))
47 avail_ost_inode=$((avail_ost_inode * 9 / 10))
49 ((require_inode > avail_mdt_inode)) && require_inode=$avail_mdt_inode
50 ((require_inode > avail_ost_inode)) && require_inode=$avail_ost_inode
52 if ((require_inode == 0)); then
53 error "Fail to get the inode count"
55 # convert it back to per thread inode
56 require_inode=$((require_inode / thrhi))
62 file_count=$(adjust_inode)
63 ost_count=$($LCTL dl | grep -c osc)
65 # first unmount all the lustre clients
70 local mds=$(facet_host $SINGLEMDS)
71 echo $(do_nodes $mds 'lctl dl' | \
72 awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}")
77 local stripe_count=${2:-0}
78 local mds=$(facet_host $SINGLEMDS)
81 rm -f ${TMP}/mds_survey*
83 local target=$(get_target)
84 local cmd="file_count=$file_count thrlo=$thrlo thrhi=$thrhi"
85 local cmd+=" dir_count=$dir_count layer=$layer stripe_count=$stripe_count"
86 local cmd+=" rslt_loc=${TMP} targets=\"$mds:$target\" $MDSSURVEY"
90 cat ${TMP}/mds_survey*
91 rm -f ${TMP}/mds_survey*
92 ((rc == 0)) || error "mds-survey failed"
96 mds_survey_run "mdd" "0"
98 run_test 1 "Metadata survey with zero-stripe"
101 if [ $ost_count -eq 0 ]; then
102 skip_env "Need to mount OST to test" && return
104 mds_survey_run "mdd" "1"
106 run_test 2 "Metadata survey with stripe_count = 1"
108 # remount the clients
113 check_and_cleanup_lustre