- log "Turn on read and write cache"
- set_cache read on
- set_cache writethrough on
-
- log "Write data and read it back."
- log "Read should be satisfied from the cache."
- dd if=/dev/urandom of=$file bs=4k count=$CPAGES || error "dd failed"
- BEFORE=`roc_hit`
- cancel_lru_locks osc
- cat $file >/dev/null
- AFTER=`roc_hit`
- if ! let "AFTER - BEFORE == CPAGES"; then
- error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
- else
- log "cache hits:: before: $BEFORE, after: $AFTER"
- fi
-
- log "Read again; it should be satisfied from the cache."
- BEFORE=$AFTER
- cancel_lru_locks osc
- cat $file >/dev/null
- AFTER=`roc_hit`
- if ! let "AFTER - BEFORE == CPAGES"; then
- error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
- else
- log "cache hits:: before: $BEFORE, after: $AFTER"
- fi