summaryrefslogtreecommitdiffstats
path: root/sys/dev/md
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2007-11-07 22:47:41 +0000
committersobomax <sobomax@FreeBSD.org>2007-11-07 22:47:41 +0000
commite70726e1e87e820c72e5e459e9aeca98a1b25ace (patch)
tree5074d22344a0a15c76ffca6303ca796fa353944d /sys/dev/md
parentf372a74b85982996f2d12eeef0b1fe3cf17af7d5 (diff)
downloadFreeBSD-src-e70726e1e87e820c72e5e459e9aeca98a1b25ace.zip
FreeBSD-src-e70726e1e87e820c72e5e459e9aeca98a1b25ace.tar.gz
Put back devstat support that was lost during GEOM transition. Initially,
I've tried to move md(4) to use geom_disk class, like real disks do, but this requires major rework of some of the existing features such as configuration dumping for example. Therefore just putting devstat support directly into md(4) seems to be optimal solution. Now you can see md(4) stats in `systat -vm' again. MFC after: 2 weeks
Diffstat (limited to 'sys/dev/md')
-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 2d63fed..b5cc37c 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);
OpenPOWER on IntegriCloud