Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe - Add a mechanism for obtaining finer-grai...



details:   https://anonhg.NetBSD.org/src/rev/bc27370912fc
branches:  trunk
changeset: 486734:bc27370912fc
user:      oster <oster%NetBSD.org@localhost>
date:      Sun May 28 00:48:30 2000 +0000

description:
- Add a mechanism for obtaining finer-grained 'progress' information
regarding reconstructs, copybacks, etc.

- RAID 0 doesn't do copybacks, but don't make raidctl sweat about it.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  66 ++++++++++++++++++++++++++++++++++++-
 sys/dev/raidframe/rf_raidframe.h   |  13 ++++++-
 sys/dev/raidframe/rf_reconstruct.c |  10 ++++-
 sys/dev/raidframe/rf_reconstruct.h |   4 +-
 4 files changed, 86 insertions(+), 7 deletions(-)

diffs (198 lines):

diff -r 6b05d210aba4 -r bc27370912fc sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sun May 28 00:19:59 2000 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sun May 28 00:48:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.82 2000/05/27 20:29:14 oster Exp $        */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.83 2000/05/28 00:48:31 oster Exp $        */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -780,6 +780,7 @@
        RF_SingleComponent_t *sparePtr,*componentPtr;
        RF_SingleComponent_t hot_spare;
        RF_SingleComponent_t component;
+       RF_ProgressInfo_t progressInfo, **progressInfoPtr;
        int i, j, d;
 
        if (unit >= numraid)
@@ -817,6 +818,7 @@
        case RAIDFRAME_FAIL_DISK:
        case RAIDFRAME_COPYBACK:
        case RAIDFRAME_CHECK_RECON_STATUS:
+       case RAIDFRAME_CHECK_RECON_STATUS_EXT:
        case RAIDFRAME_GET_COMPONENT_LABEL:
        case RAIDFRAME_SET_COMPONENT_LABEL:
        case RAIDFRAME_ADD_HOT_SPARE:
@@ -825,7 +827,9 @@
        case RAIDFRAME_REBUILD_IN_PLACE:
        case RAIDFRAME_CHECK_PARITY:
        case RAIDFRAME_CHECK_PARITYREWRITE_STATUS:
+       case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT:
        case RAIDFRAME_CHECK_COPYBACK_STATUS:
+       case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT:
        case RAIDFRAME_SET_AUTOCONFIG:
        case RAIDFRAME_SET_ROOT:
        case RAIDFRAME_DELETE_COMPONENT:
@@ -1277,6 +1281,25 @@
                else
                        *(int *) data = raidPtr->reconControl[row]->percentComplete;
                return (0);
+       case RAIDFRAME_CHECK_RECON_STATUS_EXT:
+               progressInfoPtr = (RF_ProgressInfo_t **) data;
+               row = 0; /* XXX we only consider a single row... */
+               if (raidPtr->status[row] != rf_rs_reconstructing) {
+                       progressInfo.remaining = 0;
+                       progressInfo.completed = 100;
+                       progressInfo.total = 100;
+               } else {
+                       progressInfo.total = 
+                               raidPtr->reconControl[row]->numRUsTotal;
+                       progressInfo.completed = 
+                               raidPtr->reconControl[row]->numRUsComplete;
+                       progressInfo.remaining = progressInfo.total -
+                               progressInfo.completed;
+               }
+               retcode = copyout((caddr_t) &progressInfo,
+                                 (caddr_t) *progressInfoPtr,
+                                 sizeof(RF_ProgressInfo_t));
+               return (retcode);
 
        case RAIDFRAME_CHECK_PARITYREWRITE_STATUS:
                if (raidPtr->Layout.map->faultsTolerated == 0) {
@@ -1286,16 +1309,37 @@
                        return(0);
                }
                if (raidPtr->parity_rewrite_in_progress == 1) {
-                       *(int *) data = 100 * raidPtr->parity_rewrite_stripes_done / raidPtr->Layout.numStripe;
+                       *(int *) data = 100 * 
+                               raidPtr->parity_rewrite_stripes_done / 
+                               raidPtr->Layout.numStripe;
                } else {
                        *(int *) data = 100;
                }
                return (0);
 
+       case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT:
+               progressInfoPtr = (RF_ProgressInfo_t **) data;
+               if (raidPtr->parity_rewrite_in_progress == 1) {
+                       progressInfo.total = raidPtr->Layout.numStripe;
+                       progressInfo.completed = 
+                               raidPtr->parity_rewrite_stripes_done;
+                       progressInfo.remaining = progressInfo.total -
+                               progressInfo.completed;
+               } else {
+                       progressInfo.remaining = 0;
+                       progressInfo.completed = 100;
+                       progressInfo.total = 100;
+               }
+               retcode = copyout((caddr_t) &progressInfo,
+                                 (caddr_t) *progressInfoPtr,
+                                 sizeof(RF_ProgressInfo_t));
+               return (retcode);
+
        case RAIDFRAME_CHECK_COPYBACK_STATUS:
                if (raidPtr->Layout.map->faultsTolerated == 0) {
                        /* This makes no sense on a RAID 0 */
-                       return(EINVAL);
+                       *(int *) data = 100;
+                       return(0);
                }
                if (raidPtr->copyback_in_progress == 1) {
                        *(int *) data = 100 * raidPtr->copyback_stripes_done /
@@ -1305,6 +1349,22 @@
                }
                return (0);
 
+       case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT:
+               if (raidPtr->copyback_in_progress == 1) {
+                       progressInfo.total = raidPtr->Layout.numStripe;
+                       progressInfo.completed = 
+                               raidPtr->parity_rewrite_stripes_done;
+                       progressInfo.remaining = progressInfo.total -
+                               progressInfo.completed;
+               } else {
+                       progressInfo.remaining = 0;
+                       progressInfo.completed = 100;
+                       progressInfo.total = 100;
+               }
+               retcode = copyout((caddr_t) &progressInfo,
+                                 (caddr_t) *progressInfoPtr,
+                                 sizeof(RF_ProgressInfo_t));
+               return (retcode);
 
                /* the sparetable daemon calls this to wait for the kernel to
                 * need a spare table. this ioctl does not return until a
diff -r 6b05d210aba4 -r bc27370912fc sys/dev/raidframe/rf_raidframe.h
--- a/sys/dev/raidframe/rf_raidframe.h  Sun May 28 00:19:59 2000 +0000
+++ b/sys/dev/raidframe/rf_raidframe.h  Sun May 28 00:48:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_raidframe.h,v 1.10 2000/03/26 22:38:29 oster Exp $  */
+/*     $NetBSD: rf_raidframe.h,v 1.11 2000/05/28 00:48:31 oster Exp $  */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -79,6 +79,12 @@
        RF_RaidDisk_t spares[RF_MAX_DISKS];
 }       RF_DeviceConfig_t;
 
+typedef struct RF_ProgressInfo_s {
+       RF_uint64 remaining;
+       RF_uint64 completed;
+       RF_uint64 total;
+} RF_ProgressInfo_t;
+
 /* 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 */
@@ -134,4 +140,9 @@
 #define RAIDFRAME_SET_ROOT _IOWR ('r', 29, int)
 #define RAIDFRAME_DELETE_COMPONENT _IOW ('r', 30, RF_SingleComponent_t)
 #define RAIDFRAME_INCORPORATE_HOT_SPARE _IOW ('r', 31, RF_SingleComponent_t)
+/* 'Extended' status versions */
+#define RAIDFRAME_CHECK_RECON_STATUS_EXT _IOWR('r',  32, RF_ProgressInfo_t *)
+#define RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT _IOWR ('r', 33, RF_ProgressInfo_t *)
+#define RAIDFRAME_CHECK_COPYBACK_STATUS_EXT _IOWR ('r', 34, RF_ProgressInfo_t *)
+
 #endif                         /* !_RF__RF_RAIDFRAME_H_ */
diff -r 6b05d210aba4 -r bc27370912fc sys/dev/raidframe/rf_reconstruct.c
--- a/sys/dev/raidframe/rf_reconstruct.c        Sun May 28 00:19:59 2000 +0000
+++ b/sys/dev/raidframe/rf_reconstruct.c        Sun May 28 00:48:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_reconstruct.c,v 1.22 2000/03/13 23:52:36 soren Exp $        */
+/*     $NetBSD: rf_reconstruct.c,v 1.23 2000/05/28 00:48:30 oster Exp $        */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -699,7 +699,13 @@
 
                        if (ProcessReconEvent(raidPtr, row, event))
                                reconDesc->numDisksDone++;
-                       raidPtr->reconControl[row]->percentComplete = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * 100 / mapPtr->totalRUs);
+                       raidPtr->reconControl[row]->numRUsComplete = 
+                               rf_UnitsLeftToReconstruct(mapPtr);
+                       raidPtr->reconControl[row]->numRUsTotal = 
+                               mapPtr->totalRUs;
+
+                       raidPtr->reconControl[row]->percentComplete = 
+                               100 - (raidPtr->reconControl[row]->numRUsComplete * 100 / raidPtr->reconControl[row]->numRUsTotal);
                        if (rf_prReconSched) {
                                rf_PrintReconSchedule(raidPtr->reconControl[row]->reconMap, &(raidPtr->reconControl[row]->starttime));
                        }
diff -r 6b05d210aba4 -r bc27370912fc sys/dev/raidframe/rf_reconstruct.h
--- a/sys/dev/raidframe/rf_reconstruct.h        Sun May 28 00:19:59 2000 +0000
+++ b/sys/dev/raidframe/rf_reconstruct.h        Sun May 28 00:48:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_reconstruct.h,v 1.4 1999/03/02 03:18:48 oster Exp $ */
+/*     $NetBSD: rf_reconstruct.h,v 1.5 2000/05/28 00:48:30 oster Exp $ */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -127,6 +127,8 @@
        RF_StripeNum_t lastPSID;/* the ID of the last parity stripe we want
                                 * reconstructed */
        int     percentComplete;/* percentage completion of reconstruction */
+       int     numRUsComplete; /* number of Reconstruction Units done */
+       int     numRUsTotal;    /* total number of Reconstruction Units */
 
        /* reconstruction event queue */
        RF_ReconEvent_t *eventQueue;    /* queue of pending reconstruction



Home | Main Index | Thread Index | Old Index