Home | History | Annotate | Line # | Download | only in raidframe
rf_layout.h revision 1.1
      1  1.1  oster /*	$NetBSD: rf_layout.h,v 1.1 1998/11/13 04:20:30 oster 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 /* rf_layout.h -- header file defining layout data structures
     30  1.1  oster  */
     31  1.1  oster 
     32  1.1  oster /*
     33  1.1  oster  * :
     34  1.1  oster  * Log: rf_layout.h,v
     35  1.1  oster  * Revision 1.50  1996/11/05 21:10:40  jimz
     36  1.1  oster  * failed pda generalization
     37  1.1  oster  *
     38  1.1  oster  * Revision 1.49  1996/07/29  14:05:12  jimz
     39  1.1  oster  * fix numPUs/numRUs confusion (everything is now numRUs)
     40  1.1  oster  * clean up some commenting, return values
     41  1.1  oster  *
     42  1.1  oster  * Revision 1.48  1996/07/22  19:52:16  jimz
     43  1.1  oster  * switched node params to RF_DagParam_t, a union of
     44  1.1  oster  * a 64-bit int and a void *, for better portability
     45  1.1  oster  * attempted hpux port, but failed partway through for
     46  1.1  oster  * lack of a single C compiler capable of compiling all
     47  1.1  oster  * source files
     48  1.1  oster  *
     49  1.1  oster  * Revision 1.47  1996/07/18  22:57:14  jimz
     50  1.1  oster  * port simulator to AIX
     51  1.1  oster  *
     52  1.1  oster  * Revision 1.46  1996/07/13  00:00:59  jimz
     53  1.1  oster  * sanitized generalized reconstruction architecture
     54  1.1  oster  * cleaned up head sep, rbuf problems
     55  1.1  oster  *
     56  1.1  oster  * Revision 1.45  1996/07/11  19:08:00  jimz
     57  1.1  oster  * generalize reconstruction mechanism
     58  1.1  oster  * allow raid1 reconstructs via copyback (done with array
     59  1.1  oster  * quiesced, not online, therefore not disk-directed)
     60  1.1  oster  *
     61  1.1  oster  * Revision 1.44  1996/06/19  22:23:01  jimz
     62  1.1  oster  * parity verification is now a layout-configurable thing
     63  1.1  oster  * not all layouts currently support it (correctly, anyway)
     64  1.1  oster  *
     65  1.1  oster  * Revision 1.43  1996/06/19  17:53:48  jimz
     66  1.1  oster  * move GetNumSparePUs, InstallSpareTable ops into layout switch
     67  1.1  oster  *
     68  1.1  oster  * Revision 1.42  1996/06/19  14:56:48  jimz
     69  1.1  oster  * move layout-specific config parsing hooks into RF_LayoutSW_t
     70  1.1  oster  * table in rf_layout.c
     71  1.1  oster  *
     72  1.1  oster  * Revision 1.41  1996/06/10  11:55:47  jimz
     73  1.1  oster  * Straightened out some per-array/not-per-array distinctions, fixed
     74  1.1  oster  * a couple bugs related to confusion. Added shutdown lists. Removed
     75  1.1  oster  * layout shutdown function (now subsumed by shutdown lists).
     76  1.1  oster  *
     77  1.1  oster  * Revision 1.40  1996/06/07  22:26:27  jimz
     78  1.1  oster  * type-ify which_ru (RF_ReconUnitNum_t)
     79  1.1  oster  *
     80  1.1  oster  * Revision 1.39  1996/06/07  21:33:04  jimz
     81  1.1  oster  * begin using consistent types for sector numbers,
     82  1.1  oster  * stripe numbers, row+col numbers, recon unit numbers
     83  1.1  oster  *
     84  1.1  oster  * Revision 1.38  1996/06/03  23:28:26  jimz
     85  1.1  oster  * more bugfixes
     86  1.1  oster  * check in tree to sync for IPDS runs with current bugfixes
     87  1.1  oster  * there still may be a problem with threads in the script test
     88  1.1  oster  * getting I/Os stuck- not trivially reproducible (runs ~50 times
     89  1.1  oster  * in a row without getting stuck)
     90  1.1  oster  *
     91  1.1  oster  * Revision 1.37  1996/05/31  22:26:54  jimz
     92  1.1  oster  * fix a lot of mapping problems, memory allocation problems
     93  1.1  oster  * found some weird lock issues, fixed 'em
     94  1.1  oster  * more code cleanup
     95  1.1  oster  *
     96  1.1  oster  * Revision 1.36  1996/05/30  11:29:41  jimz
     97  1.1  oster  * Numerous bug fixes. Stripe lock release code disagreed with the taking code
     98  1.1  oster  * about when stripes should be locked (I made it consistent: no parity, no lock)
     99  1.1  oster  * There was a lot of extra serialization of I/Os which I've removed- a lot of
    100  1.1  oster  * it was to calculate values for the cache code, which is no longer with us.
    101  1.1  oster  * More types, function, macro cleanup. Added code to properly quiesce the array
    102  1.1  oster  * on shutdown. Made a lot of stuff array-specific which was (bogusly) general
    103  1.1  oster  * before. Fixed memory allocation, freeing bugs.
    104  1.1  oster  *
    105  1.1  oster  * Revision 1.35  1996/05/27  18:56:37  jimz
    106  1.1  oster  * more code cleanup
    107  1.1  oster  * better typing
    108  1.1  oster  * compiles in all 3 environments
    109  1.1  oster  *
    110  1.1  oster  * Revision 1.34  1996/05/24  22:17:04  jimz
    111  1.1  oster  * continue code + namespace cleanup
    112  1.1  oster  * typed a bunch of flags
    113  1.1  oster  *
    114  1.1  oster  * Revision 1.33  1996/05/24  04:28:55  jimz
    115  1.1  oster  * release cleanup ckpt
    116  1.1  oster  *
    117  1.1  oster  * Revision 1.32  1996/05/24  01:59:45  jimz
    118  1.1  oster  * another checkpoint in code cleanup for release
    119  1.1  oster  * time to sync kernel tree
    120  1.1  oster  *
    121  1.1  oster  * Revision 1.31  1996/05/23  21:46:35  jimz
    122  1.1  oster  * checkpoint in code cleanup (release prep)
    123  1.1  oster  * lots of types, function names have been fixed
    124  1.1  oster  *
    125  1.1  oster  * Revision 1.30  1996/05/18  19:51:34  jimz
    126  1.1  oster  * major code cleanup- fix syntax, make some types consistent,
    127  1.1  oster  * add prototypes, clean out dead code, et cetera
    128  1.1  oster  *
    129  1.1  oster  * Revision 1.29  1995/12/01  19:16:19  root
    130  1.1  oster  * added copyright info
    131  1.1  oster  *
    132  1.1  oster  * Revision 1.28  1995/11/28  21:26:49  amiri
    133  1.1  oster  * defined a declustering flag RF_BD_DECLUSTERED
    134  1.1  oster  *
    135  1.1  oster  * Revision 1.27  1995/11/17  19:00:59  wvcii
    136  1.1  oster  * created MapQ entry in switch table
    137  1.1  oster  * added prototyping to MapParity
    138  1.1  oster  *
    139  1.1  oster  * Revision 1.26  1995/11/07  15:40:27  wvcii
    140  1.1  oster  * changed prototype of SeclectionFunc in mapsw
    141  1.1  oster  * function no longer returns numHdrSucc, numTermAnt
    142  1.1  oster  *
    143  1.1  oster  * Revision 1.25  1995/10/12  20:57:08  arw
    144  1.1  oster  * added lots of comments
    145  1.1  oster  *
    146  1.1  oster  * Revision 1.24  1995/10/12  16:04:08  jimz
    147  1.1  oster  * added config name to mapsw
    148  1.1  oster  *
    149  1.1  oster  * Revision 1.23  1995/07/26  03:28:31  robby
    150  1.1  oster  * intermediary checkin
    151  1.1  oster  *
    152  1.1  oster  * Revision 1.22  1995/07/10  20:51:08  robby
    153  1.1  oster  * added to the asm info for the virtual striping locks
    154  1.1  oster  *
    155  1.1  oster  * Revision 1.21  1995/07/10  16:57:47  robby
    156  1.1  oster  * updated alloclistelem struct to the correct struct name
    157  1.1  oster  *
    158  1.1  oster  * Revision 1.20  1995/07/08  20:06:11  rachad
    159  1.1  oster  * *** empty log message ***
    160  1.1  oster  *
    161  1.1  oster  * Revision 1.19  1995/07/08  18:05:39  rachad
    162  1.1  oster  * Linked up Claudsons code with the real cache
    163  1.1  oster  *
    164  1.1  oster  * Revision 1.18  1995/07/06  14:29:36  robby
    165  1.1  oster  * added defaults states list to the layout switch
    166  1.1  oster  *
    167  1.1  oster  * Revision 1.17  1995/06/23  13:40:14  robby
    168  1.1  oster  * updeated to prototypes in rf_layout.h
    169  1.1  oster  *
    170  1.1  oster  * Revision 1.16  1995/06/08  22:11:03  holland
    171  1.1  oster  * bug fixes related to mutiple-row arrays
    172  1.1  oster  *
    173  1.1  oster  * Revision 1.15  1995/05/24  21:43:23  wvcii
    174  1.1  oster  * added field numParityLogCol to RaidLayout
    175  1.1  oster  *
    176  1.1  oster  * Revision 1.14  95/05/02  22:46:53  holland
    177  1.1  oster  * minor code cleanups.
    178  1.1  oster  *
    179  1.1  oster  * Revision 1.13  1995/05/02  12:48:01  holland
    180  1.1  oster  * eliminated some unused code.
    181  1.1  oster  *
    182  1.1  oster  * Revision 1.12  1995/05/01  13:28:00  holland
    183  1.1  oster  * parity range locks, locking disk requests, recon+parityscan in kernel, etc.
    184  1.1  oster  *
    185  1.1  oster  * Revision 1.11  1995/03/15  20:01:17  holland
    186  1.1  oster  * added REMAP and DONT_REMAP
    187  1.1  oster  *
    188  1.1  oster  * Revision 1.10  1995/03/09  19:54:11  rachad
    189  1.1  oster  * Added suport for threadless simulator
    190  1.1  oster  *
    191  1.1  oster  * Revision 1.9  1995/03/03  21:48:58  holland
    192  1.1  oster  * minor changes.
    193  1.1  oster  *
    194  1.1  oster  * Revision 1.8  1995/03/01  20:25:48  holland
    195  1.1  oster  * kernelization changes
    196  1.1  oster  *
    197  1.1  oster  * Revision 1.7  1995/02/03  22:31:36  holland
    198  1.1  oster  * many changes related to kernelization
    199  1.1  oster  *
    200  1.1  oster  * Revision 1.6  1995/01/30  14:53:46  holland
    201  1.1  oster  * extensive changes related to making DoIO non-blocking
    202  1.1  oster  *
    203  1.1  oster  * Revision 1.5  1995/01/24  23:58:46  holland
    204  1.1  oster  * multi-way recon XOR, plus various small changes
    205  1.1  oster  *
    206  1.1  oster  * Revision 1.4  1995/01/04  19:28:35  holland
    207  1.1  oster  * corrected comments around mapsw
    208  1.1  oster  *
    209  1.1  oster  * Revision 1.3  1994/11/28  22:15:45  danner
    210  1.1  oster  * Added type field to the physdiskaddr struct.
    211  1.1  oster  *
    212  1.1  oster  */
    213  1.1  oster 
    214  1.1  oster #ifndef _RF__RF_LAYOUT_H_
    215  1.1  oster #define _RF__RF_LAYOUT_H_
    216  1.1  oster 
    217  1.1  oster #include "rf_types.h"
    218  1.1  oster #include "rf_archs.h"
    219  1.1  oster #include "rf_alloclist.h"
    220  1.1  oster 
    221  1.1  oster /*****************************************************************************************
    222  1.1  oster  *
    223  1.1  oster  * This structure identifies all layout-specific operations and parameters.
    224  1.1  oster  *
    225  1.1  oster  ****************************************************************************************/
    226  1.1  oster 
    227  1.1  oster typedef struct RF_LayoutSW_s {
    228  1.1  oster   RF_ParityConfig_t   parityConfig;
    229  1.1  oster   char               *configName;
    230  1.1  oster 
    231  1.1  oster #ifndef KERNEL
    232  1.1  oster  /* layout-specific parsing */
    233  1.1  oster   int (*MakeLayoutSpecific)(FILE *fp, RF_Config_t *cfgPtr, void *arg);
    234  1.1  oster   void *makeLayoutSpecificArg;
    235  1.1  oster #endif /* !KERNEL */
    236  1.1  oster 
    237  1.1  oster #if RF_UTILITY == 0
    238  1.1  oster  /* initialization routine */
    239  1.1  oster   int (*Configure)(RF_ShutdownList_t **shutdownListp, RF_Raid_t *raidPtr, RF_Config_t *cfgPtr);
    240  1.1  oster 
    241  1.1  oster  /* routine to map RAID sector address -> physical (row, col, offset) */
    242  1.1  oster   void (*MapSector)(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector,
    243  1.1  oster     RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap);
    244  1.1  oster 
    245  1.1  oster  /* routine to map RAID sector address -> physical (r,c,o) of parity unit */
    246  1.1  oster   void (*MapParity)(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector,
    247  1.1  oster     RF_RowCol_t *row, RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap);
    248  1.1  oster 
    249  1.1  oster  /* routine to map RAID sector address -> physical (r,c,o) of Q unit */
    250  1.1  oster   void (*MapQ)(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector, RF_RowCol_t *row,
    251  1.1  oster     RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap);
    252  1.1  oster 
    253  1.1  oster  /* routine to identify the disks comprising a stripe */
    254  1.1  oster   void (*IdentifyStripe)(RF_Raid_t *raidPtr, RF_RaidAddr_t addr,
    255  1.1  oster     RF_RowCol_t **diskids, RF_RowCol_t *outRow);
    256  1.1  oster 
    257  1.1  oster  /* routine to select a dag */
    258  1.1  oster   void (*SelectionFunc)(RF_Raid_t *raidPtr, RF_IoType_t type,
    259  1.1  oster 			RF_AccessStripeMap_t *asmap,
    260  1.1  oster 			RF_VoidFuncPtr *);
    261  1.1  oster #if 0
    262  1.1  oster 			void (**createFunc)(RF_Raid_t *,
    263  1.1  oster 					    RF_AccessStripeMap_t *,
    264  1.1  oster 					    RF_DagHeader_t *, void *,
    265  1.1  oster 					    RF_RaidAccessFlags_t,
    266  1.1  oster 					    RF_AllocListElem_t *));
    267  1.1  oster 
    268  1.1  oster #endif
    269  1.1  oster 
    270  1.1  oster  /* map a stripe ID to a parity stripe ID.  This is typically the identity mapping */
    271  1.1  oster   void (*MapSIDToPSID)(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID,
    272  1.1  oster     RF_StripeNum_t *psID, RF_ReconUnitNum_t *which_ru);
    273  1.1  oster 
    274  1.1  oster  /* get default head separation limit (may be NULL) */
    275  1.1  oster   RF_HeadSepLimit_t (*GetDefaultHeadSepLimit)(RF_Raid_t *raidPtr);
    276  1.1  oster 
    277  1.1  oster  /* get default num recon buffers (may be NULL) */
    278  1.1  oster   int (*GetDefaultNumFloatingReconBuffers)(RF_Raid_t *raidPtr);
    279  1.1  oster 
    280  1.1  oster  /* get number of spare recon units (may be NULL) */
    281  1.1  oster   RF_ReconUnitCount_t (*GetNumSpareRUs)(RF_Raid_t *raidPtr);
    282  1.1  oster 
    283  1.1  oster  /* spare table installation (may be NULL) */
    284  1.1  oster   int (*InstallSpareTable)(RF_Raid_t *raidPtr, RF_RowCol_t frow, RF_RowCol_t fcol);
    285  1.1  oster 
    286  1.1  oster  /* recon buffer submission function */
    287  1.1  oster   int (*SubmitReconBuffer)(RF_ReconBuffer_t *rbuf, int keep_it,
    288  1.1  oster     int use_committed);
    289  1.1  oster 
    290  1.1  oster  /*
    291  1.1  oster   * verify that parity information for a stripe is correct
    292  1.1  oster   * see rf_parityscan.h for return vals
    293  1.1  oster   */
    294  1.1  oster   int (*VerifyParity)(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
    295  1.1  oster     RF_PhysDiskAddr_t *parityPDA, int correct_it, RF_RaidAccessFlags_t flags);
    296  1.1  oster 
    297  1.1  oster  /* number of faults tolerated by this mapping */
    298  1.1  oster   int  faultsTolerated;
    299  1.1  oster 
    300  1.1  oster  /* states to step through in an access. Must end with "LastState".
    301  1.1  oster   * The default is DefaultStates in rf_layout.c */
    302  1.1  oster   RF_AccessState_t *states;
    303  1.1  oster 
    304  1.1  oster   RF_AccessStripeMapFlags_t  flags;
    305  1.1  oster #endif /* RF_UTILITY == 0 */
    306  1.1  oster } RF_LayoutSW_t;
    307  1.1  oster 
    308  1.1  oster /* enables remapping to spare location under dist sparing */
    309  1.1  oster #define RF_REMAP       1
    310  1.1  oster #define RF_DONT_REMAP  0
    311  1.1  oster 
    312  1.1  oster /*
    313  1.1  oster  * Flags values for RF_AccessStripeMapFlags_t
    314  1.1  oster  */
    315  1.1  oster #define RF_NO_STRIPE_LOCKS   0x0001   /* suppress stripe locks */
    316  1.1  oster #define RF_DISTRIBUTE_SPARE  0x0002   /* distribute spare space in archs that support it */
    317  1.1  oster #define RF_BD_DECLUSTERED    0x0004   /* declustering uses block designs */
    318  1.1  oster 
    319  1.1  oster /*************************************************************************
    320  1.1  oster  *
    321  1.1  oster  * this structure forms the layout component of the main Raid
    322  1.1  oster  * structure.  It describes everything needed to define and perform
    323  1.1  oster  * the mapping of logical RAID addresses <-> physical disk addresses.
    324  1.1  oster  *
    325  1.1  oster  *************************************************************************/
    326  1.1  oster struct RF_RaidLayout_s {
    327  1.1  oster   /* configuration parameters */
    328  1.1  oster   RF_SectorCount_t  sectorsPerStripeUnit;   /* number of sectors in one stripe unit */
    329  1.1  oster   RF_StripeCount_t  SUsPerPU;               /* stripe units per parity unit */
    330  1.1  oster   RF_StripeCount_t  SUsPerRU;               /* stripe units per reconstruction unit */
    331  1.1  oster 
    332  1.1  oster   /* redundant-but-useful info computed from the above, used in all layouts */
    333  1.1  oster   RF_StripeCount_t  numStripe;              /* total number of stripes in the array */
    334  1.1  oster   RF_SectorCount_t  dataSectorsPerStripe;
    335  1.1  oster   RF_StripeCount_t  dataStripeUnitsPerDisk;
    336  1.1  oster   u_int             bytesPerStripeUnit;
    337  1.1  oster   u_int             dataBytesPerStripe;
    338  1.1  oster   RF_StripeCount_t  numDataCol;             /* number of SUs of data per stripe (name here is a la RAID4) */
    339  1.1  oster   RF_StripeCount_t  numParityCol;           /* number of SUs of parity per stripe.  Always 1 for now */
    340  1.1  oster   RF_StripeCount_t  numParityLogCol;        /* number of SUs of parity log per stripe.  Always 1 for now */
    341  1.1  oster   RF_StripeCount_t  stripeUnitsPerDisk;
    342  1.1  oster 
    343  1.1  oster   RF_LayoutSW_t *map;               /* ptr to struct holding mapping fns and information */
    344  1.1  oster   void *layoutSpecificInfo;         /* ptr to a structure holding layout-specific params */
    345  1.1  oster };
    346  1.1  oster 
    347  1.1  oster /*****************************************************************************************
    348  1.1  oster  *
    349  1.1  oster  * The mapping code returns a pointer to a list of AccessStripeMap structures, which
    350  1.1  oster  * describes all the mapping information about an access.  The list contains one
    351  1.1  oster  * AccessStripeMap structure per stripe touched by the access.  Each element in the list
    352  1.1  oster  * contains a stripe identifier and a pointer to a list of PhysDiskAddr structuress.  Each
    353  1.1  oster  * element in this latter list describes the physical location of a stripe unit accessed
    354  1.1  oster  * within the corresponding stripe.
    355  1.1  oster  *
    356  1.1  oster  ****************************************************************************************/
    357  1.1  oster 
    358  1.1  oster #define RF_PDA_TYPE_DATA   0
    359  1.1  oster #define RF_PDA_TYPE_PARITY 1
    360  1.1  oster #define RF_PDA_TYPE_Q      2
    361  1.1  oster 
    362  1.1  oster struct RF_PhysDiskAddr_s {
    363  1.1  oster   RF_RowCol_t         row,col;      /* disk identifier */
    364  1.1  oster   RF_SectorNum_t      startSector;  /* sector offset into the disk */
    365  1.1  oster   RF_SectorCount_t    numSector;    /* number of sectors accessed */
    366  1.1  oster   int                 type;         /* used by higher levels: currently, data, parity, or q */
    367  1.1  oster   caddr_t             bufPtr;       /* pointer to buffer supplying/receiving data */
    368  1.1  oster   RF_RaidAddr_t       raidAddress;  /* raid address corresponding to this physical disk address */
    369  1.1  oster   RF_PhysDiskAddr_t  *next;
    370  1.1  oster };
    371  1.1  oster 
    372  1.1  oster #define RF_MAX_FAILED_PDA RF_MAXCOL
    373  1.1  oster 
    374  1.1  oster struct RF_AccessStripeMap_s {
    375  1.1  oster   RF_StripeNum_t             stripeID;                /* the stripe index */
    376  1.1  oster   RF_RaidAddr_t              raidAddress;             /* the starting raid address within this stripe */
    377  1.1  oster   RF_RaidAddr_t              endRaidAddress;          /* raid address one sector past the end of the access */
    378  1.1  oster   RF_SectorCount_t           totalSectorsAccessed;    /* total num sectors identified in physInfo list */
    379  1.1  oster   RF_StripeCount_t           numStripeUnitsAccessed;  /* total num elements in physInfo list */
    380  1.1  oster   int                        numDataFailed;           /* number of failed data disks accessed */
    381  1.1  oster   int                        numParityFailed;         /* number of failed parity disks accessed (0 or 1) */
    382  1.1  oster   int                        numQFailed;              /* number of failed Q units accessed (0 or 1) */
    383  1.1  oster   RF_AccessStripeMapFlags_t  flags;                   /* various flags */
    384  1.1  oster #if 0
    385  1.1  oster   RF_PhysDiskAddr_t         *failedPDA;               /* points to the PDA that has failed */
    386  1.1  oster   RF_PhysDiskAddr_t         *failedPDAtwo;            /* points to the second PDA that has failed, if any */
    387  1.1  oster #else
    388  1.1  oster   int                        numFailedPDAs;           /* number of failed phys addrs */
    389  1.1  oster   RF_PhysDiskAddr_t         *failedPDAs[RF_MAX_FAILED_PDA]; /* array of failed phys addrs */
    390  1.1  oster #endif
    391  1.1  oster   RF_PhysDiskAddr_t         *physInfo;                /* a list of PhysDiskAddr structs */
    392  1.1  oster   RF_PhysDiskAddr_t         *parityInfo;              /* list of physical addrs for the parity (P of P + Q ) */
    393  1.1  oster   RF_PhysDiskAddr_t         *qInfo;                   /* list of physical addrs for the Q of P + Q */
    394  1.1  oster   RF_LockReqDesc_t           lockReqDesc;             /* used for stripe locking */
    395  1.1  oster   RF_RowCol_t                origRow;                 /* the original row:  we may redirect the acc to a different row */
    396  1.1  oster   RF_AccessStripeMap_t      *next;
    397  1.1  oster };
    398  1.1  oster 
    399  1.1  oster /* flag values */
    400  1.1  oster #define RF_ASM_REDIR_LARGE_WRITE   0x00000001 /* allows large-write creation code to redirect failed accs */
    401  1.1  oster #define RF_ASM_BAILOUT_DAG_USED    0x00000002 /* allows us to detect recursive calls to the bailout write dag */
    402  1.1  oster #define RF_ASM_FLAGS_LOCK_TRIED    0x00000004 /* we've acquired the lock on the first parity range in this parity stripe */
    403  1.1  oster #define RF_ASM_FLAGS_LOCK_TRIED2   0x00000008 /* we've acquired the lock on the 2nd   parity range in this parity stripe */
    404  1.1  oster #define RF_ASM_FLAGS_FORCE_TRIED   0x00000010 /* we've done the force-recon call on this parity stripe */
    405  1.1  oster #define RF_ASM_FLAGS_RECON_BLOCKED 0x00000020 /* we blocked recon => we must unblock it later */
    406  1.1  oster 
    407  1.1  oster struct RF_AccessStripeMapHeader_s {
    408  1.1  oster   RF_StripeCount_t             numStripes; /* total number of stripes touched by this acc */
    409  1.1  oster   RF_AccessStripeMap_t        *stripeMap;  /* pointer to the actual map.  Also used for making lists */
    410  1.1  oster   RF_AccessStripeMapHeader_t  *next;
    411  1.1  oster };
    412  1.1  oster 
    413  1.1  oster /*****************************************************************************************
    414  1.1  oster  *
    415  1.1  oster  * various routines mapping addresses in the RAID address space.  These work across
    416  1.1  oster  * all layouts.  DON'T PUT ANY LAYOUT-SPECIFIC CODE HERE.
    417  1.1  oster  *
    418  1.1  oster  ****************************************************************************************/
    419  1.1  oster 
    420  1.1  oster /* return the identifier of the stripe containing the given address */
    421  1.1  oster #define rf_RaidAddressToStripeID(_layoutPtr_, _addr_) \
    422  1.1  oster   ( ((_addr_) / (_layoutPtr_)->sectorsPerStripeUnit) / (_layoutPtr_)->numDataCol )
    423  1.1  oster 
    424  1.1  oster /* return the raid address of the start of the indicates stripe ID */
    425  1.1  oster #define rf_StripeIDToRaidAddress(_layoutPtr_, _sid_) \
    426  1.1  oster   ( ((_sid_) * (_layoutPtr_)->sectorsPerStripeUnit) * (_layoutPtr_)->numDataCol )
    427  1.1  oster 
    428  1.1  oster /* return the identifier of the stripe containing the given stripe unit id */
    429  1.1  oster #define rf_StripeUnitIDToStripeID(_layoutPtr_, _addr_) \
    430  1.1  oster   ( (_addr_) / (_layoutPtr_)->numDataCol )
    431  1.1  oster 
    432  1.1  oster /* return the identifier of the stripe unit containing the given address */
    433  1.1  oster #define rf_RaidAddressToStripeUnitID(_layoutPtr_, _addr_) \
    434  1.1  oster   ( ((_addr_) / (_layoutPtr_)->sectorsPerStripeUnit) )
    435  1.1  oster 
    436  1.1  oster /* return the RAID address of next stripe boundary beyond the given address */
    437  1.1  oster #define rf_RaidAddressOfNextStripeBoundary(_layoutPtr_, _addr_) \
    438  1.1  oster   ( (((_addr_)/(_layoutPtr_)->dataSectorsPerStripe)+1) * (_layoutPtr_)->dataSectorsPerStripe )
    439  1.1  oster 
    440  1.1  oster /* return the RAID address of the start of the stripe containing the given address */
    441  1.1  oster #define rf_RaidAddressOfPrevStripeBoundary(_layoutPtr_, _addr_) \
    442  1.1  oster   ( (((_addr_)/(_layoutPtr_)->dataSectorsPerStripe)+0) * (_layoutPtr_)->dataSectorsPerStripe )
    443  1.1  oster 
    444  1.1  oster /* return the RAID address of next stripe unit boundary beyond the given address */
    445  1.1  oster #define rf_RaidAddressOfNextStripeUnitBoundary(_layoutPtr_, _addr_) \
    446  1.1  oster   ( (((_addr_)/(_layoutPtr_)->sectorsPerStripeUnit)+1L)*(_layoutPtr_)->sectorsPerStripeUnit )
    447  1.1  oster 
    448  1.1  oster /* return the RAID address of the start of the stripe unit containing RAID address _addr_ */
    449  1.1  oster #define rf_RaidAddressOfPrevStripeUnitBoundary(_layoutPtr_, _addr_) \
    450  1.1  oster   ( (((_addr_)/(_layoutPtr_)->sectorsPerStripeUnit)+0)*(_layoutPtr_)->sectorsPerStripeUnit )
    451  1.1  oster 
    452  1.1  oster /* returns the offset into the stripe.  used by RaidAddressStripeAligned */
    453  1.1  oster #define rf_RaidAddressStripeOffset(_layoutPtr_, _addr_) \
    454  1.1  oster   ( (_addr_) % ((_layoutPtr_)->dataSectorsPerStripe) )
    455  1.1  oster 
    456  1.1  oster /* returns the offset into the stripe unit.  */
    457  1.1  oster #define rf_StripeUnitOffset(_layoutPtr_, _addr_) \
    458  1.1  oster   ( (_addr_) % ((_layoutPtr_)->sectorsPerStripeUnit) )
    459  1.1  oster 
    460  1.1  oster /* returns nonzero if the given RAID address is stripe-aligned */
    461  1.1  oster #define rf_RaidAddressStripeAligned( __layoutPtr__, __addr__ ) \
    462  1.1  oster   ( rf_RaidAddressStripeOffset(__layoutPtr__, __addr__) == 0 )
    463  1.1  oster 
    464  1.1  oster /* returns nonzero if the given address is stripe-unit aligned */
    465  1.1  oster #define rf_StripeUnitAligned( __layoutPtr__, __addr__ ) \
    466  1.1  oster   ( rf_StripeUnitOffset(__layoutPtr__, __addr__) == 0 )
    467  1.1  oster 
    468  1.1  oster /* convert an address expressed in RAID blocks to/from an addr expressed in bytes */
    469  1.1  oster #define rf_RaidAddressToByte(_raidPtr_, _addr_) \
    470  1.1  oster   ( (_addr_) << ( (_raidPtr_)->logBytesPerSector ) )
    471  1.1  oster 
    472  1.1  oster #define rf_ByteToRaidAddress(_raidPtr_, _addr_) \
    473  1.1  oster   ( (_addr_) >> ( (_raidPtr_)->logBytesPerSector ) )
    474  1.1  oster 
    475  1.1  oster /* convert a raid address to/from a parity stripe ID.  Conversion to raid address is easy,
    476  1.1  oster  * since we're asking for the address of the first sector in the parity stripe.  Conversion to a
    477  1.1  oster  * parity stripe ID is more complex, since stripes are not contiguously allocated in
    478  1.1  oster  * parity stripes.
    479  1.1  oster  */
    480  1.1  oster #define rf_RaidAddressToParityStripeID(_layoutPtr_, _addr_, _ru_num_) \
    481  1.1  oster   rf_MapStripeIDToParityStripeID( (_layoutPtr_), rf_RaidAddressToStripeID( (_layoutPtr_), (_addr_) ), (_ru_num_) )
    482  1.1  oster 
    483  1.1  oster #define rf_ParityStripeIDToRaidAddress(_layoutPtr_, _psid_) \
    484  1.1  oster   ( (_psid_) * (_layoutPtr_)->SUsPerPU * (_layoutPtr_)->numDataCol * (_layoutPtr_)->sectorsPerStripeUnit )
    485  1.1  oster 
    486  1.1  oster RF_LayoutSW_t *rf_GetLayout(RF_ParityConfig_t parityConfig);
    487  1.1  oster int rf_ConfigureLayout(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
    488  1.1  oster 	RF_Config_t *cfgPtr);
    489  1.1  oster RF_StripeNum_t rf_MapStripeIDToParityStripeID(RF_RaidLayout_t *layoutPtr,
    490  1.1  oster 	RF_StripeNum_t stripeID, RF_ReconUnitNum_t *which_ru);
    491  1.1  oster 
    492  1.1  oster #endif /* !_RF__RF_LAYOUT_H_ */
    493