diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-09-18 21:28:09 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-09-18 21:28:09 +0000 |
| commit | f80d57eec0c44d92ce20be03c37ba0eb6e9696a8 (patch) | |
| tree | d35a00bab441398eeef69f14ca6eb7d3e15acd15 /sys/kern/subr_devstat.c | |
| parent | d93b26d657b1c3ba43c13e9b12966cee320d6e5c (diff) | |
Notes
Diffstat (limited to 'sys/kern/subr_devstat.c')
| -rw-r--r-- | sys/kern/subr_devstat.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 448b869c47c7..699ec3e95baa 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 |
