1 /* $OpenBSD: rf_desc.h,v 1.6 2002/12/16 07:01:03 tdeval Exp $ */ 2 /* $NetBSD: rf_desc.h,v 1.5 2000/01/09 00:00:18 oster Exp $ */ 3 4 /* 5 * Copyright (c) 1995 Carnegie-Mellon University. 6 * All rights reserved. 7 * 8 * Author: Mark Holland 9 * 10 * Permission to use, copy, modify and distribute this software and 11 * its documentation is hereby granted, provided that both the copyright 12 * notice and this permission notice appear in all copies of the 13 * software, derivative works or modified versions, and any portions 14 * thereof, and that both notices appear in supporting documentation. 15 * 16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 19 * 20 * Carnegie Mellon requests users of this software to return to 21 * 22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 23 * School of Computer Science 24 * Carnegie Mellon University 25 * Pittsburgh PA 15213-3890 26 * 27 * any improvements or extensions that they make and grant Carnegie the 28 * rights to redistribute these changes. 29 */ 30 31 #ifndef _RF__RF_DESC_H_ 32 #define _RF__RF_DESC_H_ 33 34 #include "rf_archs.h" 35 #include "rf_types.h" 36 #include "rf_etimer.h" 37 #include "rf_dag.h" 38 39 struct RF_RaidReconDesc_s { 40 RF_Raid_t *raidPtr; /* Raid device descriptor. */ 41 RF_RowCol_t row; /* Row of failed disk. */ 42 RF_RowCol_t col; /* Col of failed disk. */ 43 int state; /* 44 * How far along the reconstruction 45 * operation has gotten. 46 */ 47 RF_RaidDisk_t *spareDiskPtr; /* 48 * Describes target disk for recon. 49 * (not used in dist sparing) 50 */ 51 int numDisksDone; /* 52 * The number of surviving disks that 53 * have completed their work. 54 */ 55 RF_RowCol_t srow; /* 56 * Row ID of the spare disk. 57 * (not used in dist sparing) 58 */ 59 RF_RowCol_t scol; /* 60 * Col ID of the spare disk. 61 * (not used in dist sparing) 62 */ 63 /* 64 * Prevent recon from hogging CPU 65 */ 66 RF_Etimer_t recon_exec_timer; 67 RF_uint64 reconExecTimerRunning; 68 RF_uint64 reconExecTicks; 69 RF_uint64 maxReconExecTicks; 70 71 #if RF_RECON_STATS > 0 72 RF_uint64 hsStallCount; /* Head sep stall count. */ 73 RF_uint64 numReconExecDelays; 74 RF_uint64 numReconEventWaits; 75 #endif /* RF_RECON_STATS > 0 */ 76 RF_RaidReconDesc_t *next; 77 }; 78 79 struct RF_RaidAccessDesc_s { 80 RF_Raid_t *raidPtr; /* Raid device descriptor. */ 81 RF_IoType_t type; /* Read or write. */ 82 RF_RaidAddr_t raidAddress; /* 83 * Starting address in raid address 84 * space. 85 */ 86 RF_SectorCount_t numBlocks; /* 87 * Number of blocks (sectors) 88 * to transfer. 89 */ 90 RF_StripeCount_t numStripes; /* 91 * Number of stripes involved in 92 * access. 93 */ 94 caddr_t bufPtr; /* Pointer to data buffer. */ 95 RF_RaidAccessFlags_t flags; /* Flags controlling operation. */ 96 int state; /* 97 * Index into states telling how far 98 * along the RAID operation has gotten. 99 */ 100 RF_AccessState_t *states; /* Array of states to be run. */ 101 int status; /* 102 * Pass/fail status of the last 103 * operation. 104 */ 105 RF_DagList_t *dagArray; /* 106 * Array of DAG lists, one list 107 * per stripe. 108 */ 109 RF_AccessStripeMapHeader_t *asmap; /* The asm for this I/O. */ 110 void *bp; /* 111 * Buffer pointer for this RAID acc. 112 * Ignored outside the kernel. 113 */ 114 RF_DagHeader_t **paramDAG; /* 115 * Allows the DAG to be returned to 116 * the caller after I/O completion. 117 */ 118 RF_AccessStripeMapHeader_t **paramASM; /* 119 * Allows the ASM to be 120 * returned to the caller 121 * after I/O completion. 122 */ 123 RF_AccTraceEntry_t tracerec; /* 124 * Perf monitoring information for a 125 * user access (not for dag stats). 126 */ 127 void (*callbackFunc) (RF_CBParam_t); 128 /* Callback function for this I/O. */ 129 void *callbackArg; /* Arg to give to callback func. */ 130 131 RF_AllocListElem_t *cleanupList; /* 132 * Memory to be freed at the 133 * end of the access. 134 */ 135 136 RF_RaidAccessDesc_t *next; 137 RF_RaidAccessDesc_t *head; 138 139 int numPending; 140 141 RF_DECLARE_MUTEX( mutex ); /* 142 * These are used to implement 143 * blocking I/O. 144 */ 145 RF_DECLARE_COND( cond ); 146 int async_flag; 147 148 RF_Etimer_t timer; /* Used for timing this access. */ 149 }; 150 151 #endif /* ! _RF__RF_DESC_H_ */