aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2007-11-07 22:47:41 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2007-11-07 22:47:41 +0000
commita03be42da68432a094b14d1c6d7894d1affe06f6 (patch)
tree5074d22344a0a15c76ffca6303ca796fa353944d /sys/dev
parent8ce2d00a044cef91b79cbc72ec106f79186bf34a (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/md/md.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 2d63fed9394af..b5cc37cd247d3 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -60,6 +60,7 @@
#include <sys/systm.h>
#include <sys/bio.h>
#include <sys/conf.h>
+#include <sys/devicestat.h>
#include <sys/fcntl.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
@@ -181,6 +182,7 @@ struct md_s {
struct g_geom *gp;
struct g_provider *pp;
int (*start)(struct md_s *sc, struct bio *bp);
+ struct devstat *devstat;
/* MD_MALLOC related fields */
struct indir *indir;
@@ -392,6 +394,8 @@ g_md_start(struct bio *bp)
struct md_s *sc;
sc = bp->bio_to->geom->softc;
+ if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE))
+ devstat_start_transaction_bio(sc->devstat, bp);
mtx_lock(&sc->queue_mtx);
bioq_disksort(&sc->bio_queue, bp);
mtx_unlock(&sc->queue_mtx);
@@ -725,6 +729,8 @@ md_kthread(void *arg)
if (error != -1) {
bp->bio_completed = bp->bio_length;
g_io_deliver(bp, error);
+ if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE))
+ devstat_end_transaction_bio(sc->devstat, bp);
}
}
}
@@ -792,6 +798,8 @@ mdinit(struct md_s *sc)
sc->pp = pp;
g_error_provider(pp, 0);
g_topology_unlock();
+ sc->devstat = devstat_new_entry("md", sc->unit, sc->sectorsize,
+ DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
}
/*
@@ -963,6 +971,10 @@ mddestroy(struct md_s *sc, struct thread *td)
sc->gp = NULL;
sc->pp = NULL;
}
+ if (sc->devstat) {
+ devstat_remove_entry(sc->devstat);
+ sc->devstat = NULL;
+ }
mtx_lock(&sc->queue_mtx);
sc->flags |= MD_SHUTDOWN;
wakeup(sc);