summaryrefslogtreecommitdiffstats
path: root/sys/geom/nop
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2016-01-12 09:27:01 +0000
committertrasz <trasz@FreeBSD.org>2016-01-12 09:27:01 +0000
commit2d6e438962defed89637a9fe01b045d3619185d0 (patch)
treebd741726dd9ffcca5650cb643938ac43d712cf6a /sys/geom/nop
parentea425694b7eacf9536f4043d5c11183137a757fc (diff)
downloadFreeBSD-src-2d6e438962defed89637a9fe01b045d3619185d0.zip
FreeBSD-src-2d6e438962defed89637a9fe01b045d3619185d0.tar.gz
MFC r289110:
Make geom_nop(4) collect statistics on all types of BIOs, not just reads and writes. PR: kern/198405 Submitted by: Matthew D. Fuller <fullermd at over-yonder dot net> Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3679
Diffstat (limited to 'sys/geom/nop')
-rw-r--r--sys/geom/nop/g_nop.c36
-rw-r--r--sys/geom/nop/g_nop.h6
2 files changed, 42 insertions, 0 deletions
diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
index 837f3f4..f36472d 100644
--- a/sys/geom/nop/g_nop.c
+++ b/sys/geom/nop/g_nop.c
@@ -119,6 +119,24 @@ g_nop_start(struct bio *bp)
sc->sc_wrotebytes += bp->bio_length;
failprob = sc->sc_wfailprob;
break;
+ case BIO_DELETE:
+ sc->sc_deletes++;
+ break;
+ case BIO_GETATTR:
+ sc->sc_getattrs++;
+ break;
+ case BIO_FLUSH:
+ sc->sc_flushes++;
+ break;
+ case BIO_CMD0:
+ sc->sc_cmd0s++;
+ break;
+ case BIO_CMD1:
+ sc->sc_cmd1s++;
+ break;
+ case BIO_CMD2:
+ sc->sc_cmd2s++;
+ break;
}
mtx_unlock(&sc->sc_lock);
if (failprob > 0) {
@@ -238,6 +256,12 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
sc->sc_wfailprob = wfailprob;
sc->sc_reads = 0;
sc->sc_writes = 0;
+ sc->sc_deletes = 0;
+ sc->sc_getattrs = 0;
+ sc->sc_flushes = 0;
+ sc->sc_cmd0s = 0;
+ sc->sc_cmd1s = 0;
+ sc->sc_cmd2s = 0;
sc->sc_readbytes = 0;
sc->sc_wrotebytes = 0;
mtx_init(&sc->sc_lock, "gnop lock", NULL, MTX_DEF);
@@ -602,6 +626,12 @@ g_nop_ctl_reset(struct gctl_req *req, struct g_class *mp)
sc = pp->geom->softc;
sc->sc_reads = 0;
sc->sc_writes = 0;
+ sc->sc_deletes = 0;
+ sc->sc_getattrs = 0;
+ sc->sc_flushes = 0;
+ sc->sc_cmd0s = 0;
+ sc->sc_cmd1s = 0;
+ sc->sc_cmd2s = 0;
sc->sc_readbytes = 0;
sc->sc_wrotebytes = 0;
}
@@ -659,6 +689,12 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
sbuf_printf(sb, "%s<Error>%d</Error>\n", indent, sc->sc_error);
sbuf_printf(sb, "%s<Reads>%ju</Reads>\n", indent, sc->sc_reads);
sbuf_printf(sb, "%s<Writes>%ju</Writes>\n", indent, sc->sc_writes);
+ sbuf_printf(sb, "%s<Deletes>%ju</Deletes>\n", indent, sc->sc_deletes);
+ sbuf_printf(sb, "%s<Getattrs>%ju</Getattrs>\n", indent, sc->sc_getattrs);
+ sbuf_printf(sb, "%s<Flushes>%ju</Flushes>\n", indent, sc->sc_flushes);
+ sbuf_printf(sb, "%s<Cmd0s>%ju</Cmd0s>\n", indent, sc->sc_cmd0s);
+ sbuf_printf(sb, "%s<Cmd1s>%ju</Cmd1s>\n", indent, sc->sc_cmd1s);
+ sbuf_printf(sb, "%s<Cmd2s>%ju</Cmd2s>\n", indent, sc->sc_cmd2s);
sbuf_printf(sb, "%s<ReadBytes>%ju</ReadBytes>\n", indent,
sc->sc_readbytes);
sbuf_printf(sb, "%s<WroteBytes>%ju</WroteBytes>\n", indent,
diff --git a/sys/geom/nop/g_nop.h b/sys/geom/nop/g_nop.h
index b5e954a..beba43e 100644
--- a/sys/geom/nop/g_nop.h
+++ b/sys/geom/nop/g_nop.h
@@ -65,6 +65,12 @@ struct g_nop_softc {
u_int sc_wfailprob;
uintmax_t sc_reads;
uintmax_t sc_writes;
+ uintmax_t sc_deletes;
+ uintmax_t sc_getattrs;
+ uintmax_t sc_flushes;
+ uintmax_t sc_cmd0s;
+ uintmax_t sc_cmd1s;
+ uintmax_t sc_cmd2s;
uintmax_t sc_readbytes;
uintmax_t sc_wrotebytes;
struct mtx sc_lock;
OpenPOWER on IntegriCloud