View | Details | Raw Unified | Return to bug 198405
Collapse All | Expand All

(-)sbin/geom/class/nop/gnop.8 (-2 / +2 lines)
Lines 70-77 Link Here
70
utility is used for setting up transparent providers on existing ones.
70
utility is used for setting up transparent providers on existing ones.
71
Its main purpose is testing other GEOM classes, as it allows forced provider
71
Its main purpose is testing other GEOM classes, as it allows forced provider
72
removal and I/O error simulation with a given probability.
72
removal and I/O error simulation with a given probability.
73
It also gathers the following statistics: number of read requests, number of
73
It also gathers the following statistics: number of read, write, delete,
74
write requests, number of bytes read and number of bytes written.
74
getattr, flush, and other requests, and number of bytes read and written.
75
In addition, it can be used as a good starting point for implementing new GEOM
75
In addition, it can be used as a good starting point for implementing new GEOM
76
classes.
76
classes.
77
.Pp
77
.Pp
(-)sys/geom/nop/g_nop.c (+36 lines)
Lines 119-124 Link Here
119
		sc->sc_wrotebytes += bp->bio_length;
119
		sc->sc_wrotebytes += bp->bio_length;
120
		failprob = sc->sc_wfailprob;
120
		failprob = sc->sc_wfailprob;
121
		break;
121
		break;
122
	case BIO_DELETE:
123
		sc->sc_deletes++;
124
		break;
125
	case BIO_GETATTR:
126
		sc->sc_getattrs++;
127
		break;
128
	case BIO_FLUSH:
129
		sc->sc_flushes++;
130
		break;
131
	case BIO_CMD0:
132
		sc->sc_cmd0s++;
133
		break;
134
	case BIO_CMD1:
135
		sc->sc_cmd1s++;
136
		break;
137
	case BIO_CMD2:
138
		sc->sc_cmd2s++;
139
		break;
122
	}
140
	}
123
	mtx_unlock(&sc->sc_lock);
141
	mtx_unlock(&sc->sc_lock);
124
	if (failprob > 0) {
142
	if (failprob > 0) {
Lines 224-229 Link Here
224
	sc->sc_wfailprob = wfailprob;
242
	sc->sc_wfailprob = wfailprob;
225
	sc->sc_reads = 0;
243
	sc->sc_reads = 0;
226
	sc->sc_writes = 0;
244
	sc->sc_writes = 0;
245
	sc->sc_deletes = 0;
246
	sc->sc_getattrs = 0;
247
	sc->sc_flushes = 0;
248
	sc->sc_cmd0s = 0;
249
	sc->sc_cmd1s = 0;
250
	sc->sc_cmd2s = 0;
227
	sc->sc_readbytes = 0;
251
	sc->sc_readbytes = 0;
228
	sc->sc_wrotebytes = 0;
252
	sc->sc_wrotebytes = 0;
229
	mtx_init(&sc->sc_lock, "gnop lock", NULL, MTX_DEF);
253
	mtx_init(&sc->sc_lock, "gnop lock", NULL, MTX_DEF);
Lines 566-571 Link Here
566
		sc = pp->geom->softc;
590
		sc = pp->geom->softc;
567
		sc->sc_reads = 0;
591
		sc->sc_reads = 0;
568
		sc->sc_writes = 0;
592
		sc->sc_writes = 0;
593
		sc->sc_deletes = 0;
594
		sc->sc_getattrs = 0;
595
		sc->sc_flushes = 0;
596
		sc->sc_cmd0s = 0;
597
		sc->sc_cmd1s = 0;
598
		sc->sc_cmd2s = 0;
569
		sc->sc_readbytes = 0;
599
		sc->sc_readbytes = 0;
570
		sc->sc_wrotebytes = 0;
600
		sc->sc_wrotebytes = 0;
571
	}
601
	}
Lines 623-628 Link Here
623
	sbuf_printf(sb, "%s<Error>%d</Error>\n", indent, sc->sc_error);
653
	sbuf_printf(sb, "%s<Error>%d</Error>\n", indent, sc->sc_error);
624
	sbuf_printf(sb, "%s<Reads>%ju</Reads>\n", indent, sc->sc_reads);
654
	sbuf_printf(sb, "%s<Reads>%ju</Reads>\n", indent, sc->sc_reads);
625
	sbuf_printf(sb, "%s<Writes>%ju</Writes>\n", indent, sc->sc_writes);
655
	sbuf_printf(sb, "%s<Writes>%ju</Writes>\n", indent, sc->sc_writes);
656
	sbuf_printf(sb, "%s<Deletes>%ju</Deletes>\n", indent, sc->sc_deletes);
657
	sbuf_printf(sb, "%s<Getattrs>%ju</Getattrs>\n", indent, sc->sc_getattrs);
658
	sbuf_printf(sb, "%s<Flushes>%ju</Flushes>\n", indent, sc->sc_flushes);
659
	sbuf_printf(sb, "%s<Cmd0s>%ju</Cmd0s>\n", indent, sc->sc_cmd0s);
660
	sbuf_printf(sb, "%s<Cmd1s>%ju</Cmd1s>\n", indent, sc->sc_cmd1s);
661
	sbuf_printf(sb, "%s<Cmd2s>%ju</Cmd2s>\n", indent, sc->sc_cmd2s);
626
	sbuf_printf(sb, "%s<ReadBytes>%ju</ReadBytes>\n", indent,
662
	sbuf_printf(sb, "%s<ReadBytes>%ju</ReadBytes>\n", indent,
627
	    sc->sc_readbytes);
663
	    sc->sc_readbytes);
628
	sbuf_printf(sb, "%s<WroteBytes>%ju</WroteBytes>\n", indent,
664
	sbuf_printf(sb, "%s<WroteBytes>%ju</WroteBytes>\n", indent,
(-)sys/geom/nop/g_nop.h (+6 lines)
Lines 63-68 Link Here
63
	u_int		sc_wfailprob;
63
	u_int		sc_wfailprob;
64
	uintmax_t	sc_reads;
64
	uintmax_t	sc_reads;
65
	uintmax_t	sc_writes;
65
	uintmax_t	sc_writes;
66
	uintmax_t	sc_deletes;
67
	uintmax_t	sc_getattrs;
68
	uintmax_t	sc_flushes;
69
	uintmax_t	sc_cmd0s;
70
	uintmax_t	sc_cmd1s;
71
	uintmax_t	sc_cmd2s;
66
	uintmax_t	sc_readbytes;
72
	uintmax_t	sc_readbytes;
67
	uintmax_t	sc_wrotebytes;
73
	uintmax_t	sc_wrotebytes;
68
	struct mtx	sc_lock;
74
	struct mtx	sc_lock;

Return to bug 198405