summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_devstat.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-04-02 19:08:05 +0000
committerphk <phk@FreeBSD.org>2000-04-02 19:08:05 +0000
commitf37bdf3ad759a1a7c2f5d9e22b035b7d5e4cf986 (patch)
tree96b413b4ed6fdfd5384f273b83cb4aad74e58dd2 /sys/kern/subr_devstat.c
parent6fa0b056f4d7bd22bab81ea7d5cf5ea523c12846 (diff)
downloadFreeBSD-src-f37bdf3ad759a1a7c2f5d9e22b035b7d5e4cf986.zip
FreeBSD-src-f37bdf3ad759a1a7c2f5d9e22b035b7d5e4cf986.tar.gz
Clone bio versions of certain bits of infrastructure:
devstat_end_transaction_bio() bioq_* versions of bufq_* incl bioqdisksort() the corresponding "buf" versions will disappear when no longer used. Move b_offset, b_data and b_bcount to struct bio. Add BIO_FORMAT as a hack for fd.c etc. We are now largely ready to start converting drivers to use struct bio instead of struct buf.
Diffstat (limited to 'sys/kern/subr_devstat.c')
-rw-r--r--sys/kern/subr_devstat.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 81740ed..c86d16b 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -245,6 +245,23 @@ devstat_end_transaction_buf(struct devstat *ds, struct buf *bp)
DEVSTAT_TAG_ORDERED : DEVSTAT_TAG_SIMPLE, flg);
}
+void
+devstat_end_transaction_bio(struct devstat *ds, struct bio *bp)
+{
+ devstat_trans_flags flg;
+
+ if (bp->bio_cmd == BIO_DELETE)
+ flg = DEVSTAT_FREE;
+ else if (bp->bio_cmd == BIO_READ)
+ flg = DEVSTAT_READ;
+ else
+ flg = DEVSTAT_WRITE;
+
+ devstat_end_transaction(ds, bp->bio_bcount - bp->bio_resid,
+ (bp->bio_flags & BIO_ORDERED) ?
+ DEVSTAT_TAG_ORDERED : DEVSTAT_TAG_SIMPLE, flg);
+}
+
/*
* This is the sysctl handler for the devstat package. The data pushed out
* on the kern.devstat.all sysctl variable consists of the current devstat
OpenPOWER on IntegriCloud