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

📄 rf_parityloggingdags.c

📁 RAIDFrame是个非常好的磁盘阵列RAID仿真工具
💻 C
📖 第 1 页 / 共 3 页
字号:
/* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. * * Author: William V. Courtright II * * 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. *//* * $Log: rf_parityloggingdags.c,v $ * Revision 1.27  1996/07/28  20:31:39  jimz * i386netbsd port * true/false fixup * * Revision 1.26  1996/07/27  23:36:08  jimz * Solaris port of simulator * * Revision 1.25  1996/07/22  19:52:16  jimz * switched node params to RF_DagParam_t, a union of * a 64-bit int and a void *, for better portability * attempted hpux port, but failed partway through for * lack of a single C compiler capable of compiling all * source files * * Revision 1.24  1996/06/11  13:47:21  jimz * fix up for in-kernel compilation * * Revision 1.23  1996/06/07  22:26:27  jimz * type-ify which_ru (RF_ReconUnitNum_t) * * Revision 1.22  1996/06/07  21:33:04  jimz * begin using consistent types for sector numbers, * stripe numbers, row+col numbers, recon unit numbers * * Revision 1.21  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.20  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.19  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.18  1996/05/27  18:56:37  jimz * more code cleanup * better typing * compiles in all 3 environments * * Revision 1.17  1996/05/24  22:17:04  jimz * continue code + namespace cleanup * typed a bunch of flags * * Revision 1.16  1996/05/24  04:28:55  jimz * release cleanup ckpt * * Revision 1.15  1996/05/23  21:46:35  jimz * checkpoint in code cleanup (release prep) * lots of types, function names have been fixed * * Revision 1.14  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.13  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.12  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.11  1996/05/03  19:42:02  wvcii * added includes for dag library * * Revision 1.10  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.9  1995/12/06  20:55:24  wvcii * added prototyping * fixed bug in dag header numSuccedents count for both small and large dags * * Revision 1.8  1995/11/30  16:08:01  wvcii * added copyright info * * Revision 1.7  1995/11/07  15:29:05  wvcii * reorganized code, adding comments and asserts * dag creation routines now generate term node * encoded commit point, barrier, and antecedence types into dags * * Revision 1.6  1995/09/07  15:52:06  jimz * noop compile when INCLUDE_PARITYLOGGING not defined * * Revision 1.5  1995/06/15  13:51:53  robby * updated some wrong prototypes (after prototyping rf_dagutils.h) * * Revision 1.4  1995/06/09  13:15:05  wvcii * code is now nonblocking * * Revision 1.3  95/05/31  13:09:14  wvcii * code debug *  * Revision 1.2  1995/05/21  15:34:14  wvcii * code debug * * Revision 1.1  95/05/16  14:36:53  wvcii * Initial revision *  * */#include "rf_archs.h"#if RF_INCLUDE_PARITYLOGGING > 0/*  DAGs specific to parity logging are created here */#include "rf_types.h"#include "rf_raid.h"#include "rf_dag.h"#include "rf_dagutils.h"#include "rf_dagfuncs.h"#include "rf_threadid.h"#include "rf_debugMem.h"#include "rf_paritylog.h"#include "rf_memchunk.h"#include "rf_general.h"/****************************************************************************** * * creates a DAG to perform a large-write operation: * *         / Rod \     / Wnd \ * H -- NIL- Rod - NIL - Wnd ------ NIL - T *         \ Rod /     \ Xor - Lpo / * * The writes are not done until the reads complete because if they were done in * parallel, a failure on one of the reads could leave the parity in an inconsistent * state, so that the retry with a new DAG would produce erroneous parity. * * Note:  this DAG has the nasty property that none of the buffers allocated for reading *        old data can be freed until the XOR node fires.  Need to fix this. * * The last two arguments are the number of faults tolerated, and function for the * redundancy calculation. The undo for the redundancy calc is assumed to be null * *****************************************************************************/void rf_CommonCreateParityLoggingLargeWriteDAG(  RF_Raid_t              *raidPtr,  RF_AccessStripeMap_t   *asmap,  RF_DagHeader_t         *dag_h,  void                   *bp,  RF_RaidAccessFlags_t    flags,  RF_AllocListElem_t     *allocList,  int                     nfaults,  int                   (*redFunc)()){  RF_DagNode_t *nodes, *wndNodes, *rodNodes, *syncNode, *xorNode, *lpoNode, *blockNode, *unblockNode, *termNode;  int nWndNodes, nRodNodes, i;  RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout);  RF_AccessStripeMapHeader_t *new_asm_h[2];  int nodeNum, asmNum;  RF_ReconUnitNum_t which_ru;  char *sosBuffer, *eosBuffer;  RF_PhysDiskAddr_t *pda;  RF_StripeNum_t parityStripeID = rf_RaidAddressToParityStripeID(&(raidPtr->Layout), asmap->raidAddress, &which_ru);  if (rf_dagDebug)    printf("[Creating parity-logging large-write DAG]\n");  RF_ASSERT(nfaults == 1); /* this arch only single fault tolerant */  dag_h->creator = "ParityLoggingLargeWriteDAG";  /* alloc the Wnd nodes, the xor node, and the Lpo node */  nWndNodes = asmap->numStripeUnitsAccessed;  RF_CallocAndAdd(nodes, nWndNodes + 6, sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList);  i = 0;  wndNodes    = &nodes[i]; i += nWndNodes;  xorNode     = &nodes[i]; i += 1;  lpoNode     = &nodes[i]; i += 1;  blockNode   = &nodes[i]; i += 1;  syncNode    = &nodes[i]; i += 1;  unblockNode = &nodes[i]; i += 1;  termNode    = &nodes[i]; i += 1;  dag_h->numCommitNodes = nWndNodes + 1;  dag_h->numCommits = 0;  dag_h->numSuccedents = 1;  rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h, new_asm_h, &nRodNodes, &sosBuffer, &eosBuffer, allocList);  if (nRodNodes > 0)    RF_CallocAndAdd(rodNodes, nRodNodes, sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList);  /* begin node initialization */  rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc, NULL, nRodNodes + 1, 0, 0, 0, dag_h, "Nil", allocList);  rf_InitNode(unblockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc, NULL, 1, nWndNodes + 1, 0, 0, dag_h, "Nil", allocList);  rf_InitNode(syncNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc, NULL, nWndNodes + 1, nRodNodes + 1, 0, 0, dag_h, "Nil", allocList);  rf_InitNode(termNode, rf_wait, RF_FALSE, rf_TerminateFunc, rf_TerminateUndoFunc, NULL, 0, 1, 0, 0, dag_h, "Trm", allocList);  /* initialize the Rod nodes */  for (nodeNum = asmNum = 0; asmNum < 2; asmNum++) {    if (new_asm_h[asmNum]) {      pda = new_asm_h[asmNum]->stripeMap->physInfo;      while (pda) {	rf_InitNode(&rodNodes[nodeNum], rf_wait, RF_FALSE, rf_DiskReadFunc,rf_DiskReadUndoFunc,rf_GenericWakeupFunc,1,1,4,0, dag_h, "Rod", allocList);	rodNodes[nodeNum].params[0].p = pda;	rodNodes[nodeNum].params[1].p = pda->bufPtr;	rodNodes[nodeNum].params[2].v = parityStripeID;	rodNodes[nodeNum].params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, 0, 0, which_ru);	nodeNum++;	pda=pda->next;      }    }  }  RF_ASSERT(nodeNum == nRodNodes);  /* initialize the wnd nodes */

⌨️ 快捷键说明

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