}
run_test 101b "check stride-io mode 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
do_facet $SINGLEMDS cat /proc/fs/jbd/$dev/info | head -1
}
-do_and_time () {
- local cmd=$1
-
- local start_ts=`date +%s`
-
- $cmd
-
- current_ts=`date +%s`
- ELAPSED=`expr $current_ts - $start_ts`
-}
-
# commit on sharing tests
test_33a() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
avgjbd=0
avgtime=0
for i in 1 2 3; do
-
do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
jbdold=$(print_jbd_stat)
echo "=== START createmany $jbdold"
- do_and_time "do_nodes $CLIENT1,$CLIENT2 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- -r $DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles"
+ local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- -r $DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > /dev/null 2>&1")
jbdnew=$(print_jbd_stat)
jbd=$((`echo $jbdnew | cut -d" " -f1` - `echo $jbdold | cut -d" " -f1`))
- echo "=== END createmany $jbdnew : $jbd transactions nfiles $nfiles time $ELAPSED COS=$COS"
+ echo "=== END createmany $jbdnew : $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
avgjbd=$(( avgjbd + jbd ))
- avgtime=$(( avgtime + ELAPSED ))
+ avgtime=$(( avgtime + elapsed ))
done
eval cos${COS}_jbd=$((avgjbd / 3))
eval cos${COS}_time=$((avgtime / 3))