Home | History | Annotate | Line # | Download | only in raidframe
rf_desc.h revision 1.1
      1 /*	$NetBSD: rf_desc.h,v 1.1 1998/11/13 04:20:28 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  * :
     31  * Log: rf_desc.h,v
     32  * Revision 1.29  1996/07/22 19:52:16  jimz
     33  * switched node params to RF_DagParam_t, a union of
     34  * a 64-bit int and a void *, for better portability
     35  * attempted hpux port, but failed partway through for
     36  * lack of a single C compiler capable of compiling all
     37  * source files
     38  *
     39  * Revision 1.28  1996/06/07  22:49:22  jimz
     40  * fix up raidPtr typing
     41  *
     42  * Revision 1.27  1996/06/07  21:33:04  jimz
     43  * begin using consistent types for sector numbers,
     44  * stripe numbers, row+col numbers, recon unit numbers
     45  *
     46  * Revision 1.26  1996/06/05  18:06:02  jimz
     47  * Major code cleanup. The Great Renaming is now done.
     48  * Better modularity. Better typing. Fixed a bunch of
     49  * synchronization bugs. Made a lot of global stuff
     50  * per-desc or per-array. Removed dead code.
     51  *
     52  * Revision 1.25  1996/06/02  17:31:48  jimz
     53  * Moved a lot of global stuff into array structure, where it belongs.
     54  * Fixed up paritylogging, pss modules in this manner. Some general
     55  * code cleanup. Removed lots of dead code, some dead files.
     56  *
     57  * Revision 1.24  1996/05/30  11:29:41  jimz
     58  * Numerous bug fixes. Stripe lock release code disagreed with the taking code
     59  * about when stripes should be locked (I made it consistent: no parity, no lock)
     60  * There was a lot of extra serialization of I/Os which I've removed- a lot of
     61  * it was to calculate values for the cache code, which is no longer with us.
     62  * More types, function, macro cleanup. Added code to properly quiesce the array
     63  * on shutdown. Made a lot of stuff array-specific which was (bogusly) general
     64  * before. Fixed memory allocation, freeing bugs.
     65  *
     66  * Revision 1.23  1996/05/27  18:56:37  jimz
     67  * more code cleanup
     68  * better typing
     69  * compiles in all 3 environments
     70  *
     71  * Revision 1.22  1996/05/24  22:17:04  jimz
     72  * continue code + namespace cleanup
     73  * typed a bunch of flags
     74  *
     75  * Revision 1.21  1996/05/24  04:28:55  jimz
     76  * release cleanup ckpt
     77  *
     78  * Revision 1.20  1996/05/23  21:46:35  jimz
     79  * checkpoint in code cleanup (release prep)
     80  * lots of types, function names have been fixed
     81  *
     82  * Revision 1.19  1996/05/23  00:33:23  jimz
     83  * code cleanup: move all debug decls to rf_options.c, all extern
     84  * debug decls to rf_options.h, all debug vars preceded by rf_
     85  *
     86  * Revision 1.18  1996/05/18  19:51:34  jimz
     87  * major code cleanup- fix syntax, make some types consistent,
     88  * add prototypes, clean out dead code, et cetera
     89  *
     90  * Revision 1.17  1995/12/01  15:58:43  root
     91  * added copyright info
     92  *
     93  * Revision 1.16  1995/11/19  16:31:30  wvcii
     94  * descriptors now contain an array of dag lists as opposed to a dag header
     95  *
     96  * Revision 1.15  1995/11/07  16:24:17  wvcii
     97  * updated def of _AccessState
     98  *
     99  */
    100 
    101 #ifndef _RF__RF_DESC_H_
    102 #define _RF__RF_DESC_H_
    103 
    104 #include "rf_archs.h"
    105 #include "rf_types.h"
    106 #include "rf_etimer.h"
    107 #include "rf_dag.h"
    108 
    109 struct RF_RaidReconDesc_s {
    110   RF_Raid_t           *raidPtr;      /* raid device descriptor */
    111   RF_RowCol_t          row;          /* row of failed disk */
    112   RF_RowCol_t          col;          /* col of failed disk */
    113   int                  state;        /* how far along the reconstruction operation has gotten */
    114   RF_RaidDisk_t       *spareDiskPtr; /* describes target disk for recon (not used in dist sparing) */
    115   int                  numDisksDone; /* the number of surviving disks that have completed their work */
    116   RF_RowCol_t          srow;         /* row ID of the spare disk (not used in dist sparing) */
    117   RF_RowCol_t          scol;         /* col ID of the spare disk (not used in dist sparing) */
    118 #ifdef KERNEL
    119   /*
    120    * Prevent recon from hogging CPU
    121    */
    122   RF_Etimer_t          recon_exec_timer;
    123   RF_uint64            reconExecTimerRunning;
    124   RF_uint64            reconExecTicks;
    125   RF_uint64            maxReconExecTicks;
    126 #endif /* KERNEL */
    127 
    128 #if RF_RECON_STATS > 0
    129   RF_uint64            hsStallCount;       /* head sep stall count */
    130   RF_uint64            numReconExecDelays;
    131   RF_uint64            numReconEventWaits;
    132 #endif /* RF_RECON_STATS > 0 */
    133   RF_RaidReconDesc_t  *next;
    134 };
    135 
    136 struct RF_RaidAccessDesc_s {
    137   RF_Raid_t              *raidPtr;          /* raid device descriptor */
    138   RF_IoType_t             type;             /* read or write */
    139   RF_RaidAddr_t           raidAddress;      /* starting address in raid address space */
    140   RF_SectorCount_t        numBlocks;        /* number of blocks (sectors) to transfer */
    141   RF_StripeCount_t        numStripes;       /* number of stripes involved in access */
    142   caddr_t                 bufPtr;           /* pointer to data buffer */
    143 
    144 #if !defined(KERNEL) && !defined(SIMULATE)
    145   caddr_t                 obufPtr;          /* real pointer to data buffer */
    146 #endif /* !KERNEL && !SIMULATE */
    147 
    148   RF_RaidAccessFlags_t    flags;            /* flags controlling operation */
    149   int                     state;            /* index into states telling how far along the RAID operation has gotten */
    150   RF_AccessState_t       *states;	        /* array of states to be run */
    151   int                     status;           /* pass/fail status of the last operation */
    152   RF_DagList_t           *dagArray;         /* array of dag lists, one list per stripe */
    153   RF_AccessStripeMapHeader_t  *asmap;       /* the asm for this I/O */
    154   void                   *bp;               /* buf pointer for this RAID acc.  ignored outside the kernel */
    155   RF_DagHeader_t        **paramDAG;         /* allows the DAG to be returned to the caller after I/O completion */
    156   RF_AccessStripeMapHeader_t **paramASM;         /* allows the ASM to be returned to the caller after I/O completion */
    157   RF_AccTraceEntry_t      tracerec;         /* perf monitoring information for a user access (not for dag stats) */
    158   void                  (*callbackFunc)(RF_CBParam_t);  /* callback function for this I/O */
    159   void                   *callbackArg;      /* arg to give to callback func */
    160   int                    tid;               /* debug only, user-level only: thread id of thr that did this access */
    161 
    162   RF_AllocListElem_t    *cleanupList;       /* memory to be freed at the end of the access*/
    163 
    164   RF_RaidAccessDesc_t         *next;
    165   RF_RaidAccessDesc_t         *head;
    166 
    167   int numPending;
    168 
    169   RF_DECLARE_MUTEX(mutex)   /* these are used to implement blocking I/O */
    170   RF_DECLARE_COND(cond)
    171 
    172 #ifdef SIMULATE
    173   RF_Owner_t  owner;
    174   int         async_flag;
    175 #endif /* SIMULATE */
    176 
    177   RF_Etimer_t                 timer;            /* used for timing this access */
    178 };
    179 
    180 #endif /* !_RF__RF_DESC_H_ */
    181