Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Don't consider a disk hosed if we did not ...



details:   https://anonhg.NetBSD.org/src/rev/79c4e5ffcc37
branches:  trunk
changeset: 820650:79c4e5ffcc37
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 13 04:22:16 2017 +0000

description:
Don't consider a disk hosed if we did not find a column for it; dedup code.

diffstat:

 sys/dev/raidframe/rf_disks.c |  52 ++++++++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 28 deletions(-)

diffs (97 lines):

diff -r 1c8fd965944c -r 79c4e5ffcc37 sys/dev/raidframe/rf_disks.c
--- a/sys/dev/raidframe/rf_disks.c      Fri Jan 13 04:18:54 2017 +0000
+++ b/sys/dev/raidframe/rf_disks.c      Fri Jan 13 04:22:16 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_disks.c,v 1.87 2014/10/18 08:33:28 snj Exp $        */
+/*     $NetBSD: rf_disks.c,v 1.88 2017/01/13 04:22:16 christos Exp $   */
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -60,7 +60,7 @@
  ***************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.87 2014/10/18 08:33:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.88 2017/01/13 04:22:16 christos Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -700,6 +700,24 @@
 }
 
 
+static void
+rf_handle_hosed(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, int hosed_column)
+{
+       printf("Hosed component: %s\n", &cfgPtr->devnames[0][hosed_column][0]);
+       if (!cfgPtr->force)
+               return;
+
+       /* we'll fail this component, as if there are
+          other major errors, we arn't forcing things
+          and we'll abort the config anyways */
+       if (raidPtr->Disks[hosed_column].status == rf_ds_failed)
+               return;
+
+       raidPtr->Disks[hosed_column].status = rf_ds_failed;
+       raidPtr->numFailures++;
+       raidPtr->status = rf_rs_degraded;
+}
+
 /*
 
    rf_CheckLabels() - check all the component labels for consistency.
@@ -727,11 +745,9 @@
        int hosed_column;
        int too_fatal;
        int parity_good;
-       int force;
 
        hosed_column = -1;
        too_fatal = 0;
-       force = cfgPtr->force;
 
        /*
           We're going to try to be a little intelligent here.  If one
@@ -823,17 +839,8 @@
                                        break;
                                }
                        }
-                       printf("Hosed component: %s\n",
-                              &cfgPtr->devnames[0][hosed_column][0]);
-                       if (!force) {
-                               /* we'll fail this component, as if there are
-                                  other major errors, we arn't forcing things
-                                  and we'll abort the config anyways */
-                               raidPtr->Disks[hosed_column].status
-                                       = rf_ds_failed;
-                               raidPtr->numFailures++;
-                               raidPtr->status = rf_rs_degraded;
-                       }
+                       if (hosed_column != -1)
+                               rf_handle_hosed(raidPtr, cfgPtr, hosed_column);
                } else {
                        too_fatal = 1;
                }
@@ -889,19 +896,8 @@
                                        }
                                }
                        }
-                       printf("Hosed component: %s\n",
-                              &cfgPtr->devnames[0][hosed_column][0]);
-                       if (!force) {
-                               /* we'll fail this component, as if there are
-                                  other major errors, we arn't forcing things
-                                  and we'll abort the config anyways */
-                               if (raidPtr->Disks[hosed_column].status != rf_ds_failed) {
-                                       raidPtr->Disks[hosed_column].status
-                                               = rf_ds_failed;
-                                       raidPtr->numFailures++;
-                                       raidPtr->status = rf_rs_degraded;
-                               }
-                       }
+                       if (hosed_column != -1)
+                               rf_handle_hosed(raidPtr, cfgPtr, hosed_column);
                } else {
                        too_fatal = 1;
                }



Home | Main Index | Thread Index | Old Index