GOTO(out, result);
out:
cl_io_fini(env, io);
- if (iot == CIT_WRITE)
- lli->lli_write_rc = result < 0 ? : 0;
+
+ if (iot == CIT_READ) {
+ if (result >= 0)
+ ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode),
+ LPROC_LL_READ_BYTES, result);
+ } else if (iot == CIT_WRITE) {
+ if (result >= 0) {
+ ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode),
+ LPROC_LL_WRITE_BYTES, result);
+ lli->lli_write_rc = 0;
+ } else {
+ lli->lli_write_rc = result;
+ }
+ }
+
return result;
}
vio->cui_ra_window_set = 0;
result = 0;
if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE) {
- int op;
size_t count;
count = io->u.ci_rw.crw_count;
- op = io->ci_type == CIT_READ ?
- LPROC_LL_READ_BYTES : LPROC_LL_WRITE_BYTES;
/* "If nbyte is 0, read() will return 0 and have no other
* results." -- Single Unix Spec */
if (count == 0)
else {
cio->cui_tot_count = count;
cio->cui_tot_nrsegs = 0;
- ll_stats_ops_tally(sbi, op, count);
}
} else if (io->ci_type == CIT_SETATTR) {
if (cl_io_is_trunc(io))
}
run_test 126 "check that the fsgid provided by the client is taken into account"
-test_127() { # bug 15521
+test_127a() { # bug 15521
$SETSTRIPE -i 0 -c 1 $DIR/$tfile || error "setstripe failed"
$LCTL set_param osc.*.stats=0
FSIZE=$((2048 * 1024))
[ "$read_bytes" != 0 ] || error "no read done"
[ "$write_bytes" != 0 ] || error "no write done"
}
-run_test 127 "verify the client stats are sane"
+run_test 127a "verify the client stats are sane"
+
+test_127b() { # bug LU-333
+ $LCTL set_param llite.*.stats=0
+ FSIZE=65536 # sized fixed to match PAGE_SIZE for most clients
+ # perform 2 reads and writes so MAX is different from SUM.
+ dd if=/dev/zero of=$DIR/$tfile bs=$FSIZE count=1
+ dd if=/dev/zero of=$DIR/$tfile bs=$FSIZE count=1
+ cancel_lru_locks osc
+ dd if=$DIR/$tfile of=/dev/null bs=$FSIZE count=1
+ dd if=$DIR/$tfile of=/dev/null bs=$FSIZE count=1
+
+ $LCTL get_param llite.*.stats | grep samples > $TMP/${tfile}.tmp
+ while read NAME COUNT SAMP UNIT MIN MAX SUM SUMSQ; do
+ echo "got $COUNT $NAME"
+ eval $NAME=$COUNT || error "Wrong proc format"
+
+ case $NAME in
+ read_bytes)
+ [ $COUNT -ne 2 ] && error "count is not 2: $COUNT"
+ [ $MIN -ne $FSIZE ] && error "min is not $FSIZE: $MIN"
+ [ $MAX -ne $FSIZE ] && error "max is incorrect: $MAX"
+ [ $SUM -ne $((FSIZE * 2)) ] && error "sum is wrong: $SUM"
+ ;;
+ write_bytes)
+ [ $COUNT -ne 2 ] && error "count is not 2: $COUNT"
+ [ $MIN -ne $FSIZE ] && error "min is not $FSIZE: $MIN"
+ [ $MAX -ne $FSIZE ] && error "max is incorrect: $MAX"
+ [ $SUM -ne $((FSIZE * 2)) ] && error "sum is wrong: $SUM"
+ ;;
+ *) ;;
+ esac
+ done < $TMP/${tfile}.tmp
+
+ #check that we actually got some stats
+ [ "$read_bytes" ] || error "Missing read_bytes stats"
+ [ "$write_bytes" ] || error "Missing write_bytes stats"
+ [ "$read_bytes" != 0 ] || error "no read done"
+ [ "$write_bytes" != 0 ] || error "no write done"
+}
+run_test 127b "verify the llite client stats are sane"
test_128() { # bug 15212
touch $DIR/$tfile