Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej-cfargs2]: src/sys/dev/raidframe Sync w/ HEAD.



details:   https://anonhg.NetBSD.org/src/rev/4135c23fd8fc
branches:  thorpej-cfargs2
changeset: 985032:4135c23fd8fc
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Aug 05 03:37:41 2021 +0000

description:
Sync w/ HEAD.

diffstat:

 sys/dev/raidframe/raidframeio.h    |   5 +-
 sys/dev/raidframe/raidframevar.h   |   3 +-
 sys/dev/raidframe/rf_dagfuncs.c    |   6 +-
 sys/dev/raidframe/rf_netbsdkintf.c |  78 ++++++++++++++++++++++++++++++++++++-
 sys/dev/raidframe/rf_pqdegdags.c   |   6 +-
 sys/dev/raidframe/rf_raid.h        |   3 +-
 6 files changed, 88 insertions(+), 13 deletions(-)

diffs (243 lines):

diff -r 3d8e070e6c5e -r 4135c23fd8fc sys/dev/raidframe/raidframeio.h
--- a/sys/dev/raidframe/raidframeio.h   Thu Aug 05 00:39:16 2021 +0000
+++ b/sys/dev/raidframe/raidframeio.h   Thu Aug 05 03:37:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raidframeio.h,v 1.9 2018/01/20 01:32:45 mrg Exp $ */
+/*     $NetBSD: raidframeio.h,v 1.9.28.1 2021/08/05 03:37:41 thorpej Exp $ */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -133,5 +133,6 @@
 #define RAIDFRAME_SET_LAST_UNIT _IOW('r', 41, int)
 #define RAIDFRAME_GET_INFO          _IOWR('r', 42, RF_DeviceConfig_t *)        /* get configuration */
 #define RAIDFRAME_CONFIGURE         _IOW ('r',  43, void *)    /* configure the driver */
+#define RAIDFRAME_RESCAN  _IO ('r', 44)
+#endif                         /* !_RF_RAIDFRAMEIO_H_ */
 
-#endif                         /* !_RF_RAIDFRAMEIO_H_ */
diff -r 3d8e070e6c5e -r 4135c23fd8fc sys/dev/raidframe/raidframevar.h
--- a/sys/dev/raidframe/raidframevar.h  Thu Aug 05 00:39:16 2021 +0000
+++ b/sys/dev/raidframe/raidframevar.h  Thu Aug 05 03:37:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raidframevar.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */
+/*     $NetBSD: raidframevar.h,v 1.21.18.1 2021/08/05 03:37:41 thorpej Exp $ */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -355,6 +355,7 @@
 /* flags that can be put in the rf_recon_req structure */
 #define RF_FDFLAGS_NONE   0x0  /* just fail the disk */
 #define RF_FDFLAGS_RECON  0x1  /* fail and initiate recon */
+#define RF_FDFLAGS_RECON_FORCE  0x2    /* fail and initiate recon, ignoring errors */
 
 struct rf_recon_req {          /* used to tell the kernel to fail a disk */
        RF_RowCol_t col;
diff -r 3d8e070e6c5e -r 4135c23fd8fc sys/dev/raidframe/rf_dagfuncs.c
--- a/sys/dev/raidframe/rf_dagfuncs.c   Thu Aug 05 00:39:16 2021 +0000
+++ b/sys/dev/raidframe/rf_dagfuncs.c   Thu Aug 05 03:37:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_dagfuncs.c,v 1.33 2021/07/27 03:01:48 oster Exp $   */
+/*     $NetBSD: rf_dagfuncs.c,v 1.33.2.1 2021/08/05 03:37:41 thorpej Exp $     */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.33 2021/07/27 03:01:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.33.2.1 2021/08/05 03:37:41 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -121,7 +121,7 @@
  *
  * parameters:
  *
- * 0 - physical disk addres of data
+ * 0 - physical disk address of data
  * 1 - buffer for holding read data
  * 2 - parity stripe ID
  * 3 - flags
diff -r 3d8e070e6c5e -r 4135c23fd8fc sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Thu Aug 05 00:39:16 2021 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Thu Aug 05 03:37:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.397 2021/07/26 22:50:36 oster Exp $       */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.397.2.1 2021/08/05 03:37:41 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.397 2021/07/26 22:50:36 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.397.2.1 2021/08/05 03:37:41 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -305,6 +305,7 @@
 static void rf_CopybackThread(RF_Raid_t *raidPtr);
 static void rf_ReconstructInPlaceThread(struct rf_recon_req_internal *);
 static int rf_autoconfig(device_t);
+static int rf_rescan(void);
 static void rf_buildroothack(RF_ConfigSet_t *);
 
 static RF_AutoConfig_t *rf_find_raid_components(void);
@@ -480,6 +481,56 @@
        return 0;
 }
 
+static int
+rf_rescan(void)
+{
+       RF_AutoConfig_t *ac_list;
+       RF_ConfigSet_t *config_sets, *cset, *next_cset;
+       struct raid_softc *sc;
+       int raid_added;
+       
+       ac_list = rf_find_raid_components();
+       config_sets = rf_create_auto_sets(ac_list);
+
+       raid_added = 1;
+       while (raid_added > 0) {
+               raid_added = 0;
+               cset = config_sets;
+               while (cset != NULL) {
+                       next_cset = cset->next;
+                       if (rf_have_enough_components(cset) &&
+                           cset->ac->clabel->autoconfigure == 1) {
+                               sc = rf_auto_config_set(cset);
+                               if (sc != NULL) {
+                                       aprint_debug("raid%d: configured ok, rootable %d\n",
+                                                    sc->sc_unit, cset->rootable);
+                                       /* We added one RAID set */
+                                       raid_added++;
+                               } else {
+                                       /* The autoconfig didn't work :( */
+                                       aprint_debug("Autoconfig failed\n");
+                                       rf_release_all_vps(cset);
+                               }
+                       } else {
+                               /* we're not autoconfiguring this set...
+                                  release the associated resources */
+                               rf_release_all_vps(cset);
+                       }
+                       /* cleanup */
+                       rf_cleanup_config_set(cset);
+                       cset = next_cset;
+               }
+               if (raid_added > 0) {
+                       /* We added at least one RAID set, so re-scan for recursive RAID */
+                       ac_list = rf_find_raid_components();
+                       config_sets = rf_create_auto_sets(ac_list);
+               }
+       }
+       
+       return 0;
+}
+
+
 static void
 rf_buildroothack(RF_ConfigSet_t *config_sets)
 {
@@ -1529,7 +1580,7 @@
 
        case RAIDFRAME_REBUILD_IN_PLACE:
                return rf_rebuild_in_place(raidPtr, data);
-
+               
        case RAIDFRAME_GET_INFO:
                ucfgp = *(RF_DeviceConfig_t **)data;
                d_cfg = RF_Malloc(sizeof(*d_cfg));
@@ -1574,6 +1625,9 @@
                /* XXX should errors be passed up? */
                return 0;
 
+       case RAIDFRAME_RESCAN:
+               return rf_rescan();
+
        case RAIDFRAME_RESET_ACCTOTALS:
                memset(&raidPtr->acc_totals, 0, sizeof(raidPtr->acc_totals));
                return 0;
@@ -2680,9 +2734,17 @@
        raidPtr = (RF_Raid_t *) req->raidPtr;
        raidPtr->recon_in_progress = 1;
 
+       if (req->flags & RF_FDFLAGS_RECON_FORCE) {
+               raidPtr->forceRecon = 1;
+       }
+       
        rf_FailDisk((RF_Raid_t *) req->raidPtr, req->col,
                    ((req->flags & RF_FDFLAGS_RECON) ? 1 : 0));
 
+       if (req->flags & RF_FDFLAGS_RECON_FORCE) {
+               raidPtr->forceRecon = 0;
+       }
+
        RF_Free(req, sizeof(*req));
 
        raidPtr->recon_in_progress = 0;
@@ -2751,7 +2813,17 @@
        s = splbio();
        raidPtr = req->raidPtr;
        raidPtr->recon_in_progress = 1;
+
+       if (req->flags & RF_FDFLAGS_RECON_FORCE) {
+               raidPtr->forceRecon = 1;
+       }
+
        rf_ReconstructInPlace(raidPtr, req->col);
+
+       if (req->flags & RF_FDFLAGS_RECON_FORCE) {
+               raidPtr->forceRecon = 0;
+       }
+
        RF_Free(req, sizeof(*req));
        raidPtr->recon_in_progress = 0;
        splx(s);
diff -r 3d8e070e6c5e -r 4135c23fd8fc sys/dev/raidframe/rf_pqdegdags.c
--- a/sys/dev/raidframe/rf_pqdegdags.c  Thu Aug 05 00:39:16 2021 +0000
+++ b/sys/dev/raidframe/rf_pqdegdags.c  Thu Aug 05 03:37:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_pqdegdags.c,v 1.14 2021/08/01 15:29:30 andvar Exp $ */
+/*     $NetBSD: rf_pqdegdags.c,v 1.14.2.1 2021/08/05 03:37:41 thorpej Exp $    */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_pqdegdags.c,v 1.14 2021/08/01 15:29:30 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_pqdegdags.c,v 1.14.2.1 2021/08/05 03:37:41 thorpej Exp $");
 
 #include "rf_archs.h"
 
@@ -379,7 +379,7 @@
        failed data units will do the correct thing. So in this case,
        the dag looks like
 
-            full stripe read of surviving data units (not being overwriten)
+            full stripe read of surviving data units (not being overwritten)
            write new data (ignoring failed units)   compute P&Q
                                                     write P&Q
 
diff -r 3d8e070e6c5e -r 4135c23fd8fc sys/dev/raidframe/rf_raid.h
--- a/sys/dev/raidframe/rf_raid.h       Thu Aug 05 00:39:16 2021 +0000
+++ b/sys/dev/raidframe/rf_raid.h       Thu Aug 05 03:37:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_raid.h,v 1.49 2021/07/23 00:54:45 oster Exp $       */
+/*     $NetBSD: rf_raid.h,v 1.49.2.1 2021/08/05 03:37:41 thorpej Exp $ */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -187,6 +187,7 @@
        RF_HeadSepLimit_t headSepLimit;
        int     numFloatingReconBufs;
        int     reconInProgress;
+       int     forceRecon;
        rf_declare_cond2(waitForReconCond);     /* goes with raidPtr->mutex */
        RF_RaidReconDesc_t *reconDesc;  /* reconstruction descriptor */
        RF_ReconCtrl_t *reconControl;   /* reconstruction control structure



Home | Main Index | Thread Index | Old Index