4 LUSTRE=${LUSTRE:-$(dirname $0)/..}
5 . $LUSTRE/tests/test-framework.sh
9 ALWAYS_EXCEPT="$MDS_SURVEY_EXCEPT "
13 MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)}
14 [ -z ${MDSSURVEY} ] && skip_env "mds-survey not found"
16 if [ "$MDS1_VERSION" -lt $(version_code 2.3.51) ]; then
17 skip "Need MDS version at least 2.3.51"
20 file_count=${file_count:-150000}
21 dir_count=${dir_count:-4}
25 [ "$SLOW" = no ] && { file_count=50000; dir_count=2; thrhi=4; }
27 check_and_setup_lustre
31 local avail_mdt_inode=0
32 local avail_ost_inode=0
34 require_inode=$((file_count * thrhi))
35 # get available inode for mdt
36 avail_mdt_inode=$(mdt_free_inodes 0)
37 avail_mdt_inode=$((avail_mdt_inode * 9 / 10))
39 # get available inode for ost
40 for i in $($LFS df -i | grep ${FSNAME}-OST | awk '{print $4}'); do
41 avail_ost_inode=$((avail_ost_inode + i))
43 avail_ost_inode=$((avail_ost_inode * 9 / 10))
45 ((require_inode > avail_mdt_inode)) && require_inode=$avail_mdt_inode
46 ((require_inode > avail_ost_inode)) && require_inode=$avail_ost_inode
48 if ((require_inode == 0)); then
49 error "Fail to get the inode count"
51 # convert it back to per thread inode
52 require_inode=$((require_inode / thrhi))
58 file_count=$(adjust_inode)
59 ost_count=$($LCTL dl | grep -c osc)
61 # first unmount all the lustre clients
71 mdts=$(do_node $node "$LCTL dl" |
72 awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}")
75 target+="${target:+ }$node:$mdt"
85 for node in $(mdts_nodes); do
86 targets+="${targets:+ }$(get_target $node)"
94 local stripe_count=${2:-0}
97 rm -f ${TMP}/mds_survey*
99 local cmd="file_count=$file_count thrlo=$thrlo thrhi=$thrhi"
100 cmd+=" dir_count=$dir_count layer=$layer stripe_count=$stripe_count"
101 cmd+=" rslt_loc=${TMP} targets=\"$(get_targets)\" $MDSSURVEY"
103 trap cleanup_echo_devs EXIT ERR
107 cat ${TMP}/mds_survey*
108 rm -f ${TMP}/mds_survey*
109 ((rc == 0)) || error "mds-survey failed"
113 mds_survey_run "mdd" "0"
115 run_test 1 "Metadata survey with zero-stripe"
118 local mdscount=$(get_node_count "$(mdts_nodes)")
120 [ $mdscount -gt 1 ] && skip_env "Only run this test on single MDS"
121 [ $ost_count -eq 0 ] && skip_env "Need to mount OST to test"
123 mds_survey_run "mdd" "1"
125 run_test 2 "Metadata survey with stripe_count = 1"
127 # remount the clients
132 check_and_cleanup_lustre