svn commit: r367446 - in stable/12/sys: geom kern sys

Alexander Motin mav at FreeBSD.org
Sat Nov 7 13:16:12 UTC 2020


Author: mav
Date: Sat Nov  7 13:16:11 2020
New Revision: 367446
URL: https://svnweb.freebsd.org/changeset/base/367446

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

Modified:
  stable/12/sys/geom/geom_io.c
  stable/12/sys/kern/subr_devstat.c
  stable/12/sys/sys/devicestat.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/geom/geom_io.c
==============================================================================
--- stable/12/sys/geom/geom_io.c	Sat Nov  7 13:09:51 2020	(r367445)
+++ stable/12/sys/geom/geom_io.c	Sat Nov  7 13:16:11 2020	(r367446)
@@ -616,9 +616,9 @@ g_io_request(struct bio *bp, struct g_consumer *cp)
 	mtxp = mtx_pool_find(mtxpool_sleep, pp);
 	mtx_lock(mtxp);
 	if (g_collectstats & G_STATS_PROVIDERS)
-		devstat_start_transaction(pp->stat, &bp->bio_t0);
+		devstat_start_transaction_bio_t0(pp->stat, bp);
 	if (g_collectstats & G_STATS_CONSUMERS)
-		devstat_start_transaction(cp->stat, &bp->bio_t0);
+		devstat_start_transaction_bio_t0(cp->stat, bp);
 	pp->nstart++;
 	cp->nstart++;
 	mtx_unlock(mtxp);

Modified: stable/12/sys/kern/subr_devstat.c
==============================================================================
--- stable/12/sys/kern/subr_devstat.c	Sat Nov  7 13:09:51 2020	(r367445)
+++ stable/12/sys/kern/subr_devstat.c	Sat Nov  7 13:16:11 2020	(r367446)
@@ -261,6 +261,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: stable/12/sys/sys/devicestat.h
==============================================================================
--- stable/12/sys/sys/devicestat.h	Sat Nov  7 13:09:51 2020	(r367445)
+++ stable/12/sys/sys/devicestat.h	Sat Nov  7 13:16:11 2020	(r367446)
@@ -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-all mailing list