diff options
Diffstat (limited to 'sys/dev/raidframe/rf_driver.c')
| -rw-r--r-- | sys/dev/raidframe/rf_driver.c | 744 |
1 files changed, 2 insertions, 742 deletions
diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 5266010ea1a..170e22f376e 100644 --- a/sys/dev/raidframe/rf_driver.c +++ b/sys/dev/raidframe/rf_driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.3 1999/01/15 17:55:52 explorer Exp $ */ +/* $NetBSD: rf_driver.c,v 1.4 1999/01/26 02:33:56 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -35,581 +35,18 @@ * ******************************************************************************/ -/* - * : - * Log: rf_driver.c,v - * Revision 1.147 1996/08/21 04:12:46 jimz - * added hook for starting out req_hist w/ more distributed values - * (currently not done) - * - * Revision 1.146 1996/07/29 14:05:12 jimz - * fix numPUs/numRUs confusion (everything is now numRUs) - * clean up some commenting, return values - * - * Revision 1.145 1996/07/28 20:31:39 jimz - * i386netbsd port - * true/false fixup - * - * Revision 1.144 1996/07/27 18:40:24 jimz - * cleanup sweep - * - * Revision 1.143 1996/07/22 21:11:53 jimz - * fix formatting on DoAccess error msg - * - * Revision 1.142 1996/07/19 16:10:06 jimz - * added call to rf_ResetDebugOptions() in rf_ConfigureDebug() - * - * Revision 1.141 1996/07/18 22:57:14 jimz - * port simulator to AIX - * - * Revision 1.140 1996/07/17 21:00:58 jimz - * clean up timer interface, tracing - * - * Revision 1.139 1996/07/15 05:40:41 jimz - * some recon datastructure cleanup - * better handling of multiple failures - * added undocumented double-recon test - * - * Revision 1.138 1996/07/11 19:08:00 jimz - * generalize reconstruction mechanism - * allow raid1 reconstructs via copyback (done with array - * quiesced, not online, therefore not disk-directed) - * - * Revision 1.137 1996/07/10 22:28:00 jimz - * get rid of obsolete row statuses (dead,degraded2) - * - * Revision 1.136 1996/06/17 14:38:33 jimz - * properly #if out RF_DEMO code - * fix bug in MakeConfig that was causing weird behavior - * in configuration routines (config was not zeroed at start) - * clean up genplot handling of stacks - * - * Revision 1.135 1996/06/17 03:20:32 jimz - * move out raidframe_attr_default - * don't monkey with stack sizes - * - * Revision 1.134 1996/06/14 23:15:38 jimz - * attempt to deal with thread GC problem - * - * Revision 1.133 1996/06/14 21:24:08 jimz - * new ConfigureEtimer init - * moved out timer vars - * - * Revision 1.132 1996/06/14 16:19:03 jimz - * remove include of pdllib.h (beginning of PDL cleanup) - * - * Revision 1.131 1996/06/14 14:35:24 jimz - * clean up dfstrace protection - * - * Revision 1.130 1996/06/14 14:16:09 jimz - * engine config is now array-specific - * - * Revision 1.129 1996/06/13 19:08:10 jimz - * add debug var to force keep_acc_totals on - * - * Revision 1.128 1996/06/11 10:57:08 jimz - * init recon_done_proc_mutex - * - * Revision 1.127 1996/06/10 14:18:58 jimz - * move user, throughput stats into per-array structure - * - * Revision 1.126 1996/06/10 11:55:47 jimz - * Straightened out some per-array/not-per-array distinctions, fixed - * a couple bugs related to confusion. Added shutdown lists. Removed - * layout shutdown function (now subsumed by shutdown lists). - * - * Revision 1.125 1996/06/09 02:36:46 jimz - * lots of little crufty cleanup- fixup whitespace - * issues, comment #ifdefs, improve typing in some - * places (esp size-related) - * - * Revision 1.124 1996/06/07 21:33:04 jimz - * begin using consistent types for sector numbers, - * stripe numbers, row+col numbers, recon unit numbers - * - * Revision 1.123 1996/06/05 19:38:32 jimz - * fixed up disk queueing types config - * added sstf disk queueing - * fixed exit bug on diskthreads (ref-ing bad mem) - * - * Revision 1.122 1996/06/05 18:06:02 jimz - * Major code cleanup. The Great Renaming is now done. - * Better modularity. Better typing. Fixed a bunch of - * synchronization bugs. Made a lot of global stuff - * per-desc or per-array. Removed dead code. - * - * Revision 1.121 1996/06/03 23:28:26 jimz - * more bugfixes - * check in tree to sync for IPDS runs with current bugfixes - * there still may be a problem with threads in the script test - * getting I/Os stuck- not trivially reproducible (runs ~50 times - * in a row without getting stuck) - * - * Revision 1.120 1996/06/02 17:31:48 jimz - * Moved a lot of global stuff into array structure, where it belongs. - * Fixed up paritylogging, pss modules in this manner. Some general - * code cleanup. Removed lots of dead code, some dead files. - * - * Revision 1.119 1996/05/31 22:26:54 jimz - * fix a lot of mapping problems, memory allocation problems - * found some weird lock issues, fixed 'em - * more code cleanup - * - * Revision 1.118 1996/05/30 23:22:16 jimz - * bugfixes of serialization, timing problems - * more cleanup - * - * Revision 1.117 1996/05/30 16:28:33 jimz - * typo in rf_SignalQuiescenceLock() fixed - * - * Revision 1.116 1996/05/30 12:59:18 jimz - * make etimer happier, more portable - * - * Revision 1.115 1996/05/30 11:29:41 jimz - * Numerous bug fixes. Stripe lock release code disagreed with the taking code - * about when stripes should be locked (I made it consistent: no parity, no lock) - * There was a lot of extra serialization of I/Os which I've removed- a lot of - * it was to calculate values for the cache code, which is no longer with us. - * More types, function, macro cleanup. Added code to properly quiesce the array - * on shutdown. Made a lot of stuff array-specific which was (bogusly) general - * before. Fixed memory allocation, freeing bugs. - * - * Revision 1.114 1996/05/27 18:56:37 jimz - * more code cleanup - * better typing - * compiles in all 3 environments - * - * Revision 1.113 1996/05/24 22:17:04 jimz - * continue code + namespace cleanup - * typed a bunch of flags - * - * Revision 1.112 1996/05/24 04:28:55 jimz - * release cleanup ckpt - * - * Revision 1.111 1996/05/24 01:59:45 jimz - * another checkpoint in code cleanup for release - * time to sync kernel tree - * - * Revision 1.110 1996/05/23 21:46:35 jimz - * checkpoint in code cleanup (release prep) - * lots of types, function names have been fixed - * - * Revision 1.109 1996/05/23 00:39:56 jimz - * demoMode -> rf_demoMode - * - * Revision 1.108 1996/05/23 00:33:23 jimz - * code cleanup: move all debug decls to rf_options.c, all extern - * debug decls to rf_options.h, all debug vars preceded by rf_ - * - * Revision 1.107 1996/05/21 14:30:04 jimz - * idler_desc_mutex should be ifndef SIMULATE - * - * Revision 1.106 1996/05/20 19:31:12 jimz - * add atomic debug (mutex and cond leak finder) stuff - * - * Revision 1.105 1996/05/20 16:12:45 jimz - * switch to rf_{mutex,cond}_{init,destroy} - * - * Revision 1.104 1996/05/18 20:09:41 jimz - * bit of cleanup to compile cleanly in kernel, once again - * - * Revision 1.103 1996/05/18 19:51:34 jimz - * major code cleanup- fix syntax, make some types consistent, - * add prototypes, clean out dead code, et cetera - * - * Revision 1.102 1996/05/16 21:20:51 jimz - * use FREELIST stuff to manage access descriptors - * - * Revision 1.101 1996/05/16 14:21:10 jimz - * remove bogus copies from write path on user - * - * Revision 1.100 1996/05/15 22:33:54 jimz - * appropriately #ifdef cache stuff - * - * Revision 1.99 1996/05/08 21:34:41 jimz - * #if 0 ShutdownCache() and ConfigureCache() - * - * Revision 1.98 1996/05/08 21:01:24 jimz - * fixed up enum type names that were conflicting with other - * enums and function names (ie, "panic") - * future naming trends will be towards RF_ and rf_ for - * everything raidframe-related - * - * Revision 1.97 1996/05/07 19:02:58 wvcii - * corrected header comment of rf_DoAccess() - * reordered free of desc in FreeRaidAccDesc() The desc is now - * freed last. - * - * Revision 1.96 1996/05/07 17:40:50 jimz - * add doDebug - * - * Revision 1.95 1996/05/06 21:35:23 jimz - * fixed ordering of cleanup and removed extra decrement of configureCount - * - * Revision 1.94 1996/05/06 18:44:14 jimz - * reorder cleanup to not blow alloclist out from under various modules - * zero raidPtr contents on config - * - * Revision 1.93 1996/05/04 17:06:53 jimz - * Fail the I/O with ENOSPC if reading past end of the array in the kernel. - * - * Revision 1.92 1996/05/03 19:44:22 wvcii - * debug vars degDagDebug and enableAtomicRMW now defined - * in this file. - * - * Revision 1.91 1995/12/12 18:10:06 jimz - * MIN -> RF_MIN, MAX -> RF_MAX, ASSERT -> RF_ASSERT - * fix 80-column brain damage in comments - * - * Revision 1.90 1995/12/08 15:07:03 arw - * cache code cleanup - * - * Revision 1.89 1995/12/06 20:53:58 wvcii - * created debug var forceParityLogReint - * this variable forces reintegration of all parity logs at shutdown - * - * Revision 1.88 1995/12/01 15:59:10 root - * added copyright info - * - * Revision 1.87 1995/11/28 21:34:02 amiri - * modified SetReconfiguredMode so that it installs the - * spare table only if arch is declustered based on block designs - * - * Revision 1.86 1995/11/21 23:06:11 amiri - * added division by zero check in printing - * throughput stats. - * - * Revision 1.85 1995/11/19 16:27:25 wvcii - * disableParityVerify now defined locally, only read from config - * file for !KERNEL compiles - * - * Revision 1.84 1995/11/17 15:08:31 wvcii - * added debug var disableParityVerify - * used in RealLoopTest to disable parity verification - * - * Revision 1.83 1995/11/07 15:48:43 wvcii - * deleted debug vars: suppressAtomicRMW, enableRollAway, concatDagDebug - * deleted debug vars: debugSelectUnit, debugSelectBlock - * added debug var: enableAtomicRMW - * - * Revision 1.82 1995/10/18 19:28:45 amiri - * added support for reconstruction demos in the - * simulator, by updating some simulator - * variables in Faildisk. - * - * Revision 1.81 1995/10/09 18:36:33 jimz - * move rf_StopThroughputStats() into FreeAccDesc() - * changed throughput output print format - * added user-level copy to write path to emulate kernel hack - * - * Revision 1.80 1995/10/09 18:07:47 wvcii - * moved call to rf_StopThroughputStats to rf_states.c - * - * Revision 1.79 1995/10/09 17:38:53 jimz - * quiesce an array for user-level testing before shutting it down - * (should this also be done in the kernel?) - * - * Revision 1.78 1995/10/09 15:35:43 wvcii - * added code to measure throughput in user mode - * - * Revision 1.77 1995/10/05 06:18:59 jimz - * Changed DDEventRequest() to take additional arg, used by simulator - * to cache diskid so queue length can be decremented on io complete - * (this is a hack to get around the fact that the event mechanism - * assumes it can dereference arbitrary handles on enqueued events) - * - * Revision 1.76 1995/10/04 07:25:10 jimz - * turn off bigstacks by default - * - * Revision 1.75 1995/10/04 07:24:34 jimz - * code for bigstacks in user process - * - * Revision 1.74 1995/09/26 21:42:51 wvcii - * removed calls to ConfigureCache, ShutdownCache when building kernel - * kernel currently does not support any cached architectures - * - * Revision 1.73 1995/09/20 21:05:35 jimz - * add missing unit arg to IO_BUF_ERR() in non-kernel case - * - * Revision 1.72 1995/09/19 23:02:44 jimz - * call RF_DKU_END_IO in the appropriate places - * - * Revision 1.71 1995/09/07 19:02:31 jimz - * mods to get raidframe to compile and link - * in kernel environment - * - * Revision 1.70 1995/09/06 19:24:01 wvcii - * added debug vars enableRollAway and debugRecovery - * - * Revision 1.69 1995/08/24 19:25:36 rachad - * Fixes to LSS GC in the simulater - * - * Revision 1.68 1995/07/28 21:43:42 robby - * checkin after leaving for Rice. Bye - * - * Revision 1.67 1995/07/26 18:06:52 cfb - * *** empty log message *** - * - * Revision 1.66 1995/07/26 03:25:24 robby - * fixed accesses mutex and updated call to ConfigureCache - * - * Revision 1.65 1995/07/25 14:36:52 rachad - * *** empty log message *** - * - * Revision 1.64 1995/07/21 19:29:05 robby - * added total_accesses - * - * Revision 1.63 1995/07/20 19:43:35 cfb - * *** empty log message *** - * - * Revision 1.62 1995/07/20 16:10:24 rachad - * *** empty log message *** - * - * Revision 1.61 1995/07/20 03:36:53 rachad - * Added suport for cache warming - * - * Revision 1.60 1995/07/17 22:31:31 cfb - * *** empty log message *** - * - * Revision 1.59 1995/07/16 17:02:23 cfb - * *** empty log message *** - * - * Revision 1.58 1995/07/16 15:19:27 cfb - * *** empty log message *** - * - * Revision 1.57 1995/07/16 03:17:01 cfb - * *** empty log message *** - * - * Revision 1.56 1995/07/13 16:11:59 cfb - * *** empty log message *** - * - * Revision 1.55 1995/07/13 15:42:40 cfb - * added cacheDebug variable ... - * - * Revision 1.54 1995/07/13 14:28:27 rachad - * *** empty log message *** - * - * Revision 1.53 1995/07/10 21:48:52 robby - * added virtualStripingWarnings - * - * Revision 1.52 1995/07/10 20:41:13 rachad - * *** empty log message *** - * - * Revision 1.51 1995/07/09 19:46:49 cfb - * Added cache Shutdown - * - * Revision 1.50 1995/07/08 21:38:53 rachad - * Added support for interactive traces - * in the simulator - * - * Revision 1.49 1995/07/08 18:05:39 rachad - * Linked up Claudsons code with the real cache - * - * Revision 1.48 1995/07/07 16:00:22 cfb - * Added initialization of cacheDesc to AllocRaidAccDesc - * - * Revision 1.47 1995/07/06 14:22:37 rachad - * Merge complete - * - * Revision 1.46.50.2 1995/06/21 17:48:30 robby - * test - * - * Revision 1.46.50.1 1995/06/21 17:34:49 robby - * branching to work on "meta-dag" capabilities - * - * Revision 1.46.10.5 1995/07/03 21:58:34 holland - * added support for suppressing both stripe locks & large writes - * - * Revision 1.46.10.4 1995/06/27 03:42:48 holland - * typo fix - * - * Revision 1.46.10.3 1995/06/27 03:31:42 holland - * prototypes - * - * Revision 1.46.10.2 1995/06/27 03:17:57 holland - * fixed callback bug in kernel rf_DoAccess - * - * Revision 1.46.10.1 1995/06/25 14:32:44 holland - * initial checkin on new branch - * - * Revision 1.46 1995/06/13 17:52:41 holland - * added UserStats stuff - * - * Revision 1.45 1995/06/13 16:03:41 rachad - * *** empty log message *** - * - * Revision 1.44 1995/06/12 15:54:40 rachad - * Added garbege collection for log structured storage - * - * Revision 1.43 1995/06/09 18:01:09 holland - * various changes related to in-kernel recon, multiple-row arrays, - * trace extraction from kernel, etc. - * - * Revision 1.42 1995/06/08 19:52:28 rachad - * *** empty log message *** - * - * Revision 1.41 1995/06/08 00:11:49 robby - * added a debug variable -- showVirtualSizeRequirements - * - * Revision 1.40 1995/06/05 00:33:30 holland - * protectedSectors bug fix - * - * Revision 1.39 1995/06/01 22:45:03 holland - * made compilation of parity logging and virtual striping - * stuff conditional on some constants defined in rf_archs.h - * - * Revision 1.38 1995/06/01 21:52:37 holland - * replaced NULL sizes in calls to Free() by -1, and caused this - * to suppress the size-mismatch error - * - * Revision 1.37 1995/05/26 20:04:54 wvcii - * modified parity logging debug vars - * - * Revision 1.36 95/05/21 15:32:41 wvcii - * added debug vars: parityLogDebug, numParityRegions, numParityLogs, - * numReintegrationThreads - * - * Revision 1.35 95/05/19 20:58:21 holland - * cleanups on error cases in rf_DoAccess - * - * Revision 1.34 1995/05/16 17:35:53 holland - * added rf_copyback_in_progress. this is debug-only. - * - * Revision 1.33 1995/05/15 12:25:35 holland - * bug fix in test code: no stripe locks were getting acquired in RAID0 mode - * - * Revision 1.32 1995/05/10 18:54:12 holland - * bug fixes related to deadlock problem at time of disk failure - * eliminated read-op-write code - * beefed up parity checking in loop test - * various small changes & new ASSERTs - * - * Revision 1.31 1995/05/02 22:49:02 holland - * add shutdown calls for each architecture - * - * Revision 1.30 1995/05/01 14:43:37 holland - * merged changes from Bill - * - * Revision 1.29 1995/05/01 13:28:00 holland - * parity range locks, locking disk requests, recon+parityscan in kernel, etc. - * - * Revision 1.28 1995/04/24 13:25:51 holland - * rewrite to move disk queues, recon, & atomic RMW to kernel - * - * Revision 1.27 1995/04/06 14:47:56 rachad - * merge completed - * - * Revision 1.26 1995/04/03 20:32:35 rachad - * added reconstruction to simulator - * - * Revision 1.25.10.2 1995/04/03 20:41:00 holland - * misc changes related to distributed sparing - * - * Revision 1.25.10.1 1995/03/17 20:04:01 holland - * initial checkin on new branch - * - * Revision 1.25 1995/03/15 20:34:30 holland - * changes for distributed sparing. - * - * Revision 1.24 1995/03/09 19:53:05 rachad - * *** empty log message *** - * - * Revision 1.23 1995/03/03 18:36:16 rachad - * Simulator mechanism added - * - * Revision 1.22 1995/03/01 20:25:48 holland - * kernelization changes - * - * Revision 1.21 1995/02/17 19:39:56 holland - * added size param to all calls to Free(). - * this is ignored at user level, but necessary in the kernel. - * - * Revision 1.20 1995/02/17 13:37:49 holland - * kernelization changes -- not yet complete - * - * Revision 1.19 1995/02/10 18:08:07 holland - * fixed a few things I broke during kernelization - * - * Revision 1.18 1995/02/10 17:34:10 holland - * kernelization changes - * - * Revision 1.17 1995/02/04 15:51:35 holland - * kernelization changes - * - * Revision 1.16 1995/02/03 22:31:36 holland - * many changes related to kernelization - * - * Revision 1.15 1995/02/01 15:13:05 holland - * moved #include of general.h out of raid.h and into each file - * - * Revision 1.14 1995/02/01 14:25:19 holland - * began changes for kernelization: - * changed all instances of mutex_t and cond_t to DECLARE macros - * converted configuration code to use config structure - * - * Revision 1.13 1995/01/30 14:53:46 holland - * extensive changes related to making DoIO non-blocking - * - * Revision 1.12 1995/01/25 00:26:21 holland - * eliminated support for aio - * - * Revision 1.11 1995/01/24 23:58:46 holland - * multi-way recon XOR, plus various small changes - * - * Revision 1.10 1995/01/11 19:27:02 holland - * various changes related to performance tuning - * - * Revision 1.9 1994/12/05 15:29:09 holland - * added trace run time limitation (maxTraceRunTimeSec) - * - * Revision 1.8 1994/12/05 04:18:12 holland - * various new control vars in the config file - * - * Revision 1.7 1994/11/29 23:11:36 holland - * tracerec bug on dag retry fixed - * - * Revision 1.6 1994/11/29 22:11:38 danner - * holland updates - * - * Revision 1.5 1994/11/29 21:09:47 danner - * Detailed tracing support (holland). - * - * Revision 1.4 1994/11/29 20:36:02 danner - * Added suppressAtomicRMW option. - * - * Revision 1.3 1994/11/21 15:34:06 danner - * Added ConfigureAllocList() call. - * - */ -#ifdef _KERNEL -#define KERNEL -#endif - -#if defined(__NetBSD__) && defined(_KERNEL) #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/ioctl.h> #include <sys/fcntl.h> #include <sys/vnode.h> -#endif -#ifdef KERNEL -#ifndef __NetBSD__ -#include <dkusage.h> -#include <dfstrace.h> -#endif /* !__NetBSD__ */ -#endif /* KERNEL */ #include "rf_archs.h" #include "rf_threadstuff.h" -#ifndef KERNEL -#include <stdio.h> -#include <stdlib.h> -#endif /* KERNEL */ - #include <sys/errno.h> #include "rf_raid.h" @@ -648,20 +85,7 @@ #include "rf_sys.h" #include "rf_cpuutil.h" -#ifdef SIMULATE -#include "rf_diskevent.h" -#endif /* SIMULATE */ - -#ifdef KERNEL #include <sys/buf.h> -#ifndef __NetBSD__ -#include <io/common/devdriver.h> -#endif /* !__NetBSD__ */ - -#if DFSTRACE > 0 -#include <sys/dfs_log.h> -#include <sys/dfstracebuf.h> -#endif /* DFSTRACE > 0 */ #if DKUSAGE > 0 #include <sys/dkusage.h> @@ -670,7 +94,6 @@ #include <io/cam/cam.h> #include <io/cam/pdrv.h> #endif /* DKUSAGE > 0 */ -#endif /* KERNEL */ #if RF_DEMO > 0 #include "rf_demo.h" @@ -700,23 +123,11 @@ static int rf_ConfigureRDFreeList(RF_ShutdownList_t **); RF_DECLARE_MUTEX(rf_printf_mutex) /* debug only: avoids interleaved printfs by different stripes */ RF_DECLARE_GLOBAL_THREADID /* declarations for threadid.h */ -#if !defined(KERNEL) && !defined(SIMULATE) -static int rf_InitThroughputStats(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr); -static void rf_StopThroughputStats(RF_Raid_t *raidPtr); -static void rf_PrintThroughputStats(RF_Raid_t *raidPtr); -#endif /* !KERNEL && !SIMULATE */ -#ifdef KERNEL #define SIGNAL_QUIESCENT_COND(_raid_) wakeup(&((_raid_)->accesses_suspended)) -#ifndef __NetBSD__ -#define WAIT_FOR_QUIESCENCE(_raid_) \ - mpsleep(&((_raid_)->accesses_suspended), PZERO, "raidframe quiesce", 0, \ - (void *) simple_lock_addr((_raid_)->access_suspend_mutex), MS_LOCK_SIMPLE) -#else #define WAIT_FOR_QUIESCENCE(_raid_) \ tsleep(&((_raid_)->accesses_suspended),PRIBIO|PCATCH,"raidframe quiesce", 0); -#endif #if DKUSAGE > 0 #define IO_BUF_ERR(bp, err, unit) { \ bp->b_flags |= B_ERROR; \ @@ -734,13 +145,6 @@ static void rf_PrintThroughputStats(RF_Raid_t *raidPtr); biodone(bp); \ } #endif /* DKUSAGE > 0 */ -#else /* KERNEL */ - -#define SIGNAL_QUIESCENT_COND(_raid_) RF_SIGNAL_COND((_raid_)->quiescent_cond) -#define WAIT_FOR_QUIESCENCE(_raid_) RF_WAIT_COND((_raid_)->quiescent_cond, (_raid_)->access_suspend_mutex) -#define IO_BUF_ERR(bp, err, unit) - -#endif /* KERNEL */ static int configureCount=0; /* number of active configurations */ static int isconfigged=0; /* is basic raidframe (non per-array) stuff configged */ @@ -753,9 +157,6 @@ static int rf_ConfigureRDFreeList(RF_ShutdownList_t **listp); /* called at system boot time */ int rf_BootRaidframe() { -#if 0 - long stacksize; -#endif int rc; if (raidframe_booted) @@ -769,25 +170,6 @@ int rf_BootRaidframe() rf_setup_threadid(); rf_assign_threadid(); -#if !defined(KERNEL) && !defined(SIMULATE) - if (RF_THREAD_ATTR_CREATE(raidframe_attr_default)) { - fprintf(stderr, "Unable to create default thread attr\n"); - exit(1); - } -#if 0 - stacksize = RF_THREAD_ATTR_GETSTACKSIZE(raidframe_attr_default); - if (stacksize < 0) { - fprintf(stderr, "Unable to get stack size of default thread attr\n"); - exit(1); - } - stacksize += 16384; - rc = RF_THREAD_ATTR_SETSTACKSIZE(raidframe_attr_default, stacksize); - if (rc) { - fprintf(stderr, "Unable to set stack size of default thread attr\n"); - exit(1); - } -#endif /* 0 */ -#endif /* !KERNEL && !SIMULATE */ rc = rf_mutex_init(&configureMutex); if (rc) { RF_ERRORMSG3("Unable to init mutex file %s line %d rc=%d\n", __FILE__, @@ -863,14 +245,9 @@ static void rf_UnconfigureArray() int rf_Shutdown(raidPtr) RF_Raid_t *raidPtr; { -#if !defined(__NetBSD) && !defined(_KERNEL) - int rc; -#endif int r,c; -#if defined(__NetBSD__) && defined(_KERNEL) struct proc *p; -#endif if (!raidPtr->valid) { RF_ERRORMSG("Attempt to shut down unconfigured RAIDframe driver. Aborting shutdown\n"); @@ -896,18 +273,9 @@ int rf_Shutdown(raidPtr) } RF_FREELIST_DO_UNLOCK(rf_rad_freelist); -#if !defined(KERNEL) && !defined(SIMULATE) - rf_PrintThroughputStats(raidPtr); -#endif /* !KERNEL && !SIMULATE */ - raidPtr->valid = 0; -#if !defined(KERNEL) && !defined(SIMULATE) - rf_TerminateDiskQueues(raidPtr); /* tell all disk queues to release any waiting threads */ - rf_ShutdownDiskThreads(raidPtr); /* wait for all threads to exit */ -#endif /* !KERNEL && !SIMULATE */ -#if defined(__NetBSD__) && defined(_KERNEL) /* We take this opportunity to close the vnodes like we should.. */ p = raidPtr->proc; /* XXX */ @@ -935,7 +303,6 @@ int rf_Shutdown(raidPtr) } -#endif rf_ShutdownList(&raidPtr->shutdownList); @@ -1027,10 +394,6 @@ int rf_Configure(raidPtr, cfgPtr) */ rf_ConfigureDebug(cfgPtr); DO_INIT_CONFIGURE(rf_ConfigureDebugMem); -#ifdef SIMULATE - rf_default_disk_names(); - DO_INIT_CONFIGURE(rf_DDEventInit); -#endif /* SIMULATE */ DO_INIT_CONFIGURE(rf_ConfigureAccessTrace); DO_INIT_CONFIGURE(rf_ConfigureMapModule); DO_INIT_CONFIGURE(rf_ConfigureReconEvent); @@ -1040,11 +403,9 @@ int rf_Configure(raidPtr, cfgPtr) DO_INIT_CONFIGURE(rf_ConfigureNWayXor); DO_INIT_CONFIGURE(rf_ConfigureStripeLockFreeList); DO_INIT_CONFIGURE(rf_ConfigureMCPair); -#ifndef SIMULATE #if !defined(__NetBSD__) DO_INIT_CONFIGURE(rf_ConfigureCamLayer); #endif -#endif /* !SIMULATE */ DO_INIT_CONFIGURE(rf_ConfigureDAGs); DO_INIT_CONFIGURE(rf_ConfigureDAGFuncs); DO_INIT_CONFIGURE(rf_ConfigureDebugPrint); @@ -1062,15 +423,11 @@ int rf_Configure(raidPtr, cfgPtr) */ /* XXX this clearing should be moved UP to outside of here.... that, or rf_Configure() needs to take more arguments... XXX */ -#if defined(__NetBSD__) && defined(_KERNEL) unit = raidPtr->raidid; p = raidPtr->proc; /* XXX save these... */ -#endif bzero((char *)raidPtr, sizeof(RF_Raid_t)); -#if defined(__NetBSD__) && defined(_KERNEL) raidPtr->raidid = unit; raidPtr->proc = p; /* XXX and then recover them..*/ -#endif DO_RAID_MUTEX(&raidPtr->mutex); /* set up the cleanup list. Do this after ConfigureDebug so that value of memDebug will be set */ @@ -1094,7 +451,6 @@ int rf_Configure(raidPtr, cfgPtr) raidPtr->numCol = cfgPtr->numCol; raidPtr->numSpare = cfgPtr->numSpare; -#if defined(__NetBSD__) && defined(_KERNEL) /* XXX we don't even pretend to support more than one row in the kernel... */ if (raidPtr->numRow != 1) { @@ -1102,7 +458,6 @@ int rf_Configure(raidPtr, cfgPtr) DO_RAID_FAIL(); return(EINVAL); } -#endif @@ -1125,10 +480,6 @@ int rf_Configure(raidPtr, cfgPtr) } DO_RAID_INIT_CONFIGURE(rf_ConfigureEngine); -#if !defined(KERNEL) && !defined(SIMULATE) - DO_RAID_INIT_CONFIGURE(rf_InitThroughputStats); -#endif /* !KERNEL && !SIMULATE */ - DO_RAID_INIT_CONFIGURE(rf_ConfigureStripeLocks); DO_RAID_COND(&raidPtr->outstandingCond); @@ -1146,9 +497,6 @@ int rf_Configure(raidPtr, cfgPtr) DO_RAID_INIT_CONFIGURE(rf_ConfigureSpareDisks); /* do this after ConfigureDisks & ConfigureSpareDisks to be sure dev no. is set */ DO_RAID_INIT_CONFIGURE(rf_ConfigureDiskQueues); -#ifndef KERNEL - DO_RAID_INIT_CONFIGURE(rf_ConfigureDiskThreads); -#endif /* !KERNEL */ DO_RAID_INIT_CONFIGURE(rf_ConfigureLayout); @@ -1280,9 +628,6 @@ RF_RaidAccessDesc_t *rf_AllocRaidAccDesc( desc->cleanupList = NULL; rf_MakeAllocList(desc->cleanupList); rf_get_threadid(desc->tid); -#ifdef SIMULATE - desc->owner = rf_GetCurrentOwner(); -#endif /* SIMULATE */ return(desc); } @@ -1292,10 +637,6 @@ void rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *desc) RF_ASSERT(desc); -#if !defined(KERNEL) && !defined(SIMULATE) - rf_StopThroughputStats(raidPtr); -#endif /* !KERNEL && !SIMULATE */ - rf_FreeAllocList(desc->cleanupList); RF_FREELIST_FREE_CLEAN_NOUNLOCK(rf_rad_freelist,desc,next,clean_rad); raidPtr->nAccOutstanding--; @@ -1305,13 +646,6 @@ void rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *desc) RF_FREELIST_DO_UNLOCK(rf_rad_freelist); } -#ifdef JIMZ -#define THREAD_NUMDESC 1024 -#define THREAD_NUM 600 -static RF_RaidAccessDesc_t *dest_hist[THREAD_NUM*THREAD_NUMDESC]; -int jimz_access_num[THREAD_NUM]; -#endif /* JIMZ */ - /********************************************************************* * Main routine for performing an access. * Accesses are retried until a DAG can not be selected. This occurs @@ -1341,14 +675,10 @@ bp_in is a buf pointer. void * to facilitate ignoring it outside the kernel int tid; RF_RaidAccessDesc_t *desc; caddr_t lbufPtr = bufPtr; -#ifdef KERNEL struct buf *bp = (struct buf *) bp_in; #if DFSTRACE > 0 struct { RF_uint64 raidAddr; int numBlocks; char type;} dfsrecord; #endif /* DFSTRACE > 0 */ -#else /* KERNEL */ - void *bp = bp_in; -#endif /* KERNEL */ raidAddress += rf_raidSectorOffset; @@ -1387,7 +717,6 @@ bp_in is a buf pointer. void * to facilitate ignoring it outside the kernel printf("DoAccess: raid addr %lu too large to access %lu sectors. Max legal addr is %lu\n", (u_long)raidAddress,(u_long)numBlocks,(u_long)raidPtr->totalSectors); -#ifdef KERNEL if (type == RF_IO_TYPE_READ) { IO_BUF_ERR(bp, ENOSPC, raidPtr->raidid); return(ENOSPC); @@ -1395,17 +724,8 @@ bp_in is a buf pointer. void * to facilitate ignoring it outside the kernel IO_BUF_ERR(bp, ENOSPC, raidPtr->raidid); return(ENOSPC); } -#elif defined(SIMULATE) - RF_PANIC(); -#else /* SIMULATE */ - return(EIO); -#endif /* SIMULATE */ } -#if !defined(KERNEL) && !defined(SIMULATE) - rf_StartThroughputStats(raidPtr); -#endif /* !KERNEL && !SIMULATE */ - desc = rf_AllocRaidAccDesc(raidPtr, type, raidAddress, numBlocks, lbufPtr, bp, paramDAG, paramASM, flags, cbF, cbA, raidPtr->Layout.map->states); @@ -1413,35 +733,13 @@ bp_in is a buf pointer. void * to facilitate ignoring it outside the kernel if (desc == NULL) { return(ENOMEM); } -#ifdef JIMZ - dest_hist[(tid*THREAD_NUMDESC)+jimz_access_num[tid]]; jimz_access_num[tid]++; -#endif /* JIMZ */ RF_ETIMER_START(desc->tracerec.tot_timer); desc->async_flag = async_flag; -#ifdef SIMULATE - /* simulator uses paramDesc to continue dag from test function */ - - *paramDesc=desc; - - return(0); -#endif /* SIMULATE */ - rf_ContinueRaidAccess(desc); -#ifndef KERNEL - if (!(flags & RF_DAG_NONBLOCKING_IO)) { - RF_LOCK_MUTEX(desc->mutex); - while (!(desc->flags & RF_DAG_ACCESS_COMPLETE)) { - RF_WAIT_COND(desc->cond, desc->mutex); - } - RF_UNLOCK_MUTEX(desc->mutex); - rf_FreeRaidAccDesc(desc); - } -#endif /* !KERNEL */ - return(0); } @@ -1484,41 +782,11 @@ int rf_FailDisk( raidPtr->Disks[frow][fcol].status = rf_ds_failed; raidPtr->status[frow] = rf_rs_degraded; RF_UNLOCK_MUTEX(raidPtr->mutex); -#ifdef SIMULATE -#if RF_DEMO > 0 - if (rf_demoMode) { - rf_demo_update_mode (RF_DEMO_DEGRADED); - fail_col = fcol; fail_row = frow; - fail_time = rf_CurTime(); /* XXX */ - if (initRecon) - delayed_recon = RF_TRUE; - } - else { - if (initRecon) - rf_ReconstructFailedDisk(raidPtr, frow, fcol); - } -#else /* RF_DEMO > 0 */ - if (initRecon) - rf_ReconstructFailedDisk(raidPtr, frow, fcol); -#endif /* RF_DEMO > 0 */ -#else /* SIMULATE */ if (initRecon) rf_ReconstructFailedDisk(raidPtr, frow, fcol); -#endif /* SIMULATE */ return(0); } -#ifdef SIMULATE -extern RF_Owner_t recon_owner; - -void rf_ScheduleContinueReconstructFailedDisk(reconDesc) - RF_RaidReconDesc_t *reconDesc; -{ - rf_DDEventRequest(rf_CurTime(), rf_ContinueReconstructFailedDisk, - (void *) reconDesc, recon_owner, -4, -4, reconDesc->raidPtr, NULL); -} -#endif /* SIMULATE */ - /* releases a thread that is waiting for the array to become quiesced. * access_suspend_mutex should be locked upon calling this */ @@ -1535,13 +803,7 @@ void rf_SignalQuiescenceLock(raidPtr, reconDesc) raidPtr->access_suspend_release = 1; if (raidPtr->waiting_for_quiescence) { -#ifndef SIMULATE SIGNAL_QUIESCENT_COND(raidPtr); -#else /* !SIMULATE */ - if (reconDesc) { - rf_ScheduleContinueReconstructFailedDisk(reconDesc); - } -#endif /* !SIMULATE */ } } @@ -1556,7 +818,6 @@ int rf_SuspendNewRequestsAndWait(raidPtr) raidPtr->accesses_suspended++; raidPtr->waiting_for_quiescence = (raidPtr->accs_in_flight == 0) ? 0 : 1; -#ifndef SIMULATE if (raidPtr->waiting_for_quiescence) { raidPtr->access_suspend_release=0; while (!raidPtr->access_suspend_release) { @@ -1566,7 +827,6 @@ int rf_SuspendNewRequestsAndWait(raidPtr) } } printf("Quiesence reached..\n"); -#endif /* !SIMULATE */ RF_UNLOCK_MUTEX(raidPtr->access_suspend_mutex); return (raidPtr->waiting_for_quiescence); @@ -1646,7 +906,7 @@ static void rf_ConfigureDebug(cfgPtr) #define TIMEVAL_TO_US(t) (((long) t.tv_sec) * 1000000L + (long) t.tv_usec) -#if !defined(KERNEL) && !defined(SIMULATE) +#if !defined(_KERNEL) && !defined(SIMULATE) /* * Throughput stats currently only used in user-level RAIDframe |
