Home | History | Annotate | Line # | Download | only in raidframe
rf_dagutils.h revision 1.1
      1 /*	$NetBSD: rf_dagutils.h,v 1.1 1998/11/13 04:20:28 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  * :
     37  * Log: rf_dagutils.h,v
     38  * Revision 1.19  1996/07/22 19:52:16  jimz
     39  * switched node params to RF_DagParam_t, a union of
     40  * a 64-bit int and a void *, for better portability
     41  * attempted hpux port, but failed partway through for
     42  * lack of a single C compiler capable of compiling all
     43  * source files
     44  *
     45  * Revision 1.18  1996/07/15  17:22:18  jimz
     46  * nit-pick code cleanup
     47  * resolve stdlib problems on DEC OSF
     48  *
     49  * Revision 1.17  1996/06/10  11:55:47  jimz
     50  * Straightened out some per-array/not-per-array distinctions, fixed
     51  * a couple bugs related to confusion. Added shutdown lists. Removed
     52  * layout shutdown function (now subsumed by shutdown lists).
     53  *
     54  * Revision 1.16  1996/06/06  17:27:46  jimz
     55  * added another select mirror func (partitioning), changed names so dag
     56  * creation routines can use the appropriate one
     57  *
     58  * fixed old idle mirror func to pick closest arm if queue lengths are equal
     59  *
     60  * Revision 1.15  1996/06/03  23:28:26  jimz
     61  * more bugfixes
     62  * check in tree to sync for IPDS runs with current bugfixes
     63  * there still may be a problem with threads in the script test
     64  * getting I/Os stuck- not trivially reproducible (runs ~50 times
     65  * in a row without getting stuck)
     66  *
     67  * Revision 1.14  1996/05/27  18:56:37  jimz
     68  * more code cleanup
     69  * better typing
     70  * compiles in all 3 environments
     71  *
     72  * Revision 1.13  1996/05/24  22:17:04  jimz
     73  * continue code + namespace cleanup
     74  * typed a bunch of flags
     75  *
     76  * Revision 1.12  1996/05/24  04:28:55  jimz
     77  * release cleanup ckpt
     78  *
     79  * Revision 1.11  1996/05/23  21:46:35  jimz
     80  * checkpoint in code cleanup (release prep)
     81  * lots of types, function names have been fixed
     82  *
     83  * Revision 1.10  1996/05/23  00:33:23  jimz
     84  * code cleanup: move all debug decls to rf_options.c, all extern
     85  * debug decls to rf_options.h, all debug vars preceded by rf_
     86  *
     87  * Revision 1.9  1996/05/18  19:51:34  jimz
     88  * major code cleanup- fix syntax, make some types consistent,
     89  * add prototypes, clean out dead code, et cetera
     90  *
     91  * Revision 1.8  1996/05/08  21:01:24  jimz
     92  * fixed up enum type names that were conflicting with other
     93  * enums and function names (ie, "panic")
     94  * future naming trends will be towards RF_ and rf_ for
     95  * everything raidframe-related
     96  *
     97  * Revision 1.7  1996/05/03  19:55:27  wvcii
     98  * added misc routines from old dag creation files
     99  *
    100  * Revision 1.6  1995/12/01  15:57:28  root
    101  * added copyright info
    102  *
    103  * Revision 1.5  1995/11/07  16:21:36  wvcii
    104  * modified InitNode and InitNodeFromBuf prototypes
    105  *
    106  */
    107 
    108 #include "rf_types.h"
    109 #include "rf_dagfuncs.h"
    110 #include "rf_general.h"
    111 
    112 #ifndef _RF__RF_DAGUTILS_H_
    113 #define _RF__RF_DAGUTILS_H_
    114 
    115 struct RF_RedFuncs_s {
    116   int   (*regular)(RF_DagNode_t *);
    117   char   *RegularName;
    118   int   (*simple)(RF_DagNode_t *);
    119   char   *SimpleName;
    120 };
    121 
    122 extern RF_RedFuncs_t rf_xorFuncs;
    123 extern RF_RedFuncs_t rf_xorRecoveryFuncs;
    124 
    125 void rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus,
    126 	      int commit,
    127 	      int (*doFunc)(RF_DagNode_t *node),
    128 	      int (*undoFunc)(RF_DagNode_t *node),
    129 	      int (*wakeFunc)(RF_DagNode_t *node, int status),
    130 	      int nSucc, int nAnte, int nParam, int nResult,
    131 	      RF_DagHeader_t *hdr, char *name, RF_AllocListElem_t *alist);
    132 
    133 void rf_FreeDAG(RF_DagHeader_t *dag_h);
    134 
    135 RF_PropHeader_t *rf_MakePropListEntry(RF_DagHeader_t *dag_h, int resultNum,
    136 	int paramNum, RF_PropHeader_t *next, RF_AllocListElem_t *allocList);
    137 
    138 int rf_ConfigureDAGs(RF_ShutdownList_t **listp);
    139 
    140 RF_DagHeader_t *rf_AllocDAGHeader(void);
    141 
    142 void rf_FreeDAGHeader(RF_DagHeader_t *dh);
    143 
    144 void *rf_AllocBuffer(RF_Raid_t *raidPtr, RF_DagHeader_t *dag_h,
    145 	RF_PhysDiskAddr_t *pda, RF_AllocListElem_t *allocList);
    146 
    147 char *rf_NodeStatusString(RF_DagNode_t *node);
    148 
    149 void rf_PrintNodeInfoString(RF_DagNode_t *node);
    150 
    151 int rf_AssignNodeNums(RF_DagHeader_t *dag_h);
    152 
    153 int rf_RecurAssignNodeNums(RF_DagNode_t *node, int num, int unvisited);
    154 
    155 void rf_ResetDAGHeaderPointers(RF_DagHeader_t *dag_h, RF_DagHeader_t *newptr);
    156 
    157 void rf_RecurResetDAGHeaderPointers(RF_DagNode_t *node, RF_DagHeader_t *newptr);
    158 
    159 void rf_PrintDAGList(RF_DagHeader_t *dag_h);
    160 
    161 int rf_ValidateDAG(RF_DagHeader_t *dag_h);
    162 
    163 void rf_redirect_asm(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap);
    164 
    165 void rf_MapUnaccessedPortionOfStripe(RF_Raid_t *raidPtr,
    166 	RF_RaidLayout_t *layoutPtr,
    167 	RF_AccessStripeMap_t *asmap, RF_DagHeader_t *dag_h,
    168 	RF_AccessStripeMapHeader_t **new_asm_h, int *nRodNodes, char **sosBuffer,
    169 	char **eosBuffer, RF_AllocListElem_t *allocList);
    170 
    171 int rf_PDAOverlap(RF_RaidLayout_t *layoutPtr, RF_PhysDiskAddr_t *src,
    172 	RF_PhysDiskAddr_t *dest);
    173 
    174 void rf_GenerateFailedAccessASMs(RF_Raid_t *raidPtr,
    175 	RF_AccessStripeMap_t *asmap, RF_PhysDiskAddr_t *failedPDA,
    176 	RF_DagHeader_t *dag_h, RF_AccessStripeMapHeader_t **new_asm_h,
    177 	int *nXorBufs, char **rpBufPtr, char *overlappingPDAs,
    178 	RF_AllocListElem_t *allocList);
    179 
    180 /* flags used by RangeRestrictPDA */
    181 #define RF_RESTRICT_NOBUFFER 0
    182 #define RF_RESTRICT_DOBUFFER 1
    183 
    184 void rf_RangeRestrictPDA(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *src,
    185 	RF_PhysDiskAddr_t *dest, int dobuffer, int doraidaddr);
    186 
    187 int rf_compute_workload_shift(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda);
    188 void rf_SelectMirrorDiskIdle(RF_DagNode_t *node);
    189 void rf_SelectMirrorDiskPartition(RF_DagNode_t *node);
    190 
    191 #endif /* !_RF__RF_DAGUTILS_H_ */
    192