FAKE_NUM_MAX=${FAKE_NUM_MAX:-1000}
[ "$SLOW" = "no" ] && FAKE_NUM_MAX=100
-do_and_time () {
- local cmd=$1
-
- local start_ts=`date +%s`
-
- $cmd
-
- local current_ts=`date +%s`
- ELAPSED=`expr $current_ts - $start_ts`
- echo "===== START $start_ts CURRENT $current_ts"
-}
-
delete_fake_exports () {
NUM=$(do_facet mds "lctl get_param -n mds.${mds_svc}.stale_exports|wc -l")
NUM=$(do_facet mds "lctl get_param -n mds.${mds_svc}.stale_exports|wc -l")
[ $NUM -lt $FAKE_NUM ] && error "fake exports $NUM -ne $FAKE_NUM"
echo "===== STALE EXPORTS: FAKE_NUM=$FAKE_NUM NUM=$NUM"
- do_and_time "zconf_mount_clients $CLIENTS $DIR"
- echo "==== $TESTNAME ===== CONNECTION TIME $ELAPSED: FAKE_NUM=$FAKE_NUM CLIENTCOUNT=$CLIENTCOUNT"
+ local elapsed=$(do_and_time "zconf_mount_clients $CLIENTS $DIR")
+ echo "==== $TESTNAME ===== CONNECTION TIME $elapsed: FAKE_NUM=$FAKE_NUM CLIENTCOUNT=$CLIENTCOUNT"
# do_facet mds "lctl set_param mds.${mds_svc}.flush_stale_exports=1"
delete_fake_exports
EX_NUM=$(do_facet mds "lctl get_param -n mds.${mds_svc}.stale_exports|grep -c EXPIRED")
[ "$EX_NUM" -eq "$NUM" ] || error "not all exports are expired $EX_NUM != $NUM"
- do_and_time "zconf_mount_clients $CLIENTS $DIR"
- echo "==== $TESTNAME===== CONNECTION TIME $ELAPSED: expired FAKE_NUM=$FAKE_NUM CLIENTCOUNT=$CLIENTCOUNT"
+ local elapsed=$(do_and_time "zconf_mount_clients $CLIENTS $DIR")
+ echo "==== $TESTNAME===== CONNECTION TIME $elapsed: expired FAKE_NUM=$FAKE_NUM CLIENTCOUNT=$CLIENTCOUNT"
do_facet mds "lctl set_param mds.${mds_svc}.stale_export_age=$OLD_AGE"
done
}
run_test 101c "check stripe_size aligned read-ahead ================="
+set_read_ahead() {
+ lctl get_param -n llite.*.max_read_ahead_mb | head -n 1
+ lctl set_param -n llite.*.max_read_ahead_mb $1 > /dev/null 2>&1
+}
+
+test_101d() {
+ local file=$DIR/$tfile
+ local size=${FILESIZE_101c:-500}
+ local ra_MB=${READAHEAD_MB:-40}
+
+ local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
+ [ $space -gt $((size / 1024)) ] ||
+ { skip "Need free space ${size}M, have $space" && return; }
+
+ echo Creating ${size}M test file $file
+ dd if=/dev/zero of=$file bs=1M count=$size
+ echo Cancel LRU locks on lustre client to flush the client cache
+ cancel_lru_locks osc
+
+ echo Disable read-ahead
+ local old_READAHEAD=$(set_read_ahead 0)
+
+ echo Reading the test file $file with read-ahead disabled
+ time_ra_OFF=$(do_and_time "dd if=$file of=/dev/null bs=1M count=$size")
+
+ echo Cancel LRU locks on lustre client to flush the client cache
+ cancel_lru_locks osc
+ echo Enable read-ahead with ${ra_MB}MB
+ set_read_ahead $ra_MB
+
+ echo Reading the test file $file with read-ahead enabled
+ time_ra_ON=$(do_and_time "dd if=$file of=/dev/null bs=1M count=$size")
+
+ echo read-ahead disabled time read $time_ra_OFF
+ echo read-ahead enabled time read $time_ra_ON
+
+ set_read_ahead $old_READAHEAD
+ rm -f $file
+
+ [ $time_ra_ON -lt $time_ra_OFF ] ||
+ error "read-ahead enabled time read (${time_ra_ON}s) is more than
+ read-ahead disabled time read (${time_ra_OFF}s) filesize ${size}M"
+}
+run_test 101d "file read with and without read-ahead enabled ================="
+
export SETUP_TEST102=no
setup_test102() {
[ "$SETUP_TEST102" = "yes" ] && return