Home | History | Annotate | Line # | Download | only in raidframe
rf_dagutils.h revision 1.11
      1 /*	$NetBSD: rf_dagutils.h,v 1.11 2004/03/18 16:40:05 oster Exp $	*/
      2 /*
      3  * Copyright (c) 1995 Carnegie-Mellon University.
      4  * All rights reserved.
      5  *
      6  * Author: Mark Holland, William V. Courtright II
      7  *
      8  * Permission to use, copy, modify and distribute this software and
      9  * its documentation is hereby granted, provided that both the copyright
     10  * notice and this permission notice appear in all copies of the
     11  * software, derivative works or modified versions, and any portions
     12  * thereof, and that both notices appear in supporting documentation.
     13  *
     14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17  *
     18  * Carnegie Mellon requests users of this software to return to
     19  *
     20  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21  *  School of Computer Science
     22  *  Carnegie Mellon University
     23  *  Pittsburgh PA 15213-3890
     24  *
     25  * any improvements or extensions that they make and grant Carnegie the
     26  * rights to redistribute these changes.
     27  */
     28 
     29 /*************************************************************************
     30  *
     31  * rf_dagutils.h -- header file for utility routines for manipulating DAGs
     32  *
     33  *************************************************************************/
     34 
     35 
     36 #include <dev/raidframe/raidframevar.h>
     37 
     38 #include "rf_dagfuncs.h"
     39 #include "rf_general.h"
     40 
     41 #ifndef _RF__RF_DAGUTILS_H_
     42 #define _RF__RF_DAGUTILS_H_
     43 
     44 struct RF_RedFuncs_s {
     45 	int     (*regular) (RF_DagNode_t *);
     46 	char   *RegularName;
     47 	int     (*simple) (RF_DagNode_t *);
     48 	char   *SimpleName;
     49 };
     50 
     51 typedef struct RF_FuncList_s {
     52 	RF_VoidFuncPtr fp;
     53    	struct RF_FuncList_s *next;
     54 } RF_FuncList_t;
     55 
     56 extern const RF_RedFuncs_t rf_xorFuncs;
     57 extern const RF_RedFuncs_t rf_xorRecoveryFuncs;
     58 
     59 void
     60 rf_InitNode(RF_DagNode_t * node, RF_NodeStatus_t initstatus,
     61 	    int commit,
     62 	    int (*doFunc) (RF_DagNode_t * node),
     63 	    int (*undoFunc) (RF_DagNode_t * node),
     64 	    int (*wakeFunc) (RF_DagNode_t * node, int status),
     65 	    int nSucc, int nAnte, int nParam, int nResult,
     66 	    RF_DagHeader_t * hdr, char *name, RF_AllocListElem_t * alist);
     67 
     68 void    rf_FreeDAG(RF_DagHeader_t * dag_h);
     69 
     70 int     rf_ConfigureDAGs(RF_ShutdownList_t ** listp);
     71 
     72 RF_DagHeader_t *rf_AllocDAGHeader(void);
     73 
     74 void    rf_FreeDAGHeader(RF_DagHeader_t * dh);
     75 
     76 RF_DagNode_t *rf_AllocDAGNode(void);
     77 void rf_FreeDAGNode(RF_DagNode_t *);
     78 
     79 RF_DagList_t *rf_AllocDAGList(void);
     80 void rf_FreeDAGList(RF_DagList_t *);
     81 
     82 RF_FuncList_t *rf_AllocFuncList(void);
     83 void rf_FreeFuncList(RF_FuncList_t *);
     84 
     85 void   *rf_AllocBuffer(RF_Raid_t * raidPtr,
     86 		       RF_PhysDiskAddr_t * pda,
     87 		       RF_AllocListElem_t * allocList);
     88 
     89 char   *rf_NodeStatusString(RF_DagNode_t * node);
     90 
     91 void    rf_PrintNodeInfoString(RF_DagNode_t * node);
     92 
     93 int     rf_AssignNodeNums(RF_DagHeader_t * dag_h);
     94 
     95 int     rf_RecurAssignNodeNums(RF_DagNode_t * node, int num, int unvisited);
     96 
     97 void    rf_ResetDAGHeaderPointers(RF_DagHeader_t * dag_h,
     98 				  RF_DagHeader_t * newptr);
     99 
    100 void    rf_RecurResetDAGHeaderPointers(RF_DagNode_t * node,
    101 				       RF_DagHeader_t * newptr);
    102 
    103 void    rf_PrintDAGList(RF_DagHeader_t * dag_h);
    104 
    105 int     rf_ValidateDAG(RF_DagHeader_t * dag_h);
    106 
    107 void    rf_redirect_asm(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap);
    108 
    109 void    rf_MapUnaccessedPortionOfStripe(RF_Raid_t * raidPtr,
    110 					RF_RaidLayout_t * layoutPtr,
    111 					RF_AccessStripeMap_t * asmap,
    112 					RF_DagHeader_t * dag_h,
    113 					RF_AccessStripeMapHeader_t ** new_asm_h,
    114 					int *nRodNodes, char **sosBuffer,
    115 					char **eosBuffer,
    116 					RF_AllocListElem_t * allocList);
    117 
    118 int     rf_PDAOverlap(RF_RaidLayout_t * layoutPtr, RF_PhysDiskAddr_t * src,
    119 		      RF_PhysDiskAddr_t * dest);
    120 
    121 void    rf_GenerateFailedAccessASMs(RF_Raid_t * raidPtr,
    122 				    RF_AccessStripeMap_t * asmap,
    123 				    RF_PhysDiskAddr_t * failedPDA,
    124 				    RF_DagHeader_t * dag_h,
    125 				    RF_AccessStripeMapHeader_t ** new_asm_h,
    126 				    int *nXorBufs, char **rpBufPtr,
    127 				    char *overlappingPDAs,
    128 				    RF_AllocListElem_t * allocList);
    129 
    130 /* flags used by RangeRestrictPDA */
    131 #define RF_RESTRICT_NOBUFFER 0
    132 #define RF_RESTRICT_DOBUFFER 1
    133 
    134 void    rf_RangeRestrictPDA(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * src,
    135 			    RF_PhysDiskAddr_t * dest, int dobuffer,
    136 			    int doraidaddr);
    137 
    138 int     rf_compute_workload_shift(RF_Raid_t * raidPtr,
    139 				  RF_PhysDiskAddr_t * pda);
    140 void    rf_SelectMirrorDiskIdle(RF_DagNode_t * node);
    141 void    rf_SelectMirrorDiskPartition(RF_DagNode_t * node);
    142 
    143 #endif				/* !_RF__RF_DAGUTILS_H_ */
    144