Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / dev / raid / vinum / vinumstate.h
1 /*-
2  * Copyright (c) 1997, 1998
3  *      Nan Yang Computer Services Limited.  All rights reserved.
4  *
5  *  This software is distributed under the so-called ``Berkeley
6  *  License'':
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed by Nan Yang Computer
19  *      Services Limited.
20  * 4. Neither the name of the Company nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * This software is provided ``as is'', and any express or implied
25  * warranties, including, but not limited to, the implied warranties of
26  * merchantability and fitness for a particular purpose are disclaimed.
27  * In no event shall the company or contributors be liable for any
28  * direct, indirect, incidental, special, exemplary, or consequential
29  * damages (including, but not limited to, procurement of substitute
30  * goods or services; loss of use, data, or profits; or business
31  * interruption) however caused and on any theory of liability, whether
32  * in contract, strict liability, or tort (including negligence or
33  * otherwise) arising in any way out of the use of this software, even if
34  * advised of the possibility of such damage.
35  *
36  * $FreeBSD: src/sys/dev/vinum/vinumstate.h,v 1.9 1999/08/28 00:42:43 peter Exp $
37  */
38
39 /*
40  * This file gets read by makestatetext to create text files
41  * with the names of the states, so don't change the file
42  * format
43  */
44
45 enum volumestate {
46     volume_unallocated,
47     /* present but unused.  Must be 0 */
48
49     volume_uninit,
50     /* mentioned elsewhere but not known to the configuration */
51
52     volume_down,
53
54     /* The volume is up and functional, but not all plexes may be available */
55     volume_up,
56     volume_laststate = volume_up                            /* last value, for table dimensions */
57 };
58
59 enum plexstate {
60     /* An empty entry, not a plex at all.   */
61     plex_unallocated,
62
63     /* The plex has been referenced by a volume */
64     plex_referenced,
65     /*
66      * The plex has been allocated, but there configuration
67      * is not complete
68      */
69     plex_init,
70
71     /*
72      * A plex which has gone completely down because of
73      * I/O errors.
74      */
75     plex_faulty,
76
77     /*
78      * A plex which has been taken down by the
79      * administrator.
80      */
81     plex_down,
82
83     /* A plex which is being initialized */
84     plex_initializing,
85
86     /*
87      * *** The remaining states represent plexes which are
88      * at least partially up.  Keep these separate so that
89      * they can be checked more easily.
90      */
91
92     /*
93      * A plex entry which is at least partially up.  Not
94      * all subdisks are available, and an inconsistency
95      * has occurred.  If no other plex is uncorrupted,
96      * the volume is no longer consistent.
97      */
98     plex_corrupt,
99
100     plex_firstup = plex_corrupt,                            /* first "up" state */
101
102     /*
103      * A RAID-5 plex entry which is accessible, but one
104      * subdisk is down, requiring recovery for many
105      * I/O requests.
106      */
107     plex_degraded,
108
109     /*
110      * A plex which is really up, but which has a reborn
111      * subdisk which we don't completely trust, and
112      * which we don't want to read if we can avoid it
113      */
114     plex_flaky,
115
116     /*
117      * A plex entry which is completely up.  All subdisks
118      * are up.
119      */
120     plex_up,
121
122     plex_laststate = plex_up                                /* last value, for table dimensions */
123 };
124
125 /* subdisk states */
126 enum sdstate {
127     /* An empty entry, not a subdisk at all. */
128     sd_unallocated,
129
130     /*
131      * A subdisk entry which has not been created
132      * completely.  Some fields may be empty.
133      */
134     sd_uninit,
135
136     /* The subdisk has been referenced by a plex */
137     sd_referenced,
138
139     /*
140      * A subdisk entry which has been created completely.
141      * All fields are correct, but the disk hasn't
142      * been updated.
143      */
144     sd_init,
145
146     /*
147      * A subdisk entry which has been created completely.
148      * All fields are correct, and the disk has been
149      * updated, but there is no data on the disk.
150      */
151     sd_empty,
152
153     /*
154      * A subdisk entry which has been created completely and
155      * which is currently being initialized
156      */
157     sd_initializing,
158
159     /*
160      * A subdisk entry which has been initialized,
161      * but which can't come up because it would
162      * cause inconsistencies.
163      */
164     sd_initialized,
165
166     /* *** The following states represent invalid data */
167     /*
168      * A subdisk entry which has been created completely.
169      * All fields are correct, the config on disk has been
170      * updated, and the data was valid, but since then the
171      * drive has been taken down, and as a result updates
172      * have been missed.
173      */
174     sd_obsolete,
175
176     /*
177      * A subdisk entry which has been created completely.
178      * All fields are correct, the disk has been updated,
179      * and the data was valid, but since then the drive
180      * has been crashed and updates have been lost.
181      */
182     sd_stale,
183
184     /* *** The following states represent valid, inaccessible data */
185
186     /*
187      * A subdisk entry which has been created completely.
188      * All fields are correct, the disk has been updated,
189      * and the data was valid, but since then the drive
190      * has gone down.   No attempt has been made to write
191      * to the subdisk since the crash, so the data is valid.
192      */
193     sd_crashed,
194
195     /*
196      * A subdisk entry which was up, which contained
197      * valid data, and which was taken down by the
198      * administrator.  The data is valid.
199      */
200     sd_down,
201
202     /*
203      * *** This is invalid data (the subdisk previously had
204      * a numerically lower state), but it is currently in the
205      * process of being revived.  We can write but not read.
206      */
207     sd_reviving,
208
209     /*
210      * *** The following states represent accessible subdisks
211      * with valid data
212      */
213
214     /*
215      * A subdisk entry which has been created completely.
216      * All fields are correct, the disk has been updated,
217      * and the data was valid, but since then the drive
218      * has gone down and up again.  No updates were lost,
219      * but it is possible that the subdisk has been
220      * damaged.  We won't read from this subdisk if we
221      * have a choice.  If this is the only subdisk which
222      * covers this address space in the plex, we set its
223      * state to sd_up under these circumstances, so this
224      * status implies that there is another subdisk to
225      * fulfil the request.
226      */
227     sd_reborn,
228
229     /*
230      * A subdisk entry which has been created completely.
231      * All fields are correct, the disk has been updated,
232      * and the data is valid.
233      */
234     sd_up,
235
236     sd_laststate = sd_up                                    /* last value, for table dimensions */
237 };
238
239 enum drivestate {
240     drive_unallocated,
241     /* present but unused.  Must be 0 */
242
243     drive_referenced,
244     /* just mentioned in some other config entry */
245
246     drive_down,
247     /* not accessible */
248
249     drive_up,
250     /* up and running */
251
252     drive_laststate = drive_up                              /* last value, for table dimensions */
253 };
254
255 /* Local Variables: */
256 /* fill-column: 50 */
257 /* End: */