summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_devstat.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-09-18 21:28:09 +0000
committerphk <phk@FreeBSD.org>1999-09-18 21:28:09 +0000
commit924236547e11eeafee3db1e24987bb763df57937 (patch)
tree4c738e149f9af9c8a45a83d0705a1d933c3bd46f /sys/kern/subr_devstat.c
parent240736f7b919c5b42784ffed6fc7ce29c600a18f (diff)
downloadFreeBSD-src-924236547e11eeafee3db1e24987bb763df57937.zip
FreeBSD-src-924236547e11eeafee3db1e24987bb763df57937.tar.gz
Count "free" operations in their own new tranaction type.
WARNING: libdevstat, iostat, vmstat, systat etc etc will need a recompile. Add devstat_end_transaction_buf() which pulls all the vital data out of a struct buf which is ready for biodone().
Diffstat (limited to 'sys/kern/subr_devstat.c')
-rw-r--r--sys/kern/subr_devstat.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 448b869..699ec3e 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -33,6 +33,7 @@
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <sys/buf.h>
#include <sys/sysctl.h>
#include <sys/devicestat.h>
@@ -212,13 +213,17 @@ devstat_end_transaction(struct devstat *ds, u_int32_t bytes,
} else if (flags == DEVSTAT_WRITE) {
ds->bytes_written += bytes;
ds->num_writes++;
+ } else if (flags == DEVSTAT_FREE) {
+ ds->bytes_freed += bytes;
+ ds->num_frees++;
} else
ds->num_other++;
/*
* Keep a count of the various tag types sent.
*/
- if (tag_type != DEVSTAT_TAG_NONE)
+ if ((ds->flags & DEVSTAT_NO_ORDERED_TAGS == 0) &&
+ tag_type != DEVSTAT_TAG_NONE)
ds->tag_types[tag_type]++;
/*
@@ -238,6 +243,25 @@ devstat_end_transaction(struct devstat *ds, u_int32_t bytes,
ds->unit_number, ds->busy_count);
}
+void
+devstat_end_transaction_buf(struct devstat *ds, struct buf *bp)
+{
+ devstat_trans_flags flg;
+
+ if (bp->b_flags & B_FREEBUF)
+ flg = DEVSTAT_FREE;
+ else if (bp->b_flags & B_READ)
+ flg = DEVSTAT_READ;
+ else
+ flg = DEVSTAT_WRITE;
+
+ devstat_end_transaction(ds,
+ bp->b_bcount - bp->b_resid,
+ (bp->b_flags & B_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