⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rf_reconstruct.c

📁 RAIDFrame是个非常好的磁盘阵列RAID仿真工具
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. * * Author: Mark Holland * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU *  School of Computer Science *  Carnegie Mellon University *  Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. *//************************************************************ * * rf_reconstruct.c -- code to perform on-line reconstruction * ************************************************************//* * $Locker:  $ * $Log: rf_reconstruct.c,v $ * Revision 1.65  1996/08/06  22:24:56  jimz * get rid of sys/buf.h on linux * * Revision 1.64  1996/07/30  04:28:53  jimz * include rf_types.h first * * Revision 1.63  1996/07/27  23:36:08  jimz * Solaris port of simulator * * Revision 1.62  1996/07/17  21:00:58  jimz * clean up timer interface, tracing * * Revision 1.61  1996/07/15  05:40:41  jimz * some recon datastructure cleanup * better handling of multiple failures * added undocumented double-recon test * * Revision 1.60  1996/07/15  02:57:18  jimz * added debugging (peek at first couple bytes of recon buffers * as they go by) * * Revision 1.59  1996/07/13  00:00:59  jimz * sanitized generalized reconstruction architecture * cleaned up head sep, rbuf problems * * Revision 1.58  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.57  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.56  1996/06/17  03:24:59  jimz * include shutdown.h for define of now-macroized ShutdownCreate * * Revision 1.55  1996/06/11  10:58:36  jimz * get rid of simulator-testcode artifacts * add generic ReconDoneProc mechanism instead * * Revision 1.54  1996/06/10  14:18:58  jimz * move user, throughput stats into per-array structure * * Revision 1.53  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.52  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.51  1996/06/07  22:26:27  jimz * type-ify which_ru (RF_ReconUnitNum_t) * * Revision 1.50  1996/06/07  21:33:04  jimz * begin using consistent types for sector numbers, * stripe numbers, row+col numbers, recon unit numbers * * Revision 1.49  1996/06/06  01:24:36  jimz * don't get rid of reconCtrlPtr until we're done with it * * Revision 1.48  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.47  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.46  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.45  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.44  1996/05/30  23:22:16  jimz * bugfixes of serialization, timing problems * more cleanup * * Revision 1.43  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.42  1996/05/27  18:56:37  jimz * more code cleanup * better typing * compiles in all 3 environments * * Revision 1.41  1996/05/24  22:17:04  jimz * continue code + namespace cleanup * typed a bunch of flags * * Revision 1.40  1996/05/24  04:40:40  jimz * don't do demoMode stuff in kernel * * Revision 1.39  1996/05/24  01:59:45  jimz * another checkpoint in code cleanup for release * time to sync kernel tree * * Revision 1.38  1996/05/23  21:46:35  jimz * checkpoint in code cleanup (release prep) * lots of types, function names have been fixed * * Revision 1.37  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.36  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.35  1996/05/01  16:28:16  jimz * don't include ccmn.h * * Revision 1.34  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.33  1995/12/06  15:05:09  root * added copyright info * * Revision 1.32  1995/11/17  19:04:11  wvcii * added prototyping to ComputePSDiskOffsets * prow and pcol now type int (were u_int) * * Revision 1.31  1995/11/17  01:39:35  amiri * isolated some demo related stuff * * Revision 1.30  1995/10/18  19:33:14  amiri * removed fflush (stdin/stdout) calls from ReconstructFailedDisk * * Revision 1.29  1995/10/11  10:20:33  jimz * #if 0'd problem code for sigmetrics * * Revision 1.28  1995/10/10  23:18:15  amiri * added fflushes to stdin/stdout before requesting * input in demo mode. * * Revision 1.27  1995/10/10  19:24:47  amiri * took out update_mode (for demo) from * KERNEL source. * * Revision 1.26  1995/10/09  23:35:48  amiri * added support for more meters in recon. demo * * Revision 1.25  1995/07/03  18:14:30  holland * changed the way the number of floating recon bufs & * the head sep limit get set * * Revision 1.24  1995/07/02  15:07:42  holland * bug fixes related to getting distributed sparing numbers * * Revision 1.23  1995/06/23  13:36:36  robby * updeated to prototypes in rf_layout.h **/#include "rf_types.h"#include <sys/time.h>#ifndef LINUX#include <sys/buf.h>#endif /* !LINUX */#include <sys/errno.h>#include "rf_raid.h"#include "rf_reconutil.h"#include "rf_revent.h"#include "rf_reconbuffer.h"#include "rf_threadid.h"#include "rf_acctrace.h"#include "rf_etimer.h"#include "rf_dag.h"#include "rf_desc.h"#include "rf_general.h"#include "rf_freelist.h"#include "rf_debugprint.h"#include "rf_driver.h"#include "rf_utils.h"#include "rf_cpuutil.h"#include "rf_shutdown.h"#include "rf_sys.h"#if RF_DEMO > 0#include "rf_demo.h"#endif /* RF_DEMO > 0 */#ifdef KERNEL#include "rf_kintf.h"#endif /* KERNEL *//* setting these to -1 causes them to be set to their default values if not set by debug options */#define Dprintf(s)         if (rf_reconDebug) rf_debug_printf(s,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)#define Dprintf1(s,a)         if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),NULL,NULL,NULL,NULL,NULL,NULL,NULL)#define Dprintf2(s,a,b)       if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),NULL,NULL,NULL,NULL,NULL,NULL)#define Dprintf3(s,a,b,c)     if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),NULL,NULL,NULL,NULL,NULL)#define Dprintf4(s,a,b,c,d)   if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),NULL,NULL,NULL,NULL)#define Dprintf5(s,a,b,c,d,e) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),NULL,NULL,NULL)#define Dprintf6(s,a,b,c,d,e,f) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),(void *)((unsigned long)f),NULL,NULL)#define Dprintf7(s,a,b,c,d,e,f,g) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),(void *)((unsigned long)f),(void *)((unsigned long)g),NULL)#define Dprintf8(s,a,b,c,d,e,f,g,h) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),(void *)((unsigned long)f),(void *)((unsigned long)g),(void *)((unsigned long)h))#define DDprintf1(s,a)         if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),NULL,NULL,NULL,NULL,NULL,NULL,NULL)#define DDprintf2(s,a,b)       if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),NULL,NULL,NULL,NULL,NULL,NULL)#define DDprintf3(s,a,b,c)     if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),NULL,NULL,NULL,NULL,NULL)#define DDprintf4(s,a,b,c,d)   if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),NULL,NULL,NULL,NULL)#define DDprintf5(s,a,b,c,d,e) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),NULL,NULL,NULL)#define DDprintf6(s,a,b,c,d,e,f) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),(void *)((unsigned long)f),NULL,NULL)#define DDprintf7(s,a,b,c,d,e,f,g) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),(void *)((unsigned long)f),(void *)((unsigned long)g),NULL)#define DDprintf8(s,a,b,c,d,e,f,g,h) if (rf_reconDebug) rf_debug_printf(s,(void *)((unsigned long)a),(void *)((unsigned long)b),(void *)((unsigned long)c),(void *)((unsigned long)d),(void *)((unsigned long)e),(void *)((unsigned long)f),(void *)((unsigned long)g),(void *)((unsigned long)h))#ifdef KERNELstatic RF_Thread_t      recon_thr_handle;static int              recon_thread_initialized = 0;#endif /* KERNEL */static RF_FreeList_t *rf_recond_freelist;#define RF_MAX_FREE_RECOND  4#define RF_RECOND_INC       1static RF_RaidReconDesc_t *AllocRaidReconDesc(RF_Raid_t *raidPtr,	RF_RowCol_t row, RF_RowCol_t col, RF_RaidDisk_t *spareDiskPtr,	int numDisksDone, RF_RowCol_t srow, RF_RowCol_t scol);static void FreeReconDesc(RF_RaidReconDesc_t *reconDesc);static int ProcessReconEvent(RF_Raid_t *raidPtr, RF_RowCol_t frow,	RF_ReconEvent_t *event);static int IssueNextReadRequest(RF_Raid_t *raidPtr, RF_RowCol_t row,	RF_RowCol_t col);static int TryToRead(RF_Raid_t *raidPtr, RF_RowCol_t row, RF_RowCol_t col);static int ComputePSDiskOffsets(RF_Raid_t *raidPtr, RF_StripeNum_t psid,	RF_RowCol_t row, RF_RowCol_t col, RF_SectorNum_t *outDiskOffset,	RF_SectorNum_t *outFailedDiskSectorOffset, RF_RowCol_t *spRow,	RF_RowCol_t *spCol, RF_SectorNum_t *spOffset);static int IssueNextWriteRequest(RF_Raid_t *raidPtr, RF_RowCol_t row);static int ReconReadDoneProc(void *arg, int status);static int ReconWriteDoneProc(void *arg, int status);static void CheckForNewMinHeadSep(RF_Raid_t *raidPtr, RF_RowCol_t row,	RF_HeadSepLimit_t hsCtr);static int CheckHeadSeparation(RF_Raid_t *raidPtr, RF_PerDiskReconCtrl_t *ctrl,	RF_RowCol_t row, RF_RowCol_t col, RF_HeadSepLimit_t hsCtr,	RF_ReconUnitNum_t which_ru);static int CheckForcedOrBlockedReconstruction(RF_Raid_t *raidPtr,	RF_ReconParityStripeStatus_t *pssPtr, RF_PerDiskReconCtrl_t *ctrl,	RF_RowCol_t row, RF_RowCol_t col, RF_StripeNum_t psid,	RF_ReconUnitNum_t which_ru);static void ForceReconReadDoneProc(void *arg, int status);struct RF_ReconDoneProc_s {  void                (*proc)();  void                 *arg;  RF_ReconDoneProc_t   *next;};static RF_FreeList_t *rf_rdp_freelist;#define RF_MAX_FREE_RDP 4#define RF_RDP_INC      1static void SignalReconDone(RF_Raid_t *raidPtr){  RF_ReconDoneProc_t *p;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -