Home | History | Annotate | Line # | Download | only in raidframe
rf_reconmap.h revision 1.2
      1 /*	$NetBSD: rf_reconmap.h,v 1.2 1999/01/26 02:34:01 oster Exp $	*/
      2 /*
      3  * Copyright (c) 1995 Carnegie-Mellon University.
      4  * All rights reserved.
      5  *
      6  * Author: Mark Holland
      7  *
      8  * Permission to use, copy, modify and distribute this software and
      9  * its documentation is hereby granted, provided that both the copyright
     10  * notice and this permission notice appear in all copies of the
     11  * software, derivative works or modified versions, and any portions
     12  * thereof, and that both notices appear in supporting documentation.
     13  *
     14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17  *
     18  * Carnegie Mellon requests users of this software to return to
     19  *
     20  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21  *  School of Computer Science
     22  *  Carnegie Mellon University
     23  *  Pittsburgh PA 15213-3890
     24  *
     25  * any improvements or extensions that they make and grant Carnegie the
     26  * rights to redistribute these changes.
     27  */
     28 
     29 /******************************************************************************
     30  * rf_reconMap.h -- Header file describing reconstruction status data structure
     31  ******************************************************************************/
     32 
     33 #ifndef _RF__RF_RECONMAP_H_
     34 #define _RF__RF_RECONMAP_H_
     35 
     36 #include "rf_types.h"
     37 #include "rf_threadstuff.h"
     38 
     39 /*
     40  * Main reconstruction status descriptor. size and maxsize are used for
     41  * monitoring only:  they have no function for reconstruction.
     42  */
     43 struct RF_ReconMap_s {
     44   RF_SectorCount_t         sectorsPerReconUnit; /* sectors per reconstruct unit */
     45   RF_SectorCount_t         sectorsInDisk;       /* total sectors in disk */
     46   RF_SectorCount_t         unitsLeft;           /* recon units left to recon */
     47   RF_ReconUnitCount_t      totalRUs;            /* total recon units on disk */
     48   RF_ReconUnitCount_t      spareRUs;            /* total number of spare RUs on failed disk */
     49   RF_StripeCount_t         totalParityStripes;  /* total number of parity stripes in array */
     50   u_int                    size;				/* overall size of this structure */
     51   u_int                    maxSize;			    /* maximum size so far */
     52   RF_ReconMapListElem_t  **status;              /* array of ptrs to list elements */
     53   RF_DECLARE_MUTEX(mutex)
     54 };
     55 
     56 /* a list element */
     57 struct RF_ReconMapListElem_s {
     58   RF_SectorNum_t          startSector; /* bounding sect nums on this block */
     59   RF_SectorNum_t          stopSector;
     60   RF_ReconMapListElem_t  *next;        /* next element in list */
     61 };
     62 
     63 RF_ReconMap_t *rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors,
     64 	RF_SectorCount_t disk_sectors, RF_ReconUnitCount_t spareUnitsPerDisk);
     65 
     66 void rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr,
     67 	RF_SectorNum_t startSector, RF_SectorNum_t stopSector);
     68 
     69 void rf_FreeReconMap(RF_ReconMap_t *mapPtr);
     70 
     71 int rf_CheckRUReconstructed(RF_ReconMap_t *mapPtr, RF_SectorNum_t startSector);
     72 
     73 RF_ReconUnitCount_t rf_UnitsLeftToReconstruct(RF_ReconMap_t *mapPtr);
     74 
     75 void rf_PrintReconMap(RF_Raid_t *raidPtr, RF_ReconMap_t *mapPtr,
     76 	RF_RowCol_t frow, RF_RowCol_t fcol);
     77 
     78 void rf_PrintReconSchedule(RF_ReconMap_t *mapPtr, struct timeval *starttime);
     79 
     80 #endif /* !_RF__RF_RECONMAP_H_ */
     81