raidPtr->reconControl->percentCompleted only gets used in one
debugging printf, and in rf_netbsdkintf.c. We can do the calculations inside of RF_DEBUG_RECON for the one debugging printf, and only perform the percentCompleted calculation "on demand" in the rf_netbsdkintf.c case. Shaves a few more bytes off an i386 GENERIC kernel, and ever-so-slightly decreases the amount of work performed during a reconstruct.
This commit is contained in:
parent
a00e4cf6db
commit
290ef1fca7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_netbsdkintf.c,v 1.170 2003/12/31 03:02:57 oster Exp $ */
|
||||
/* $NetBSD: rf_netbsdkintf.c,v 1.171 2004/01/04 21:06:04 oster Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -146,7 +146,7 @@
|
|||
***********************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.170 2003/12/31 03:02:57 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.171 2004/01/04 21:06:04 oster Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/errno.h>
|
||||
|
@ -1338,8 +1338,13 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
}
|
||||
if (raidPtr->status != rf_rs_reconstructing)
|
||||
*(int *) data = 100;
|
||||
else
|
||||
*(int *) data = raidPtr->reconControl->percentComplete;
|
||||
else {
|
||||
if (raidPtr->reconControl->numRUsTotal > 0) {
|
||||
*(int *) data = (raidPtr->reconControl->numRUsComplete * 100 / raidPtr->reconControl->numRUsTotal);
|
||||
} else {
|
||||
*(int *) data = 0;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
case RAIDFRAME_CHECK_RECON_STATUS_EXT:
|
||||
progressInfoPtr = (RF_ProgressInfo_t **) data;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_reconstruct.c,v 1.64 2003/12/31 04:13:52 oster Exp $ */
|
||||
/* $NetBSD: rf_reconstruct.c,v 1.65 2004/01/04 21:06:04 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.64 2003/12/31 04:13:52 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.65 2004/01/04 21:06:04 oster Exp $");
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -653,10 +653,9 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc)
|
|||
raidPtr->reconControl->numRUsComplete =
|
||||
mapPtr->totalRUs -
|
||||
rf_UnitsLeftToReconstruct(mapPtr);
|
||||
|
||||
#if RF_DEBUG_RECON
|
||||
raidPtr->reconControl->percentComplete =
|
||||
(raidPtr->reconControl->numRUsComplete * 100 / raidPtr->reconControl->numRUsTotal);
|
||||
#if RF_DEBUG_RECON
|
||||
if (rf_prReconSched) {
|
||||
rf_PrintReconSchedule(raidPtr->reconControl->reconMap, &(raidPtr->reconControl->starttime));
|
||||
}
|
||||
|
@ -682,8 +681,8 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc)
|
|||
RF_ASSERT(event);
|
||||
|
||||
(void) ProcessReconEvent(raidPtr, event); /* ignore return code */
|
||||
raidPtr->reconControl->percentComplete = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * 100 / mapPtr->totalRUs);
|
||||
#if RF_DEBUG_RECON
|
||||
raidPtr->reconControl->percentComplete = 100 - (rf_UnitsLeftToReconstruct(mapPtr) * 100 / mapPtr->totalRUs);
|
||||
if (rf_prReconSched) {
|
||||
rf_PrintReconSchedule(raidPtr->reconControl->reconMap, &(raidPtr->reconControl->starttime));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue