Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / raidframe / rf_reconmap.h
blob4187391fa383921e86d445236f65f16649354e33
1 /* $NetBSD: rf_reconmap.h,v 1.10 2005/12/11 12:23:37 christos Exp $ */
2 /*
3 * Copyright (c) 1995 Carnegie-Mellon University.
4 * All rights reserved.
6 * Author: Mark Holland
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.
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.
18 * Carnegie Mellon requests users of this software to return to
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes.
29 /******************************************************************************
30 * rf_reconMap.h -- Header file describing reconstruction status data structure
31 ******************************************************************************/
33 #ifndef _RF__RF_RECONMAP_H_
34 #define _RF__RF_RECONMAP_H_
36 #include <dev/raidframe/raidframevar.h>
37 #include <sys/pool.h>
39 #include "rf_threadstuff.h"
41 /* the number of recon units in the status table. */
42 #define RF_RECONMAP_SIZE 32
45 * Main reconstruction status descriptor.
47 struct RF_ReconMap_s {
48 RF_SectorCount_t sectorsPerReconUnit; /* sectors per reconstruct
49 * unit */
50 RF_SectorCount_t sectorsInDisk; /* total sectors in disk */
51 RF_SectorCount_t unitsLeft; /* recon units left to recon */
52 RF_ReconUnitCount_t totalRUs; /* total recon units on disk */
53 RF_ReconUnitCount_t spareRUs; /* total number of spare RUs on failed
54 * disk */
55 RF_ReconUnitCount_t low_ru; /* lowest reconstruction unit number in
56 the status array */
57 RF_ReconUnitCount_t high_ru; /* highest reconstruction unit number
58 in the status array */
59 RF_ReconUnitCount_t head; /* the position in the array where
60 low_ru is found */
61 RF_ReconUnitCount_t status_size; /* number of recon units in status */
62 RF_StripeCount_t totalParityStripes; /* total number of parity
63 * stripes in array */
64 RF_ReconMapListElem_t **status; /* array of ptrs to list elements */
65 struct pool elem_pool; /* pool of RF_ReconMapListElem_t's */
66 RF_DECLARE_MUTEX(mutex)
67 int lock; /* 1 if someone has the recon map
68 locked, 0 otherwise */
70 /* a list element */
71 struct RF_ReconMapListElem_s {
72 RF_SectorNum_t startSector; /* bounding sect nums on this block */
73 RF_SectorNum_t stopSector;
74 RF_ReconMapListElem_t *next; /* next element in list */
77 RF_ReconMap_t *rf_MakeReconMap(RF_Raid_t *, RF_SectorCount_t,
78 RF_SectorCount_t, RF_ReconUnitCount_t);
79 void rf_ReconMapUpdate(RF_Raid_t *, RF_ReconMap_t *, RF_SectorNum_t, RF_SectorNum_t);
80 void rf_FreeReconMap(RF_ReconMap_t *);
81 int rf_CheckRUReconstructed(RF_ReconMap_t *, RF_SectorNum_t);
82 RF_ReconUnitCount_t rf_UnitsLeftToReconstruct(RF_ReconMap_t *);
83 void rf_PrintReconMap(RF_Raid_t *, RF_ReconMap_t *, RF_RowCol_t);
84 void rf_PrintReconSchedule(RF_ReconMap_t *, struct timeval *);
86 #endif /* !_RF__RF_RECONMAP_H_ */