3 # This test was used in a set of CMD3 tests (cmd3-8 test).
5 # File attribute retrieval rate for large file creation
6 # 3300 ops/sec/OST for single node 28500 ops/sec/OST aggregate
8 # In a dir containing 10 million striped files, the mdsrate Test Program will
9 # perform directory ordered stat's (readdir) for 10 minutes. This test will be
10 # run from a single node for #1 and from all nodes for #2 aggregate test to
11 # measure stat performance.
13 LUSTRE=${LUSTRE:-$(dirname $0)/..}
14 . $LUSTRE/tests/test-framework.sh
17 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
19 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
20 BASEDIR=$MOUNT/mdsrate
24 NUM_FILES=${NUM_FILES:-1000000}
25 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
27 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
29 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
30 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
34 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
36 log "===== $0 ====== "
38 check_and_setup_lustre
40 MDSRATE_ENABLE_DNE=${MDSRATE_ENABLE_DNE:-false}
41 if $MDSRATE_ENABLE_DNE; then
43 mdtcount_opt="--mdtcount $MDSCOUNT"
51 mdsrate_STRIPEPARAMS=${mdsrate_STRIPEPARAMS:-${fs_STRIPEPARAMS:-"-c -1"}}
52 setstripe_getstripe $BASEDIR $mdsrate_STRIPEPARAMS
54 IFree=$(mdsrate_inodes_available)
55 if [ $IFree -lt $NUM_FILES ]; then
59 generate_machine_file $NODES_TO_USE $MACHINEFILE ||
60 error "can not generate machinefile"
62 p="$TMP/$TESTSUITE-$TESTNAME.parameters"
63 save_lustre_params $(get_facets MDS) mdt.*.enable_remote_dir_gid > $p
64 do_nodes $(comma_list $(mdts_nodes)) \
65 $LCTL set_param mdt.*.enable_remote_dir_gid=-1
67 if [ -n "$NOCREATE" ]; then
68 echo "NOCREATE=$NOCREATE => no file creation."
70 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
72 log "===== $0 Test preparation: creating ${NUM_FILES} files."
74 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --dir ${TESTDIR}
75 --nfiles ${NUM_FILES} --filefmt 'f%%d'
76 $mdtcount_opt $debug_opt"
79 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
80 NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
81 if [ $NUM_CLIENTS -gt 50 ]; then
82 NUM_THREADS=$NUM_CLIENTS
85 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_THREADS} \
88 if [ ${PIPESTATUS[0]} != 0 ]; then
89 error_noexit "mdsrate file creation failed, aborting"
90 mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \
91 $TESTDIR 'f%%d' --ignore
96 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD}
97 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
100 if [ -n "$NOSINGLE" ]; then
101 echo "NO Test for stats on a single client."
103 log "===== $0 ### 1 NODE STAT ###"
106 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
109 if [ ${PIPESTATUS[0]} != 0 ]; then
110 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
111 error_noexit "mdsrate stat on single client failed, aborting"
112 restore_lustre_params < $p
113 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
114 $TESTDIR 'f%%d' --ignore
120 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
121 if [ -n "$NOMULTI" ]; then
122 echo "NO test for stats on multiple nodes."
124 log "===== $0 ### ${NUM_CLIENTS} NODES STAT ###"
127 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
128 ${COMMAND} | tee ${LOG}
130 if [ ${PIPESTATUS[0]} != 0 ]; then
131 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
132 error_noexit "mdsrate stat on multiple nodes failed, aborting"
133 restore_lustre_params < $p
134 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
135 $TESTDIR 'f%%d' --ignore
142 restore_lustre_params < $p
143 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
144 rmdir $BASEDIR || true
146 check_and_cleanup_lustre