Author: bde
Date: Sun Dec  9 15:34:20 2018
New Revision: 341765
URL: https://svnweb.freebsd.org/changeset/base/341765

Log:
  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

Modified:
  head/sys/dev/md/md.c

Modified: head/sys/dev/md/md.c
==============================================================================
--- head/sys/dev/md/md.c        Sun Dec  9 11:39:45 2018        (r341764)
+++ head/sys/dev/md/md.c        Sun Dec  9 15:34:20 2018        (r341765)
@@ -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);
        }
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to