Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Dec 2018 15:34:20 +0000 (UTC)
From:      Bruce Evans <bde@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341765 - head/sys/dev/md
Message-ID:  <201812091534.wB9FYKqb039555@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812091534.wB9FYKqb039555>