diff options
Diffstat (limited to 'sys/geom/raid3/g_raid3_ctl.c')
-rw-r--r-- | sys/geom/raid3/g_raid3_ctl.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/sys/geom/raid3/g_raid3_ctl.c b/sys/geom/raid3/g_raid3_ctl.c index 67d1f4419b47..952ac2bf9f76 100644 --- a/sys/geom/raid3/g_raid3_ctl.c +++ b/sys/geom/raid3/g_raid3_ctl.c @@ -98,8 +98,9 @@ g_raid3_ctl_configure(struct gctl_req *req, struct g_class *mp) struct g_raid3_softc *sc; struct g_raid3_disk *disk; const char *name; - int *nargs, do_sync = 0; + int *nargs, do_sync = 0, dirty = 1; int *autosync, *noautosync; + int *failsync, *nofailsync; int *round_robin, *noround_robin; int *verify, *noverify; u_int n; @@ -128,6 +129,21 @@ g_raid3_ctl_configure(struct gctl_req *req, struct g_class *mp) "noautosync"); return; } + failsync = gctl_get_paraml(req, "failsync", sizeof(*failsync)); + if (failsync == NULL) { + gctl_error(req, "No '%s' argument.", "failsync"); + return; + } + nofailsync = gctl_get_paraml(req, "nofailsync", sizeof(*nofailsync)); + if (nofailsync == NULL) { + gctl_error(req, "No '%s' argument.", "nofailsync"); + return; + } + if (*failsync && *nofailsync) { + gctl_error(req, "'%s' and '%s' specified.", "failsync", + "nofailsync"); + return; + } round_robin = gctl_get_paraml(req, "round_robin", sizeof(*round_robin)); if (round_robin == NULL) { gctl_error(req, "No '%s' argument.", "round_robin"); @@ -159,8 +175,8 @@ g_raid3_ctl_configure(struct gctl_req *req, struct g_class *mp) "noverify"); return; } - if (!*autosync && !*noautosync && !*round_robin && !*noround_robin && - !*verify && !*noverify) { + if (!*autosync && !*noautosync && !*failsync && !*nofailsync && + !*round_robin && !*noround_robin && !*verify && !*noverify) { gctl_error(req, "Nothing has changed."); return; } @@ -188,6 +204,15 @@ g_raid3_ctl_configure(struct gctl_req *req, struct g_class *mp) if (*noautosync) sc->sc_flags |= G_RAID3_DEVICE_FLAG_NOAUTOSYNC; } + if ((sc->sc_flags & G_RAID3_DEVICE_FLAG_NOFAILSYNC) != 0) { + if (*failsync) + sc->sc_flags &= ~G_RAID3_DEVICE_FLAG_NOFAILSYNC; + } else { + if (*nofailsync) { + sc->sc_flags |= G_RAID3_DEVICE_FLAG_NOFAILSYNC; + dirty = 0; + } + } if ((sc->sc_flags & G_RAID3_DEVICE_FLAG_VERIFY) != 0) { if (*noverify) sc->sc_flags &= ~G_RAID3_DEVICE_FLAG_VERIFY; @@ -215,6 +240,8 @@ g_raid3_ctl_configure(struct gctl_req *req, struct g_class *mp) if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) disk->d_flags &= ~G_RAID3_DISK_FLAG_FORCE_SYNC; } + if (!dirty) + disk->d_flags &= ~G_RAID3_DISK_FLAG_DIRTY; g_raid3_update_metadata(disk); if (do_sync) { if (disk->d_state == G_RAID3_DISK_STATE_STALE) { |