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.
This commit is contained in:
Alexander Motin 2020-10-24 21:07:10 +00:00
parent 81a6f4c7ae
commit 8b220f8915
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367022
3 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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();
}

View file

@ -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,