rf_desc.h revision 1.1 1 1.1 oster /* $NetBSD: rf_desc.h,v 1.1 1998/11/13 04:20:28 oster Exp $ */
2 1.1 oster /*
3 1.1 oster * Copyright (c) 1995 Carnegie-Mellon University.
4 1.1 oster * All rights reserved.
5 1.1 oster *
6 1.1 oster * Author: Mark Holland
7 1.1 oster *
8 1.1 oster * Permission to use, copy, modify and distribute this software and
9 1.1 oster * its documentation is hereby granted, provided that both the copyright
10 1.1 oster * notice and this permission notice appear in all copies of the
11 1.1 oster * software, derivative works or modified versions, and any portions
12 1.1 oster * thereof, and that both notices appear in supporting documentation.
13 1.1 oster *
14 1.1 oster * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 1.1 oster * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
16 1.1 oster * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 1.1 oster *
18 1.1 oster * Carnegie Mellon requests users of this software to return to
19 1.1 oster *
20 1.1 oster * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
21 1.1 oster * School of Computer Science
22 1.1 oster * Carnegie Mellon University
23 1.1 oster * Pittsburgh PA 15213-3890
24 1.1 oster *
25 1.1 oster * any improvements or extensions that they make and grant Carnegie the
26 1.1 oster * rights to redistribute these changes.
27 1.1 oster */
28 1.1 oster
29 1.1 oster /*
30 1.1 oster * :
31 1.1 oster * Log: rf_desc.h,v
32 1.1 oster * Revision 1.29 1996/07/22 19:52:16 jimz
33 1.1 oster * switched node params to RF_DagParam_t, a union of
34 1.1 oster * a 64-bit int and a void *, for better portability
35 1.1 oster * attempted hpux port, but failed partway through for
36 1.1 oster * lack of a single C compiler capable of compiling all
37 1.1 oster * source files
38 1.1 oster *
39 1.1 oster * Revision 1.28 1996/06/07 22:49:22 jimz
40 1.1 oster * fix up raidPtr typing
41 1.1 oster *
42 1.1 oster * Revision 1.27 1996/06/07 21:33:04 jimz
43 1.1 oster * begin using consistent types for sector numbers,
44 1.1 oster * stripe numbers, row+col numbers, recon unit numbers
45 1.1 oster *
46 1.1 oster * Revision 1.26 1996/06/05 18:06:02 jimz
47 1.1 oster * Major code cleanup. The Great Renaming is now done.
48 1.1 oster * Better modularity. Better typing. Fixed a bunch of
49 1.1 oster * synchronization bugs. Made a lot of global stuff
50 1.1 oster * per-desc or per-array. Removed dead code.
51 1.1 oster *
52 1.1 oster * Revision 1.25 1996/06/02 17:31:48 jimz
53 1.1 oster * Moved a lot of global stuff into array structure, where it belongs.
54 1.1 oster * Fixed up paritylogging, pss modules in this manner. Some general
55 1.1 oster * code cleanup. Removed lots of dead code, some dead files.
56 1.1 oster *
57 1.1 oster * Revision 1.24 1996/05/30 11:29:41 jimz
58 1.1 oster * Numerous bug fixes. Stripe lock release code disagreed with the taking code
59 1.1 oster * about when stripes should be locked (I made it consistent: no parity, no lock)
60 1.1 oster * There was a lot of extra serialization of I/Os which I've removed- a lot of
61 1.1 oster * it was to calculate values for the cache code, which is no longer with us.
62 1.1 oster * More types, function, macro cleanup. Added code to properly quiesce the array
63 1.1 oster * on shutdown. Made a lot of stuff array-specific which was (bogusly) general
64 1.1 oster * before. Fixed memory allocation, freeing bugs.
65 1.1 oster *
66 1.1 oster * Revision 1.23 1996/05/27 18:56:37 jimz
67 1.1 oster * more code cleanup
68 1.1 oster * better typing
69 1.1 oster * compiles in all 3 environments
70 1.1 oster *
71 1.1 oster * Revision 1.22 1996/05/24 22:17:04 jimz
72 1.1 oster * continue code + namespace cleanup
73 1.1 oster * typed a bunch of flags
74 1.1 oster *
75 1.1 oster * Revision 1.21 1996/05/24 04:28:55 jimz
76 1.1 oster * release cleanup ckpt
77 1.1 oster *
78 1.1 oster * Revision 1.20 1996/05/23 21:46:35 jimz
79 1.1 oster * checkpoint in code cleanup (release prep)
80 1.1 oster * lots of types, function names have been fixed
81 1.1 oster *
82 1.1 oster * Revision 1.19 1996/05/23 00:33:23 jimz
83 1.1 oster * code cleanup: move all debug decls to rf_options.c, all extern
84 1.1 oster * debug decls to rf_options.h, all debug vars preceded by rf_
85 1.1 oster *
86 1.1 oster * Revision 1.18 1996/05/18 19:51:34 jimz
87 1.1 oster * major code cleanup- fix syntax, make some types consistent,
88 1.1 oster * add prototypes, clean out dead code, et cetera
89 1.1 oster *
90 1.1 oster * Revision 1.17 1995/12/01 15:58:43 root
91 1.1 oster * added copyright info
92 1.1 oster *
93 1.1 oster * Revision 1.16 1995/11/19 16:31:30 wvcii
94 1.1 oster * descriptors now contain an array of dag lists as opposed to a dag header
95 1.1 oster *
96 1.1 oster * Revision 1.15 1995/11/07 16:24:17 wvcii
97 1.1 oster * updated def of _AccessState
98 1.1 oster *
99 1.1 oster */
100 1.1 oster
101 1.1 oster #ifndef _RF__RF_DESC_H_
102 1.1 oster #define _RF__RF_DESC_H_
103 1.1 oster
104 1.1 oster #include "rf_archs.h"
105 1.1 oster #include "rf_types.h"
106 1.1 oster #include "rf_etimer.h"
107 1.1 oster #include "rf_dag.h"
108 1.1 oster
109 1.1 oster struct RF_RaidReconDesc_s {
110 1.1 oster RF_Raid_t *raidPtr; /* raid device descriptor */
111 1.1 oster RF_RowCol_t row; /* row of failed disk */
112 1.1 oster RF_RowCol_t col; /* col of failed disk */
113 1.1 oster int state; /* how far along the reconstruction operation has gotten */
114 1.1 oster RF_RaidDisk_t *spareDiskPtr; /* describes target disk for recon (not used in dist sparing) */
115 1.1 oster int numDisksDone; /* the number of surviving disks that have completed their work */
116 1.1 oster RF_RowCol_t srow; /* row ID of the spare disk (not used in dist sparing) */
117 1.1 oster RF_RowCol_t scol; /* col ID of the spare disk (not used in dist sparing) */
118 1.1 oster #ifdef KERNEL
119 1.1 oster /*
120 1.1 oster * Prevent recon from hogging CPU
121 1.1 oster */
122 1.1 oster RF_Etimer_t recon_exec_timer;
123 1.1 oster RF_uint64 reconExecTimerRunning;
124 1.1 oster RF_uint64 reconExecTicks;
125 1.1 oster RF_uint64 maxReconExecTicks;
126 1.1 oster #endif /* KERNEL */
127 1.1 oster
128 1.1 oster #if RF_RECON_STATS > 0
129 1.1 oster RF_uint64 hsStallCount; /* head sep stall count */
130 1.1 oster RF_uint64 numReconExecDelays;
131 1.1 oster RF_uint64 numReconEventWaits;
132 1.1 oster #endif /* RF_RECON_STATS > 0 */
133 1.1 oster RF_RaidReconDesc_t *next;
134 1.1 oster };
135 1.1 oster
136 1.1 oster struct RF_RaidAccessDesc_s {
137 1.1 oster RF_Raid_t *raidPtr; /* raid device descriptor */
138 1.1 oster RF_IoType_t type; /* read or write */
139 1.1 oster RF_RaidAddr_t raidAddress; /* starting address in raid address space */
140 1.1 oster RF_SectorCount_t numBlocks; /* number of blocks (sectors) to transfer */
141 1.1 oster RF_StripeCount_t numStripes; /* number of stripes involved in access */
142 1.1 oster caddr_t bufPtr; /* pointer to data buffer */
143 1.1 oster
144 1.1 oster #if !defined(KERNEL) && !defined(SIMULATE)
145 1.1 oster caddr_t obufPtr; /* real pointer to data buffer */
146 1.1 oster #endif /* !KERNEL && !SIMULATE */
147 1.1 oster
148 1.1 oster RF_RaidAccessFlags_t flags; /* flags controlling operation */
149 1.1 oster int state; /* index into states telling how far along the RAID operation has gotten */
150 1.1 oster RF_AccessState_t *states; /* array of states to be run */
151 1.1 oster int status; /* pass/fail status of the last operation */
152 1.1 oster RF_DagList_t *dagArray; /* array of dag lists, one list per stripe */
153 1.1 oster RF_AccessStripeMapHeader_t *asmap; /* the asm for this I/O */
154 1.1 oster void *bp; /* buf pointer for this RAID acc. ignored outside the kernel */
155 1.1 oster RF_DagHeader_t **paramDAG; /* allows the DAG to be returned to the caller after I/O completion */
156 1.1 oster RF_AccessStripeMapHeader_t **paramASM; /* allows the ASM to be returned to the caller after I/O completion */
157 1.1 oster RF_AccTraceEntry_t tracerec; /* perf monitoring information for a user access (not for dag stats) */
158 1.1 oster void (*callbackFunc)(RF_CBParam_t); /* callback function for this I/O */
159 1.1 oster void *callbackArg; /* arg to give to callback func */
160 1.1 oster int tid; /* debug only, user-level only: thread id of thr that did this access */
161 1.1 oster
162 1.1 oster RF_AllocListElem_t *cleanupList; /* memory to be freed at the end of the access*/
163 1.1 oster
164 1.1 oster RF_RaidAccessDesc_t *next;
165 1.1 oster RF_RaidAccessDesc_t *head;
166 1.1 oster
167 1.1 oster int numPending;
168 1.1 oster
169 1.1 oster RF_DECLARE_MUTEX(mutex) /* these are used to implement blocking I/O */
170 1.1 oster RF_DECLARE_COND(cond)
171 1.1 oster
172 1.1 oster #ifdef SIMULATE
173 1.1 oster RF_Owner_t owner;
174 1.1 oster int async_flag;
175 1.1 oster #endif /* SIMULATE */
176 1.1 oster
177 1.1 oster RF_Etimer_t timer; /* used for timing this access */
178 1.1 oster };
179 1.1 oster
180 1.1 oster #endif /* !_RF__RF_DESC_H_ */
181