diff options
| author | oster <oster@NetBSD.org> | 2000-05-28 00:48:30 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2000-05-28 00:48:30 +0000 |
| commit | 1aaf6772f1cd00520131a35a50bf41c196fe1ffc (patch) | |
| tree | 0a26d921e2962bc2c91ea35caa10a51da26fa853 /sys/dev/raidframe | |
| parent | 3713246e34ac94be1a4ef4cc31056b0c0fa9ba46 (diff) | |
- 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 (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 66 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_raidframe.h | 13 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_reconstruct.c | 10 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_reconstruct.h | 4 |
4 files changed, 86 insertions, 7 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index ba244006697..3f90f36c09c 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -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 @@ raidioctl(dev, cmd, data, flag, p) 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 @@ raidioctl(dev, cmd, data, flag, p) 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 @@ raidioctl(dev, cmd, data, flag, p) 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 @@ raidioctl(dev, cmd, data, flag, p) 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 @@ raidioctl(dev, cmd, data, flag, p) 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 @@ raidioctl(dev, cmd, data, flag, p) } 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 --git a/sys/dev/raidframe/rf_raidframe.h b/sys/dev/raidframe/rf_raidframe.h index d0cf35e9f9c..3ffbb8a07fb 100644 --- a/sys/dev/raidframe/rf_raidframe.h +++ b/sys/dev/raidframe/rf_raidframe.h @@ -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 @@ typedef struct RF_DeviceConfig_s { 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 @@ typedef struct RF_DeviceConfig_s { #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 --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index f8c2fbcc060..2f0c46fc6a6 100644 --- a/sys/dev/raidframe/rf_reconstruct.c +++ b/sys/dev/raidframe/rf_reconstruct.c @@ -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 @@ rf_ContinueReconstructFailedDisk(reconDesc) 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 --git a/sys/dev/raidframe/rf_reconstruct.h b/sys/dev/raidframe/rf_reconstruct.h index b7514326c47..41e3fa23f3d 100644 --- a/sys/dev/raidframe/rf_reconstruct.h +++ b/sys/dev/raidframe/rf_reconstruct.h @@ -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 @@ struct RF_ReconCtrl_s { 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 |
