svn commit: r356315 - head/sys/dev/md

Alexander Motin mav at FreeBSD.org
Fri Jan 3 04:37:48 UTC 2020


Author: mav
Date: Fri Jan  3 04:37:47 2020
New Revision: 356315
URL: https://svnweb.freebsd.org/changeset/base/356315

Log:
  Avoid duplicate I/O statistics accounting.
  
  Alike to geom_disk free the provider statistics structure and point GEOM
  toward local statistics.  It allows to save some CPU time.
  
  MFC after:	2 weeks

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

Modified: head/sys/dev/md/md.c
==============================================================================
--- head/sys/dev/md/md.c	Fri Jan  3 01:21:15 2020	(r356314)
+++ head/sys/dev/md/md.c	Fri Jan  3 04:37:47 2020	(r356315)
@@ -1295,6 +1295,8 @@ mdinit(struct md_s *sc)
 	gp = g_new_geomf(&g_md_class, "md%d", sc->unit);
 	gp->softc = sc;
 	pp = g_new_providerf(gp, "md%d", sc->unit);
+	devstat_remove_entry(pp->stat);
+	pp->stat = NULL;
 	pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
 	pp->mediasize = sc->mediasize;
 	pp->sectorsize = sc->sectorsize;
@@ -1310,10 +1312,11 @@ mdinit(struct md_s *sc)
 	}
 	sc->gp = gp;
 	sc->pp = pp;
-	g_error_provider(pp, 0);
-	g_topology_unlock();
 	sc->devstat = devstat_new_entry("md", sc->unit, sc->sectorsize,
 	    DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
+	sc->devstat->id = pp;
+	g_error_provider(pp, 0);
+	g_topology_unlock();
 }
 
 static int


More information about the svn-src-head mailing list