/* at least to extend the readahead window to cover current read */
if (!hit && vio->vui_ra_valid &&
- vio->vui_ra_start + vio->vui_ra_count > ria->ria_start) {
- unsigned long remainder;
-
- /* to the end of current read window. */
- mlen = vio->vui_ra_start + vio->vui_ra_count - ria->ria_start;
- /* trim to RPC boundary */
- ras_align(ras, ria->ria_start, &remainder);
- mlen = min(mlen, ras->ras_rpc_size - remainder);
- ria->ria_end_min = ria->ria_start + mlen;
- }
+ vio->vui_ra_start + vio->vui_ra_count > ria->ria_start)
+ ria->ria_end_min = vio->vui_ra_start + vio->vui_ra_count - 1;
ria->ria_reserved = ll_ra_count_get(ll_i2sbi(inode), ria, len, mlen);
if (ria->ria_reserved < len)
}
run_test 101g "Big bulk(4/16 MiB) readahead"
+test_101h() {
+ $LFS setstripe -i 0 -c 1 $DIR/$tfile
+
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=70 ||
+ error "dd 70M file failed"
+ echo Cancel LRU locks on lustre client to flush the client cache
+ cancel_lru_locks osc
+
+ echo "Reset readahead stats"
+ $LCTL set_param -n llite.*.read_ahead_stats 0
+
+ echo "Read 10M of data but cross 64M bundary"
+ dd if=$DIR/$tfile of=/dev/null bs=10M skip=6 count=1
+ local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+ get_named_value 'misses' | cut -d" " -f1 | calc_total)
+ [ $miss -eq 1 ] || error "expected miss 1 but got $miss"
+ rm -f $p $DIR/$tfile
+}
+run_test 101h "Readahead should cover current read window"
+
setup_test102() {
test_mkdir $DIR/$tdir
chown $RUNAS_ID $DIR/$tdir