Home | History | Annotate | Line # | Download | only in raidframe
rf_reconmap.h revision 1.9.14.1
      1  1.9.14.1  bouyer /*	$NetBSD: rf_reconmap.h,v 1.9.14.1 2008/05/25 18:42:18 bouyer Exp $	*/
      2       1.1   oster /*
      3       1.1   oster  * Copyright (c) 1995 Carnegie-Mellon University.
      4       1.1   oster  * All rights reserved.
      5       1.1   oster  *
      6       1.1   oster  * Author: Mark Holland
      7       1.1   oster  *
      8       1.1   oster  * Permission to use, copy, modify and distribute this software and
      9       1.1   oster  * its documentation is hereby granted, provided that both the copyright
     10       1.1   oster  * notice and this permission notice appear in all copies of the
     11       1.1   oster  * software, derivative works or modified versions, and any portions
     12       1.1   oster  * thereof, and that both notices appear in supporting documentation.
     13       1.1   oster  *
     14       1.1   oster  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15       1.1   oster  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     16       1.1   oster  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17       1.1   oster  *
     18       1.1   oster  * Carnegie Mellon requests users of this software to return to
     19       1.1   oster  *
     20       1.1   oster  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21       1.1   oster  *  School of Computer Science
     22       1.1   oster  *  Carnegie Mellon University
     23       1.1   oster  *  Pittsburgh PA 15213-3890
     24       1.1   oster  *
     25       1.1   oster  * any improvements or extensions that they make and grant Carnegie the
     26       1.1   oster  * rights to redistribute these changes.
     27       1.1   oster  */
     28       1.1   oster 
     29       1.1   oster /******************************************************************************
     30       1.1   oster  * rf_reconMap.h -- Header file describing reconstruction status data structure
     31       1.1   oster  ******************************************************************************/
     32       1.1   oster 
     33       1.1   oster #ifndef _RF__RF_RECONMAP_H_
     34       1.1   oster #define _RF__RF_RECONMAP_H_
     35       1.1   oster 
     36       1.4   oster #include <dev/raidframe/raidframevar.h>
     37       1.6   oster #include <sys/pool.h>
     38       1.4   oster 
     39       1.1   oster #include "rf_threadstuff.h"
     40       1.1   oster 
     41  1.9.14.1  bouyer /* the number of recon units in the status table. */
     42  1.9.14.1  bouyer #define RF_RECONMAP_SIZE 32
     43  1.9.14.1  bouyer 
     44       1.1   oster /*
     45       1.5   oster  * Main reconstruction status descriptor.
     46       1.1   oster  */
     47       1.1   oster struct RF_ReconMap_s {
     48       1.3   oster 	RF_SectorCount_t sectorsPerReconUnit;	/* sectors per reconstruct
     49       1.3   oster 						 * unit */
     50       1.3   oster 	RF_SectorCount_t sectorsInDisk;	/* total sectors in disk */
     51       1.3   oster 	RF_SectorCount_t unitsLeft;	/* recon units left to recon */
     52       1.3   oster 	RF_ReconUnitCount_t totalRUs;	/* total recon units on disk */
     53       1.3   oster 	RF_ReconUnitCount_t spareRUs;	/* total number of spare RUs on failed
     54       1.3   oster 					 * disk */
     55  1.9.14.1  bouyer 	RF_ReconUnitCount_t low_ru;     /* lowest reconstruction unit number in
     56  1.9.14.1  bouyer 					   the status array */
     57  1.9.14.1  bouyer 	RF_ReconUnitCount_t high_ru;    /* highest reconstruction unit number
     58  1.9.14.1  bouyer 					   in the status array */
     59  1.9.14.1  bouyer 	RF_ReconUnitCount_t head;       /* the position in the array where
     60  1.9.14.1  bouyer 					   low_ru is found */
     61  1.9.14.1  bouyer 	RF_ReconUnitCount_t status_size; /* number of recon units in status */
     62       1.3   oster 	RF_StripeCount_t totalParityStripes;	/* total number of parity
     63       1.3   oster 						 * stripes in array */
     64       1.3   oster 	RF_ReconMapListElem_t **status;	/* array of ptrs to list elements */
     65       1.6   oster 	struct pool elem_pool;          /* pool of RF_ReconMapListElem_t's */
     66       1.6   oster 	RF_DECLARE_MUTEX(mutex)
     67       1.9   oster 	int lock;                       /* 1 if someone has the recon map
     68       1.9   oster 					   locked, 0 otherwise */
     69       1.1   oster };
     70       1.1   oster /* a list element */
     71       1.1   oster struct RF_ReconMapListElem_s {
     72       1.3   oster 	RF_SectorNum_t startSector;	/* bounding sect nums on this block */
     73       1.3   oster 	RF_SectorNum_t stopSector;
     74       1.3   oster 	RF_ReconMapListElem_t *next;	/* next element in list */
     75       1.1   oster };
     76       1.1   oster 
     77       1.8   oster RF_ReconMap_t *rf_MakeReconMap(RF_Raid_t *, RF_SectorCount_t,
     78       1.8   oster 			       RF_SectorCount_t, RF_ReconUnitCount_t);
     79       1.8   oster void rf_ReconMapUpdate(RF_Raid_t *, RF_ReconMap_t *, RF_SectorNum_t, RF_SectorNum_t);
     80       1.8   oster void rf_FreeReconMap(RF_ReconMap_t *);
     81       1.8   oster int rf_CheckRUReconstructed(RF_ReconMap_t *, RF_SectorNum_t);
     82       1.8   oster RF_ReconUnitCount_t rf_UnitsLeftToReconstruct(RF_ReconMap_t *);
     83       1.8   oster void rf_PrintReconMap(RF_Raid_t *, RF_ReconMap_t *, RF_RowCol_t);
     84       1.8   oster void rf_PrintReconSchedule(RF_ReconMap_t *, struct timeval *);
     85       1.1   oster 
     86       1.3   oster #endif				/* !_RF__RF_RECONMAP_H_ */
     87