rf_dagutils.h revision 1.3 1 /* $NetBSD: rf_dagutils.h,v 1.3 1999/02/05 00:06:08 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 "rf_types.h"
37 #include "rf_dagfuncs.h"
38 #include "rf_general.h"
39
40 #ifndef _RF__RF_DAGUTILS_H_
41 #define _RF__RF_DAGUTILS_H_
42
43 struct RF_RedFuncs_s {
44 int (*regular) (RF_DagNode_t *);
45 char *RegularName;
46 int (*simple) (RF_DagNode_t *);
47 char *SimpleName;
48 };
49
50 extern RF_RedFuncs_t rf_xorFuncs;
51 extern RF_RedFuncs_t rf_xorRecoveryFuncs;
52
53 void
54 rf_InitNode(RF_DagNode_t * node, RF_NodeStatus_t initstatus,
55 int commit,
56 int (*doFunc) (RF_DagNode_t * node),
57 int (*undoFunc) (RF_DagNode_t * node),
58 int (*wakeFunc) (RF_DagNode_t * node, int status),
59 int nSucc, int nAnte, int nParam, int nResult,
60 RF_DagHeader_t * hdr, char *name, RF_AllocListElem_t * alist);
61
62 void rf_FreeDAG(RF_DagHeader_t * dag_h);
63
64 RF_PropHeader_t *rf_MakePropListEntry(RF_DagHeader_t * dag_h, int resultNum,
65 int paramNum, RF_PropHeader_t * next, RF_AllocListElem_t * allocList);
66
67 int rf_ConfigureDAGs(RF_ShutdownList_t ** listp);
68
69 RF_DagHeader_t *rf_AllocDAGHeader(void);
70
71 void rf_FreeDAGHeader(RF_DagHeader_t * dh);
72
73 void *rf_AllocBuffer(RF_Raid_t * raidPtr, RF_DagHeader_t * dag_h,
74 RF_PhysDiskAddr_t * pda, RF_AllocListElem_t * allocList);
75
76 char *rf_NodeStatusString(RF_DagNode_t * node);
77
78 void rf_PrintNodeInfoString(RF_DagNode_t * node);
79
80 int rf_AssignNodeNums(RF_DagHeader_t * dag_h);
81
82 int rf_RecurAssignNodeNums(RF_DagNode_t * node, int num, int unvisited);
83
84 void rf_ResetDAGHeaderPointers(RF_DagHeader_t * dag_h, RF_DagHeader_t * newptr);
85
86 void rf_RecurResetDAGHeaderPointers(RF_DagNode_t * node, RF_DagHeader_t * newptr);
87
88 void rf_PrintDAGList(RF_DagHeader_t * dag_h);
89
90 int rf_ValidateDAG(RF_DagHeader_t * dag_h);
91
92 void rf_redirect_asm(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap);
93
94 void rf_MapUnaccessedPortionOfStripe(RF_Raid_t * raidPtr,
95 RF_RaidLayout_t * layoutPtr,
96 RF_AccessStripeMap_t * asmap, RF_DagHeader_t * dag_h,
97 RF_AccessStripeMapHeader_t ** new_asm_h, int *nRodNodes, char **sosBuffer,
98 char **eosBuffer, RF_AllocListElem_t * allocList);
99
100 int rf_PDAOverlap(RF_RaidLayout_t * layoutPtr, RF_PhysDiskAddr_t * src,
101 RF_PhysDiskAddr_t * dest);
102
103 void rf_GenerateFailedAccessASMs(RF_Raid_t * raidPtr,
104 RF_AccessStripeMap_t * asmap, RF_PhysDiskAddr_t * failedPDA,
105 RF_DagHeader_t * dag_h, RF_AccessStripeMapHeader_t ** new_asm_h,
106 int *nXorBufs, char **rpBufPtr, char *overlappingPDAs,
107 RF_AllocListElem_t * allocList);
108
109 /* flags used by RangeRestrictPDA */
110 #define RF_RESTRICT_NOBUFFER 0
111 #define RF_RESTRICT_DOBUFFER 1
112
113 void rf_RangeRestrictPDA(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * src,
114 RF_PhysDiskAddr_t * dest, int dobuffer, int doraidaddr);
115
116 int rf_compute_workload_shift(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda);
117 void rf_SelectMirrorDiskIdle(RF_DagNode_t * node);
118 void rf_SelectMirrorDiskPartition(RF_DagNode_t * node);
119
120 #endif /* !_RF__RF_DAGUTILS_H_ */
121