Fix devstat on md devices.

devstat_end_transaction() was called before the i/o was actually ended
(by delivering it to GEOM), so at least the i/o length was messed up.
It was always recorded as 0, so the average transaction size and the
average transfer rate was always displayed as 0.

devstat_end_transaction() was not called at all for the error case, so
there were sometimes multiple starts per end.  I didn't observe this in
practice and don't know if it did much damage.  I think it extended the
length of the i/o to the next transaction.

Reviewed by:	kib
This commit is contained in:
Bruce Evans 2018-12-09 15:34:20 +00:00
parent 25b4f9ad69
commit dac6a0d559

View file

@ -1241,10 +1241,10 @@ md_kthread(void *arg)
if (error != -1) {
bp->bio_completed = bp->bio_length;
if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE))
devstat_end_transaction_bio(sc->devstat, bp);
g_io_deliver(bp, error);
}
if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE)
devstat_end_transaction_bio(sc->devstat, bp);
}
}