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