From: grev Date: Fri, 22 May 2009 21:38:56 +0000 (+0000) Subject: b=19414 X-Git-Tag: v1_8_0_120~2 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=812544cbc263dba9ac13ca14d2f7fa8cd9f00432;p=fs%2Flustre-release.git b=19414 i=Brian cmd3-33 port to acc-sm: read-ahead test --- diff --git a/lustre/tests/large-scale.sh b/lustre/tests/large-scale.sh index 43b27a2..d647684 100644 --- a/lustre/tests/large-scale.sh +++ b/lustre/tests/large-scale.sh @@ -44,18 +44,6 @@ check_vbr || \ 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") @@ -87,8 +75,8 @@ test_1b() { 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 @@ -174,8 +162,8 @@ test_1d() { 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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 5c00a02..bd6b01c 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3865,6 +3865,51 @@ test_101c() { } 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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index b7adaee..99b89e5 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -2297,6 +2297,19 @@ multiop_bg_pause() { return 0 } +do_and_time () { + local cmd=$1 + local rc + + SECONDS=0 + eval '$cmd' + + [ ${PIPESTATUS[0]} -eq 0 ] || rc=1 + + echo $SECONDS + return $rc +} + inodes_available () { local IFree=$($LFS df -i $MOUNT | grep ^$FSNAME | awk '{print $4}' | sort -un | head -1) || return 1 echo $IFree