From e8f2dea5ddc06968c8deacd684154cd56b9664ff Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 7 Feb 2003 23:08:24 +0000 Subject: Commit the correct copy of the g_stat structure. Add debug.sizeof.g_stat sysctl. Set the id field of the g_stat when we create consumers and providers. Remove biocount from consumer, we will use the counters in the g_stat structure instead. Replace one field which will need to be atomically manipulated with two fields which will not (stat.nop and stat.nend). Change add companion field to bio_children: bio_inbed for the exact same reason. Don't output the biocount in the confdot output. Fix KASSERT in g_io_request(). Add sysctl kern.geom.collectstats defaulting to off. Collect the following raw statistics conditioned on this sysctl: for each consumer and provider { total number of operations started. total number of operations completed. time last operation completed. sum of idle-time. for each of BIO_READ, BIO_WRITE and BIO_DELETE { number of operations completed. number of bytes completed. number of ENOMEM errors. number of other errors. sum of transaction time. } } API for getting hold of these statistics data not included yet. --- sys/geom/geom_subr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/geom/geom_subr.c') diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 0d28978..d8b3054 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -145,6 +145,7 @@ g_new_consumer(struct g_geom *gp) cp = g_malloc(sizeof *cp, M_ZERO); cp->protect = 0x020016602; cp->geom = gp; + cp->stat.id = cp; LIST_INSERT_HEAD(&gp->consumer, cp, consumer); return(cp); } @@ -184,6 +185,7 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...) LIST_INIT(&pp->consumers); pp->error = ENXIO; pp->geom = gp; + pp->stat.id = pp; LIST_INSERT_HEAD(&gp->provider, pp, provider); g_nproviders++; g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); @@ -327,7 +329,7 @@ g_detach(struct g_consumer *cp) KASSERT(cp->acr == 0, ("detach but nonzero acr")); KASSERT(cp->acw == 0, ("detach but nonzero acw")); KASSERT(cp->ace == 0, ("detach but nonzero ace")); - KASSERT(cp->biocount == 0, ("detach but nonzero biocount")); + KASSERT(cp->stat.nop == cp->stat.nend, ("detach with active requests")); pp = cp->provider; LIST_REMOVE(cp, consumers); cp->provider = NULL; @@ -499,8 +501,8 @@ g_std_done(struct bio *bp) bp2->bio_error = bp->bio_error; bp2->bio_completed += bp->bio_completed; g_destroy_bio(bp); - bp2->bio_children--; /* XXX: atomic ? */ - if (bp2->bio_children == 0) + bp2->bio_inbed++; + if (bp2->bio_children == bp2->bio_inbed) g_io_deliver(bp2, bp2->bio_error); } -- cgit v1.1