186d7f5d3SJohn Marino /*- 286d7f5d3SJohn Marino * Copyright (c) 1997, 1998 386d7f5d3SJohn Marino * Nan Yang Computer Services Limited. All rights reserved. 486d7f5d3SJohn Marino * 586d7f5d3SJohn Marino * This software is distributed under the so-called ``Berkeley 686d7f5d3SJohn Marino * License'': 786d7f5d3SJohn Marino * 886d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 986d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 1086d7f5d3SJohn Marino * are met: 1186d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 1286d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 1386d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 1486d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 1586d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 1686d7f5d3SJohn Marino * 3. All advertising materials mentioning features or use of this software 1786d7f5d3SJohn Marino * must display the following acknowledgement: 1886d7f5d3SJohn Marino * This product includes software developed by Nan Yang Computer 1986d7f5d3SJohn Marino * Services Limited. 2086d7f5d3SJohn Marino * 4. Neither the name of the Company nor the names of its contributors 2186d7f5d3SJohn Marino * may be used to endorse or promote products derived from this software 2286d7f5d3SJohn Marino * without specific prior written permission. 2386d7f5d3SJohn Marino * 2486d7f5d3SJohn Marino * This software is provided ``as is'', and any express or implied 2586d7f5d3SJohn Marino * warranties, including, but not limited to, the implied warranties of 2686d7f5d3SJohn Marino * merchantability and fitness for a particular purpose are disclaimed. 2786d7f5d3SJohn Marino * In no event shall the company or contributors be liable for any 2886d7f5d3SJohn Marino * direct, indirect, incidental, special, exemplary, or consequential 2986d7f5d3SJohn Marino * damages (including, but not limited to, procurement of substitute 3086d7f5d3SJohn Marino * goods or services; loss of use, data, or profits; or business 3186d7f5d3SJohn Marino * interruption) however caused and on any theory of liability, whether 3286d7f5d3SJohn Marino * in contract, strict liability, or tort (including negligence or 3386d7f5d3SJohn Marino * otherwise) arising in any way out of the use of this software, even if 3486d7f5d3SJohn Marino * advised of the possibility of such damage. 3586d7f5d3SJohn Marino */ 3686d7f5d3SJohn Marino 3786d7f5d3SJohn Marino /* 3886d7f5d3SJohn Marino * This file gets read by makestatetext to create text files 3986d7f5d3SJohn Marino * with the names of the states, so don't change the file 4086d7f5d3SJohn Marino * format 4186d7f5d3SJohn Marino */ 4286d7f5d3SJohn Marino enum volumestate { 4386d7f5d3SJohn Marino /* present but unused. Must be 0 */ 4486d7f5d3SJohn Marino volume_unallocated, 4586d7f5d3SJohn Marino 4686d7f5d3SJohn Marino /* mentioned elsewhere but not known to the configuration */ 4786d7f5d3SJohn Marino volume_uninit, 4886d7f5d3SJohn Marino volume_down, 4986d7f5d3SJohn Marino 5086d7f5d3SJohn Marino /* 5186d7f5d3SJohn Marino * The volume is up and functional, but not all 5286d7f5d3SJohn Marino * plexes may be available 5386d7f5d3SJohn Marino */ 5486d7f5d3SJohn Marino volume_up, 5586d7f5d3SJohn Marino 5686d7f5d3SJohn Marino /* last value, for table dimensions */ 5786d7f5d3SJohn Marino volume_laststate = volume_up 5886d7f5d3SJohn Marino }; 5986d7f5d3SJohn Marino 6086d7f5d3SJohn Marino enum plexstate { 6186d7f5d3SJohn Marino /* An empty entry, not a plex at all. */ 6286d7f5d3SJohn Marino plex_unallocated, 6386d7f5d3SJohn Marino 6486d7f5d3SJohn Marino /* The plex has been referenced by a volume */ 6586d7f5d3SJohn Marino plex_referenced, 6686d7f5d3SJohn Marino 6786d7f5d3SJohn Marino /* 6886d7f5d3SJohn Marino * The plex has been allocated, but there configuration 6986d7f5d3SJohn Marino * is not complete 7086d7f5d3SJohn Marino */ 7186d7f5d3SJohn Marino plex_init, 7286d7f5d3SJohn Marino 7386d7f5d3SJohn Marino /* 7486d7f5d3SJohn Marino * A plex which has gone completely down because of 7586d7f5d3SJohn Marino * I/O errors. 7686d7f5d3SJohn Marino */ 7786d7f5d3SJohn Marino plex_faulty, 7886d7f5d3SJohn Marino 7986d7f5d3SJohn Marino /* 8086d7f5d3SJohn Marino * A plex which has been taken down by the 8186d7f5d3SJohn Marino * administrator. 8286d7f5d3SJohn Marino */ 8386d7f5d3SJohn Marino plex_down, 8486d7f5d3SJohn Marino 8586d7f5d3SJohn Marino /* A plex which is being initialized */ 8686d7f5d3SJohn Marino plex_initializing, 8786d7f5d3SJohn Marino 8886d7f5d3SJohn Marino /* 8986d7f5d3SJohn Marino * *** The remaining states represent plexes which are 9086d7f5d3SJohn Marino * at least partially up. Keep these separate so that 9186d7f5d3SJohn Marino * they can be checked more easily. 9286d7f5d3SJohn Marino */ 9386d7f5d3SJohn Marino 9486d7f5d3SJohn Marino /* 9586d7f5d3SJohn Marino * A plex entry which is at least partially up. Not 9686d7f5d3SJohn Marino * all subdisks are available, and an inconsistency 9786d7f5d3SJohn Marino * has occurred. If no other plex is uncorrupted, 9886d7f5d3SJohn Marino * the volume is no longer consistent. 9986d7f5d3SJohn Marino */ 10086d7f5d3SJohn Marino plex_corrupt, 10186d7f5d3SJohn Marino 10286d7f5d3SJohn Marino /* first "up" state */ 10386d7f5d3SJohn Marino plex_firstup = plex_corrupt, 10486d7f5d3SJohn Marino 10586d7f5d3SJohn Marino /* 10686d7f5d3SJohn Marino * A RAID-5 plex entry which is accessible, but one 10786d7f5d3SJohn Marino * subdisk is down, requiring recovery for many 10886d7f5d3SJohn Marino * I/O requests. 10986d7f5d3SJohn Marino */ 11086d7f5d3SJohn Marino plex_degraded, 11186d7f5d3SJohn Marino 11286d7f5d3SJohn Marino /* 11386d7f5d3SJohn Marino * A plex which is really up, but which has a reborn 11486d7f5d3SJohn Marino * subdisk which we don't completely trust, and 11586d7f5d3SJohn Marino * which we don't want to read if we can avoid it 11686d7f5d3SJohn Marino */ 11786d7f5d3SJohn Marino plex_flaky, 11886d7f5d3SJohn Marino 11986d7f5d3SJohn Marino /* 12086d7f5d3SJohn Marino * A plex entry which is completely up. All subdisks 12186d7f5d3SJohn Marino * are up. 12286d7f5d3SJohn Marino */ 12386d7f5d3SJohn Marino plex_up, 12486d7f5d3SJohn Marino 12586d7f5d3SJohn Marino /* last value, for table dimensions */ 12686d7f5d3SJohn Marino plex_laststate = plex_up 12786d7f5d3SJohn Marino }; 12886d7f5d3SJohn Marino 12986d7f5d3SJohn Marino /* 13086d7f5d3SJohn Marino * subdisk states 13186d7f5d3SJohn Marino */ 13286d7f5d3SJohn Marino enum sdstate { 13386d7f5d3SJohn Marino /* An empty entry, not a subdisk at all. */ 13486d7f5d3SJohn Marino sd_unallocated, 13586d7f5d3SJohn Marino 13686d7f5d3SJohn Marino /* 13786d7f5d3SJohn Marino * A subdisk entry which has not been created 13886d7f5d3SJohn Marino * completely. Some fields may be empty. 13986d7f5d3SJohn Marino */ 14086d7f5d3SJohn Marino sd_uninit, 14186d7f5d3SJohn Marino 14286d7f5d3SJohn Marino /* The subdisk has been referenced by a plex */ 14386d7f5d3SJohn Marino sd_referenced, 14486d7f5d3SJohn Marino 14586d7f5d3SJohn Marino /* 14686d7f5d3SJohn Marino * A subdisk entry which has been created completely. 14786d7f5d3SJohn Marino * All fields are correct, but the disk hasn't 14886d7f5d3SJohn Marino * been updated. 14986d7f5d3SJohn Marino */ 15086d7f5d3SJohn Marino sd_init, 15186d7f5d3SJohn Marino 15286d7f5d3SJohn Marino /* 15386d7f5d3SJohn Marino * A subdisk entry which has been created completely. 15486d7f5d3SJohn Marino * All fields are correct, and the disk has been 15586d7f5d3SJohn Marino * updated, but there is no data on the disk. 15686d7f5d3SJohn Marino */ 15786d7f5d3SJohn Marino sd_empty, 15886d7f5d3SJohn Marino 15986d7f5d3SJohn Marino /* 16086d7f5d3SJohn Marino * A subdisk entry which has been created completely and 16186d7f5d3SJohn Marino * which is currently being initialized 16286d7f5d3SJohn Marino */ 16386d7f5d3SJohn Marino sd_initializing, 16486d7f5d3SJohn Marino 16586d7f5d3SJohn Marino /* 16686d7f5d3SJohn Marino * A subdisk entry which has been initialized, 16786d7f5d3SJohn Marino * but which can't come up because it would 16886d7f5d3SJohn Marino * cause inconsistencies. 16986d7f5d3SJohn Marino */ 17086d7f5d3SJohn Marino sd_initialized, 17186d7f5d3SJohn Marino 17286d7f5d3SJohn Marino /* *** The following states represent invalid data */ 17386d7f5d3SJohn Marino /* 17486d7f5d3SJohn Marino * A subdisk entry which has been created completely. 17586d7f5d3SJohn Marino * All fields are correct, the config on disk has been 17686d7f5d3SJohn Marino * updated, and the data was valid, but since then the 17786d7f5d3SJohn Marino * drive has been taken down, and as a result updates 17886d7f5d3SJohn Marino * have been missed. 17986d7f5d3SJohn Marino */ 18086d7f5d3SJohn Marino sd_obsolete, 18186d7f5d3SJohn Marino 18286d7f5d3SJohn Marino /* 18386d7f5d3SJohn Marino * A subdisk entry which has been created completely. 18486d7f5d3SJohn Marino * All fields are correct, the disk has been updated, 18586d7f5d3SJohn Marino * and the data was valid, but since then the drive 18686d7f5d3SJohn Marino * has been crashed and updates have been lost. 18786d7f5d3SJohn Marino */ 18886d7f5d3SJohn Marino sd_stale, 18986d7f5d3SJohn Marino 19086d7f5d3SJohn Marino /* *** The following states represent valid, inaccessible data */ 19186d7f5d3SJohn Marino 19286d7f5d3SJohn Marino /* 19386d7f5d3SJohn Marino * A subdisk entry which has been created completely. 19486d7f5d3SJohn Marino * All fields are correct, the disk has been updated, 19586d7f5d3SJohn Marino * and the data was valid, but since then the drive 19686d7f5d3SJohn Marino * has gone down. No attempt has been made to write 19786d7f5d3SJohn Marino * to the subdisk since the crash, so the data is valid. 19886d7f5d3SJohn Marino */ 19986d7f5d3SJohn Marino sd_crashed, 20086d7f5d3SJohn Marino 20186d7f5d3SJohn Marino /* 20286d7f5d3SJohn Marino * A subdisk entry which was up, which contained 20386d7f5d3SJohn Marino * valid data, and which was taken down by the 20486d7f5d3SJohn Marino * administrator. The data is valid. 20586d7f5d3SJohn Marino */ 20686d7f5d3SJohn Marino sd_down, 20786d7f5d3SJohn Marino 20886d7f5d3SJohn Marino /* 20986d7f5d3SJohn Marino * *** This is invalid data (the subdisk previously had 21086d7f5d3SJohn Marino * a numerically lower state), but it is currently in the 21186d7f5d3SJohn Marino * process of being revived. We can write but not read. 21286d7f5d3SJohn Marino */ 21386d7f5d3SJohn Marino sd_reviving, 21486d7f5d3SJohn Marino 21586d7f5d3SJohn Marino /* 21686d7f5d3SJohn Marino * *** The following states represent accessible subdisks 21786d7f5d3SJohn Marino * with valid data 21886d7f5d3SJohn Marino */ 21986d7f5d3SJohn Marino 22086d7f5d3SJohn Marino /* 22186d7f5d3SJohn Marino * A subdisk entry which has been created completely. 22286d7f5d3SJohn Marino * All fields are correct, the disk has been updated, 22386d7f5d3SJohn Marino * and the data was valid, but since then the drive 22486d7f5d3SJohn Marino * has gone down and up again. No updates were lost, 22586d7f5d3SJohn Marino * but it is possible that the subdisk has been 22686d7f5d3SJohn Marino * damaged. We won't read from this subdisk if we 22786d7f5d3SJohn Marino * have a choice. If this is the only subdisk which 22886d7f5d3SJohn Marino * covers this address space in the plex, we set its 22986d7f5d3SJohn Marino * state to sd_up under these circumstances, so this 23086d7f5d3SJohn Marino * status implies that there is another subdisk to 23186d7f5d3SJohn Marino * fulfil the request. 23286d7f5d3SJohn Marino */ 23386d7f5d3SJohn Marino sd_reborn, 23486d7f5d3SJohn Marino 23586d7f5d3SJohn Marino /* 23686d7f5d3SJohn Marino * A subdisk entry which has been created completely. 23786d7f5d3SJohn Marino * All fields are correct, the disk has been updated, 23886d7f5d3SJohn Marino * and the data is valid. 23986d7f5d3SJohn Marino */ 24086d7f5d3SJohn Marino sd_up, 24186d7f5d3SJohn Marino 24286d7f5d3SJohn Marino /* last value, for table dimensions */ 24386d7f5d3SJohn Marino sd_laststate = sd_up 24486d7f5d3SJohn Marino }; 24586d7f5d3SJohn Marino 24686d7f5d3SJohn Marino enum drivestate { 24786d7f5d3SJohn Marino /* present but unused. Must be 0 */ 24886d7f5d3SJohn Marino drive_unallocated, 24986d7f5d3SJohn Marino 25086d7f5d3SJohn Marino /* just mentioned in some other config entry */ 25186d7f5d3SJohn Marino drive_referenced, 25286d7f5d3SJohn Marino 25386d7f5d3SJohn Marino /* not accessible */ 25486d7f5d3SJohn Marino drive_down, 25586d7f5d3SJohn Marino 25686d7f5d3SJohn Marino /* up and running */ 25786d7f5d3SJohn Marino drive_up, 25886d7f5d3SJohn Marino 25986d7f5d3SJohn Marino /* last value, for table dimensions */ 26086d7f5d3SJohn Marino drive_laststate = drive_up 26186d7f5d3SJohn Marino }; 26286d7f5d3SJohn Marino 263