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 37 /* 38 * This file gets read by makestatetext to create text files 39 * with the names of the states, so don't change the file 40 * format 41 */ 42 enum volumestate { 43 /* present but unused. Must be 0 */ 44 volume_unallocated, 45 46 /* mentioned elsewhere but not known to the configuration */ 47 volume_uninit, 48 volume_down, 49 50 /* 51 * The volume is up and functional, but not all 52 * plexes may be available 53 */ 54 volume_up, 55 56 /* last value, for table dimensions */ 57 volume_laststate = volume_up 58 }; 59 60 enum plexstate { 61 /* An empty entry, not a plex at all. */ 62 plex_unallocated, 63 64 /* The plex has been referenced by a volume */ 65 plex_referenced, 66 67 /* 68 * The plex has been allocated, but there configuration 69 * is not complete 70 */ 71 plex_init, 72 73 /* 74 * A plex which has gone completely down because of 75 * I/O errors. 76 */ 77 plex_faulty, 78 79 /* 80 * A plex which has been taken down by the 81 * administrator. 82 */ 83 plex_down, 84 85 /* A plex which is being initialized */ 86 plex_initializing, 87 88 /* 89 * *** The remaining states represent plexes which are 90 * at least partially up. Keep these separate so that 91 * they can be checked more easily. 92 */ 93 94 /* 95 * A plex entry which is at least partially up. Not 96 * all subdisks are available, and an inconsistency 97 * has occurred. If no other plex is uncorrupted, 98 * the volume is no longer consistent. 99 */ 100 plex_corrupt, 101 102 /* first "up" state */ 103 plex_firstup = plex_corrupt, 104 105 /* 106 * A RAID-5 plex entry which is accessible, but one 107 * subdisk is down, requiring recovery for many 108 * I/O requests. 109 */ 110 plex_degraded, 111 112 /* 113 * A plex which is really up, but which has a reborn 114 * subdisk which we don't completely trust, and 115 * which we don't want to read if we can avoid it 116 */ 117 plex_flaky, 118 119 /* 120 * A plex entry which is completely up. All subdisks 121 * are up. 122 */ 123 plex_up, 124 125 /* last value, for table dimensions */ 126 plex_laststate = plex_up 127 }; 128 129 /* 130 * subdisk states 131 */ 132 enum sdstate { 133 /* An empty entry, not a subdisk at all. */ 134 sd_unallocated, 135 136 /* 137 * A subdisk entry which has not been created 138 * completely. Some fields may be empty. 139 */ 140 sd_uninit, 141 142 /* The subdisk has been referenced by a plex */ 143 sd_referenced, 144 145 /* 146 * A subdisk entry which has been created completely. 147 * All fields are correct, but the disk hasn't 148 * been updated. 149 */ 150 sd_init, 151 152 /* 153 * A subdisk entry which has been created completely. 154 * All fields are correct, and the disk has been 155 * updated, but there is no data on the disk. 156 */ 157 sd_empty, 158 159 /* 160 * A subdisk entry which has been created completely and 161 * which is currently being initialized 162 */ 163 sd_initializing, 164 165 /* 166 * A subdisk entry which has been initialized, 167 * but which can't come up because it would 168 * cause inconsistencies. 169 */ 170 sd_initialized, 171 172 /* *** The following states represent invalid data */ 173 /* 174 * A subdisk entry which has been created completely. 175 * All fields are correct, the config on disk has been 176 * updated, and the data was valid, but since then the 177 * drive has been taken down, and as a result updates 178 * have been missed. 179 */ 180 sd_obsolete, 181 182 /* 183 * A subdisk entry which has been created completely. 184 * All fields are correct, the disk has been updated, 185 * and the data was valid, but since then the drive 186 * has been crashed and updates have been lost. 187 */ 188 sd_stale, 189 190 /* *** The following states represent valid, inaccessible data */ 191 192 /* 193 * A subdisk entry which has been created completely. 194 * All fields are correct, the disk has been updated, 195 * and the data was valid, but since then the drive 196 * has gone down. No attempt has been made to write 197 * to the subdisk since the crash, so the data is valid. 198 */ 199 sd_crashed, 200 201 /* 202 * A subdisk entry which was up, which contained 203 * valid data, and which was taken down by the 204 * administrator. The data is valid. 205 */ 206 sd_down, 207 208 /* 209 * *** This is invalid data (the subdisk previously had 210 * a numerically lower state), but it is currently in the 211 * process of being revived. We can write but not read. 212 */ 213 sd_reviving, 214 215 /* 216 * *** The following states represent accessible subdisks 217 * with valid data 218 */ 219 220 /* 221 * A subdisk entry which has been created completely. 222 * All fields are correct, the disk has been updated, 223 * and the data was valid, but since then the drive 224 * has gone down and up again. No updates were lost, 225 * but it is possible that the subdisk has been 226 * damaged. We won't read from this subdisk if we 227 * have a choice. If this is the only subdisk which 228 * covers this address space in the plex, we set its 229 * state to sd_up under these circumstances, so this 230 * status implies that there is another subdisk to 231 * fulfil the request. 232 */ 233 sd_reborn, 234 235 /* 236 * A subdisk entry which has been created completely. 237 * All fields are correct, the disk has been updated, 238 * and the data is valid. 239 */ 240 sd_up, 241 242 /* last value, for table dimensions */ 243 sd_laststate = sd_up 244 }; 245 246 enum drivestate { 247 /* present but unused. Must be 0 */ 248 drive_unallocated, 249 250 /* just mentioned in some other config entry */ 251 drive_referenced, 252 253 /* not accessible */ 254 drive_down, 255 256 /* up and running */ 257 drive_up, 258 259 /* last value, for table dimensions */ 260 drive_laststate = drive_up 261 }; 262 263