svn commit: r367022 - in head/sys: geom kern sys

Alexander Motin mav at FreeBSD.org
Sat Oct 24 21:07:12 UTC 2020


Author: mav
Date: Sat Oct 24 21:07:10 2020
New Revision: 367022
URL: https://svnweb.freebsd.org/changeset/base/367022

Log:
  Fix asymmetry in devstat(9) calls by GEOM.
  
  Before this GEOM passed bio pointer to transaction start, but not end.
  It was irrelevant until devstat(9) got DTrace hooks, that appeared to
  provide bio pointer on I/O completion, but not on submission.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sys/geom/geom_io.c
  head/sys/kern/subr_devstat.c
  head/sys/sys/devicestat.h

Modified: head/sys/geom/geom_io.c
==============================================================================
--- head/sys/geom/geom_io.c	Sat Oct 24 21:01:18 2020	(r367021)
+++ head/sys/geom/geom_io.c	Sat Oct 24 21:07:10 2020	(r367022)
@@ -552,9 +552,9 @@ g_io_request(struct bio *bp, struct g_consumer *cp)
 	else
 		getbinuptime(&bp->bio_t0);
 	if (g_collectstats & G_STATS_CONSUMERS)
-		devstat_start_transaction(cp->stat, &bp->bio_t0);
+		devstat_start_transaction_bio_t0(cp->stat, bp);
 	if (g_collectstats & G_STATS_PROVIDERS)
-		devstat_start_transaction(pp->stat, &bp->bio_t0);
+		devstat_start_transaction_bio_t0(pp->stat, bp);
 #ifdef INVARIANTS
 	atomic_add_int(&cp->nstart, 1);
 #endif

Modified: head/sys/kern/subr_devstat.c
==============================================================================
--- head/sys/kern/subr_devstat.c	Sat Oct 24 21:01:18 2020	(r367021)
+++ head/sys/kern/subr_devstat.c	Sat Oct 24 21:07:10 2020	(r367022)
@@ -256,6 +256,17 @@ devstat_start_transaction_bio(struct devstat *ds, stru
 		return;
 
 	binuptime(&bp->bio_t0);
+	devstat_start_transaction_bio_t0(ds, bp);
+}
+
+void
+devstat_start_transaction_bio_t0(struct devstat *ds, struct bio *bp)
+{
+
+	/* sanity check */
+	if (ds == NULL)
+		return;
+
 	devstat_start_transaction(ds, &bp->bio_t0);
 	DTRACE_DEVSTAT_BIO_START();
 }

Modified: head/sys/sys/devicestat.h
==============================================================================
--- head/sys/sys/devicestat.h	Sat Oct 24 21:01:18 2020	(r367021)
+++ head/sys/sys/devicestat.h	Sat Oct 24 21:07:10 2020	(r367022)
@@ -196,6 +196,7 @@ struct devstat *devstat_new_entry(const void *dev_name
 void devstat_remove_entry(struct devstat *ds);
 void devstat_start_transaction(struct devstat *ds, const struct bintime *now);
 void devstat_start_transaction_bio(struct devstat *ds, struct bio *bp);
+void devstat_start_transaction_bio_t0(struct devstat *ds, struct bio *bp);
 void devstat_end_transaction(struct devstat *ds, u_int32_t bytes, 
 			     devstat_tag_type tag_type,
 			     devstat_trans_flags flags,


More information about the svn-src-head mailing list