aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2020-10-24 21:07:10 +0000
committerAlexander Motin <mav@FreeBSD.org>2020-10-24 21:07:10 +0000
commit8b220f8915167866854ff59a106a926e8a84d824 (patch)
tree4f7d5a1889d834aa70a059286a1e94ec85b734cb
parent81a6f4c7ae69d0f3acf564418b3a38153df6f26d (diff)
downloadsrc-8b220f8915167866854ff59a106a926e8a84d824.tar.gz
src-8b220f8915167866854ff59a106a926e8a84d824.zip
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.
Notes
Notes: svn path=/head/; revision=367022
-rw-r--r--sys/geom/geom_io.c4
-rw-r--r--sys/kern/subr_devstat.c11
-rw-r--r--sys/sys/devicestat.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index af0bc40b66ae..12e084e14b86 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -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
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 2bc9c5b89b95..091164a11fcf 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -256,6 +256,17 @@ devstat_start_transaction_bio(struct devstat *ds, struct bio *bp)
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();
}
diff --git a/sys/sys/devicestat.h b/sys/sys/devicestat.h
index e3059ce83a5b..af3f536e8296 100644
--- a/sys/sys/devicestat.h
+++ b/sys/sys/devicestat.h
@@ -196,6 +196,7 @@ struct devstat *devstat_new_entry(const void *dev_name, int unit_number,
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,