+test_101i() {
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=10 ||
+ error "dd 10M file failed"
+
+ local max_per_file_mb=$($LCTL get_param -n \
+ llite.*.max_read_ahead_per_file_mb 2>/dev/null)
+ cancel_lru_locks osc
+ stack_trap "$LCTL set_param llite.*.max_read_ahead_per_file_mb=$max_per_file_mb"
+ $LCTL set_param llite.*.max_read_ahead_per_file_mb=1 ||
+ error "set max_read_ahead_per_file_mb to 1 failed"
+
+ echo "Reset readahead stats"
+ $LCTL set_param llite.*.read_ahead_stats=0
+
+ dd if=$DIR/$tfile of=/dev/null bs=2M
+
+ $LCTL get_param llite.*.read_ahead_stats
+ local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+ awk '/misses/ { print $2 }')
+ [ $miss -eq 5 ] || error "expected misses 5 but got $miss"
+ rm -f $DIR/$tfile
+}
+run_test 101i "allow current readahead to exceed reservation"
+
+test_101j() {
+ $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
+ error "setstripe $DIR/$tfile failed"
+ local file_size=$((1048576 * 16))
+ local old_ra=$($LCTL get_param -n llite.*.max_read_ahead_mb | head -n 1)
+ stack_trap "$LCTL set_param -n llite.*.max_read_ahead_mb $old_ra" EXIT
+
+ echo Disable read-ahead
+ $LCTL set_param -n llite.*.max_read_ahead_mb=0
+
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=$(($file_size / 1048576))
+ for blk in $PAGE_SIZE 1048576 $file_size; do
+ cancel_lru_locks osc
+ echo "Reset readahead stats"
+ $LCTL set_param -n llite.*.read_ahead_stats=0
+ local count=$(($file_size / $blk))
+ dd if=$DIR/$tfile bs=$blk count=$count of=/dev/null
+ local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+ get_named_value 'failed to fast read' |
+ cut -d" " -f1 | calc_total)
+ $LCTL get_param -n llite.*.read_ahead_stats
+ [ $miss -eq $count ] || error "expected $count got $miss"
+ done
+
+ rm -f $p $DIR/$tfile
+}
+run_test 101j "A complete read block should be submitted when no RA"
+