summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum/vinumstate.h
blob: 572f317d03dca3af33b27ad9b43fb5057322e61d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
/*-
 * Copyright (c) 1997, 1998
 *	Nan Yang Computer Services Limited.  All rights reserved.
 *
 *  This software is distributed under the so-called ``Berkeley
 *  License'':
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by Nan Yang Computer
 *      Services Limited.
 * 4. Neither the name of the Company nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * This software is provided ``as is'', and any express or implied
 * warranties, including, but not limited to, the implied warranties of
 * merchantability and fitness for a particular purpose are disclaimed.
 * In no event shall the company or contributors be liable for any
 * direct, indirect, incidental, special, exemplary, or consequential
 * damages (including, but not limited to, procurement of substitute
 * goods or services; loss of use, data, or profits; or business
 * interruption) however caused and on any theory of liability, whether
 * in contract, strict liability, or tort (including negligence or
 * otherwise) arising in any way out of the use of this software, even if
 * advised of the possibility of such damage.
 *
 * $FreeBSD$
 */

/*
 * This file gets read by makestatetext to create text files
 * with the names of the states, so don't change the file
 * format
 */

enum volumestate {
    volume_unallocated,
    /* present but unused.  Must be 0 */

    volume_uninit,
    /* mentioned elsewhere but not known to the configuration */

    volume_down,

    /* The volume is up and functional, but not all plexes may be available */
    volume_up,
    volume_laststate = volume_up			    /* last value, for table dimensions */
};

enum plexstate {
    /* An empty entry, not a plex at all.   */
    plex_unallocated,

    /* The plex has been referenced by a volume */
    plex_referenced,
    /*
     * The plex has been allocated, but there configuration
     * is not complete
     */
    plex_init,

    /*
     * A plex which has gone completely down because of
     * I/O errors.
     */
    plex_faulty,

    /*
     * A plex which has been taken down by the
     * administrator.
     */
    plex_down,

    /* A plex which is being initialized */
    plex_initializing,

    /*
     * *** The remaining states represent plexes which are
     * at least partially up.  Keep these separate so that
     * they can be checked more easily.
     */

    /*
     * A plex entry which is at least partially up.  Not
     * all subdisks are available, and an inconsistency
     * has occurred.  If no other plex is uncorrupted,
     * the volume is no longer consistent.
     */
    plex_corrupt,

    plex_firstup = plex_corrupt,			    /* first "up" state */

    /*
     * A RAID-5 plex entry which is accessible, but one
     * subdisk is down, requiring recovery for many
     * I/O requests.
     */
    plex_degraded,

    /*
     * A plex which is really up, but which has a reborn
     * subdisk which we don't completely trust, and
     * which we don't want to read if we can avoid it
     */
    plex_flaky,

    /*
     * A plex entry which is completely up.  All subdisks
     * are up.
     */
    plex_up,

    plex_laststate = plex_up				    /* last value, for table dimensions */
};

/* subdisk states */
enum sdstate {
    /* An empty entry, not a subdisk at all. */
    sd_unallocated,

    /*
     * A subdisk entry which has not been created
     * completely.  Some fields may be empty.
     */
    sd_uninit,

    /* The subdisk has been referenced by a plex */
    sd_referenced,

    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, but the disk hasn't
     * been updated.
     */
    sd_init,

    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, and the disk has been
     * updated, but there is no data on the disk.
     */
    sd_empty,

    /*
     * A subdisk entry which has been created completely and
     * which is currently being initialized
     */
    sd_initializing,

    /*
     * A subdisk entry which has been initialized,
     * but which can't come up because it would
     * cause inconsistencies.
     */
    sd_initialized,

    /* *** The following states represent invalid data */
    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, the config on disk has been
     * updated, and the data was valid, but since then the
     * drive has been taken down, and as a result updates
     * have been missed.
     */
    sd_obsolete,

    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, the disk has been updated,
     * and the data was valid, but since then the drive
     * has been crashed and updates have been lost.
     */
    sd_stale,

    /* *** The following states represent valid, inaccessible data */

    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, the disk has been updated,
     * and the data was valid, but since then the drive
     * has gone down.   No attempt has been made to write
     * to the subdisk since the crash, so the data is valid.
     */
    sd_crashed,

    /*
     * A subdisk entry which was up, which contained
     * valid data, and which was taken down by the
     * administrator.  The data is valid.
     */
    sd_down,

    /*
     * *** This is invalid data (the subdisk previously had
     * a numerically lower state), but it is currently in the
     * process of being revived.  We can write but not read.
     */
    sd_reviving,

    /*
     * *** The following states represent accessible subdisks
     * with valid data
     */

    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, the disk has been updated,
     * and the data was valid, but since then the drive
     * has gone down and up again.  No updates were lost,
     * but it is possible that the subdisk has been
     * damaged.  We won't read from this subdisk if we
     * have a choice.  If this is the only subdisk which
     * covers this address space in the plex, we set its
     * state to sd_up under these circumstances, so this
     * status implies that there is another subdisk to
     * fulfil the request.
     */
    sd_reborn,

    /*
     * A subdisk entry which has been created completely.
     * All fields are correct, the disk has been updated,
     * and the data is valid.
     */
    sd_up,

    sd_laststate = sd_up				    /* last value, for table dimensions */
};

enum drivestate {
    drive_unallocated,
    /* present but unused.  Must be 0 */

    drive_referenced,
    /* just mentioned in some other config entry */

    drive_down,
    /* not accessible */

    drive_up,
    /* up and running */

    drive_laststate = drive_up				    /* last value, for table dimensions */
};

/* Local Variables: */
/* fill-column: 50 */
/* End: */
OpenPOWER on IntegriCloud