Re: svn commit: r352312 - in head: lib/geom/nop sys/geom/nop

2019-11-09 Thread Mariusz Zaborski
Hello Chuck :)

I wonder if we shouldn't change this option a bit.
Shouldn't we have an option which says more like:

```
Specifies the number of I/O requests to allow before
setting the read and write failure rate.
```

In some cases, I don't want to have 100% of failure probabilities,
but on the early stage, I would like to allow some read/writes requests.
If the options would only specify the amount of the requests not
the failure probabilities could be used in other cases?

Those that make sens?
Mariusz

On Thu, 3 Oct 2019 at 00:08, Chuck Silvers  wrote:
>
> On Wed, Oct 02, 2019 at 08:11:57AM -0600, Alan Somers wrote:
> > On Fri, Sep 13, 2019 at 5:04 PM Chuck Silvers  wrote:
> >
> > > Author: chs
> > > Date: Fri Sep 13 23:03:56 2019
> > > New Revision: 352312
> > > URL: https://svnweb.freebsd.org/changeset/base/352312
> > >
> > > Log:
> > >   Add a "count_until_fail" option to gnop, which says to start failing
> > >   I/O requests after the given number have been allowed though.
> > >
> > >   Approved by:imp (mentor)
> > >   Reviewed by:rpokala kib 0mp mckusick
> > >   Sponsored by:   Netflix
> > >   Differential Revision:  https://reviews.freebsd.org/D21593
> > >
> > > Modified:
> > >   head/lib/geom/nop/geom_nop.c
> > >   head/lib/geom/nop/gnop.8
> > >   head/sys/geom/nop/g_nop.c
> > >   head/sys/geom/nop/g_nop.h
> > >
> >
> > This patch introduces a backwards-compatibility bug.  On a system with a
> > post-352312 kernel but a pre-352312 userland, the gnop command will always
> > fail with the error "gnop: Missing count_until_fail argument".
> > -Alan
>
> Thanks for pointing this out, I'll see about fixing it right away.
>
> -Chuck
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r352312 - in head: lib/geom/nop sys/geom/nop

2019-10-02 Thread Chuck Silvers
On Wed, Oct 02, 2019 at 08:11:57AM -0600, Alan Somers wrote:
> On Fri, Sep 13, 2019 at 5:04 PM Chuck Silvers  wrote:
> 
> > Author: chs
> > Date: Fri Sep 13 23:03:56 2019
> > New Revision: 352312
> > URL: https://svnweb.freebsd.org/changeset/base/352312
> >
> > Log:
> >   Add a "count_until_fail" option to gnop, which says to start failing
> >   I/O requests after the given number have been allowed though.
> >
> >   Approved by:imp (mentor)
> >   Reviewed by:rpokala kib 0mp mckusick
> >   Sponsored by:   Netflix
> >   Differential Revision:  https://reviews.freebsd.org/D21593
> >
> > Modified:
> >   head/lib/geom/nop/geom_nop.c
> >   head/lib/geom/nop/gnop.8
> >   head/sys/geom/nop/g_nop.c
> >   head/sys/geom/nop/g_nop.h
> >
> 
> This patch introduces a backwards-compatibility bug.  On a system with a
> post-352312 kernel but a pre-352312 userland, the gnop command will always
> fail with the error "gnop: Missing count_until_fail argument".
> -Alan

Thanks for pointing this out, I'll see about fixing it right away.

-Chuck
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r352312 - in head: lib/geom/nop sys/geom/nop

2019-10-02 Thread Alan Somers
On Fri, Sep 13, 2019 at 5:04 PM Chuck Silvers  wrote:

> Author: chs
> Date: Fri Sep 13 23:03:56 2019
> New Revision: 352312
> URL: https://svnweb.freebsd.org/changeset/base/352312
>
> Log:
>   Add a "count_until_fail" option to gnop, which says to start failing
>   I/O requests after the given number have been allowed though.
>
>   Approved by:imp (mentor)
>   Reviewed by:rpokala kib 0mp mckusick
>   Sponsored by:   Netflix
>   Differential Revision:  https://reviews.freebsd.org/D21593
>
> Modified:
>   head/lib/geom/nop/geom_nop.c
>   head/lib/geom/nop/gnop.8
>   head/sys/geom/nop/g_nop.c
>   head/sys/geom/nop/g_nop.h
>

This patch introduces a backwards-compatibility bug.  On a system with a
post-352312 kernel but a pre-352312 userland, the gnop command will always
fail with the error "gnop: Missing count_until_fail argument".
-Alan
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r352312 - in head: lib/geom/nop sys/geom/nop

2019-09-13 Thread Chuck Silvers
Author: chs
Date: Fri Sep 13 23:03:56 2019
New Revision: 352312
URL: https://svnweb.freebsd.org/changeset/base/352312

Log:
  Add a "count_until_fail" option to gnop, which says to start failing
  I/O requests after the given number have been allowed though.
  
  Approved by:imp (mentor)
  Reviewed by:rpokala kib 0mp mckusick
  Sponsored by:   Netflix
  Differential Revision:  https://reviews.freebsd.org/D21593

Modified:
  head/lib/geom/nop/geom_nop.c
  head/lib/geom/nop/gnop.8
  head/sys/geom/nop/g_nop.c
  head/sys/geom/nop/g_nop.h

Modified: head/lib/geom/nop/geom_nop.c
==
--- head/lib/geom/nop/geom_nop.cFri Sep 13 22:36:04 2019
(r352311)
+++ head/lib/geom/nop/geom_nop.cFri Sep 13 23:03:56 2019
(r352312)
@@ -43,6 +43,7 @@ uint32_t version = G_NOP_VERSION;
 struct g_command class_commands[] = {
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
{
+   { 'c', "count_until_fail", "-1", G_TYPE_NUMBER },
{ 'd', "delaymsec", "-1", G_TYPE_NUMBER },
{ 'e', "error", "-1", G_TYPE_NUMBER },
{ 'o', "offset", "0", G_TYPE_NUMBER },
@@ -57,12 +58,14 @@ struct g_command class_commands[] = {
{ 'z', "physpath", G_NOP_PHYSPATH_PASSTHROUGH, G_TYPE_STRING },
G_OPT_SENTINEL
},
-   "[-v] [-d delaymsec] [-e error] [-o offset] [-p stripesize] "
-   "[-P stripeoffset] [-q rdelayprob] [-r rfailprob] [-s size] "
-   "[-S secsize] [-w wfailprob] [-x wdelayprob] [-z physpath] dev ..."
+   "[-v] [-c count_until_fail] [-d delaymsec] [-e error] [-o offset] "
+   "[-p stripesize] [-P stripeoffset] [-q rdelayprob] [-r rfailprob] "
+   "[-s size]  [-S secsize] [-w wfailprob] [-x wdelayprob] "
+   "[-z physpath] dev ..."
},
{ "configure", G_FLAG_VERBOSE, NULL,
{
+   { 'c', "count_until_fail", "-1", G_TYPE_NUMBER },
{ 'd', "delaymsec", "-1", G_TYPE_NUMBER },
{ 'e', "error", "-1", G_TYPE_NUMBER },
{ 'q', "rdelayprob", "-1", G_TYPE_NUMBER },
@@ -71,8 +74,9 @@ struct g_command class_commands[] = {
{ 'x', "wdelayprob", "-1", G_TYPE_NUMBER },
G_OPT_SENTINEL
},
-   "[-v] [-d delaymsec] [-e error] [-q rdelayprob] [-r rfailprob] "
-   "[-w wfailprob] [-x wdelayprob] prov ..."
+   "[-v] [-c count_until_fail] [-d delaymsec] [-e error] "
+   "[-q rdelayprob] [-r rfailprob] [-w wfailprob] [-x wdelayprob] "
+   "prov ..."
},
{ "destroy", G_FLAG_VERBOSE, NULL,
{

Modified: head/lib/geom/nop/gnop.8
==
--- head/lib/geom/nop/gnop.8Fri Sep 13 22:36:04 2019(r352311)
+++ head/lib/geom/nop/gnop.8Fri Sep 13 23:03:56 2019(r352312)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 31, 2019
+.Dd September 13, 2019
 .Dt GNOP 8
 .Os
 .Sh NAME
@@ -34,6 +34,7 @@
 .Nm
 .Cm create
 .Op Fl v
+.Op Fl c Ar count_until_fail
 .Op Fl d Ar delaymsec
 .Op Fl e Ar error
 .Op Fl o Ar offset
@@ -50,6 +51,7 @@
 .Nm
 .Cm configure
 .Op Fl v
+.Op Fl c Ar count_until_fail
 .Op Fl d Ar delaymsec
 .Op Fl e Ar error
 .Op Fl q Ar rdelayprob
@@ -118,7 +120,10 @@ See
 .El
 .Pp
 Additional options:
-.Bl -tag -width ".Fl r Ar rfailprob"
+.Bl -tag -width "-c count_until_fail"
+.It Fl c Ar count_until_fail
+Specifies the number of I/O requests to allow before setting the read and write
+failure probabilities to 100%.
 .It Fl d Ar delaymsec
 Specifies the delay of the requests in milliseconds.
 Note that requests will be delayed before they are sent to the backing device.

Modified: head/sys/geom/nop/g_nop.c
==
--- head/sys/geom/nop/g_nop.c   Fri Sep 13 22:36:04 2019(r352311)
+++ head/sys/geom/nop/g_nop.c   Fri Sep 13 23:03:56 2019(r352312)
@@ -195,6 +195,10 @@ g_nop_start(struct bio *bp)
 
G_NOP_LOGREQ(bp, "Request received.");
mtx_lock(&sc->sc_lock);
+   if (sc->sc_count_until_fail != 0 && --sc->sc_count_until_fail == 0) {
+   sc->sc_rfailprob = 100;
+   sc->sc_wfailprob = 100;
+   }
switch (bp->bio_cmd) {
case BIO_READ:
sc->sc_reads++;
@@ -308,9 +312,10 @@ g_nop_access(struct g_provider *pp, int dr, int dw, in
 
 static int
 g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
-int ioerror, u_int rfailprob, u_int wfailprob, u_int delaymsec, u_int 
rdelayprob,
-u_int wdelayprob, off_t offset, off_t size, u_int secsize, off_t 
stripesize,
-off_t stripeoffset, const char *physpath)
+int ioerror, u_int count_until_fail, u_int rfailprob, u_int wfailprob,
+u_int delaymsec, u_int rdelayprob, u_int wde