Annotation of src/sys/dev/raidframe/raidframevar.h, revision 1.2

1.2     ! thorpej     1: /*     $NetBSD: raidframevar.h,v 1.1 2001/10/04 15:43:58 oster Exp $ */
1.1       oster       2: /*-
                      3:  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
                      4:  * All rights reserved.
                      5:  *
                      6:  * This code is derived from software contributed to The NetBSD Foundation
                      7:  * by Greg Oster
                      8:  *
                      9:  * Redistribution and use in source and binary forms, with or without
                     10:  * modification, are permitted provided that the following conditions
                     11:  * are met:
                     12:  * 1. Redistributions of source code must retain the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer.
                     14:  * 2. Redistributions in binary form must reproduce the above copyright
                     15:  *    notice, this list of conditions and the following disclaimer in the
                     16:  *    documentation and/or other materials provided with the distribution.
                     17:  * 3. All advertising materials mentioning features or use of this software
                     18:  *    must display the following acknowledgement:
                     19:  *        This product includes software developed by the NetBSD
                     20:  *        Foundation, Inc. and its contributors.
                     21:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     22:  *    contributors may be used to endorse or promote products derived
                     23:  *    from this software without specific prior written permission.
                     24:  *
                     25:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     26:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     27:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     28:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     29:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     30:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     31:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     32:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     33:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     34:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     35:  * POSSIBILITY OF SUCH DAMAGE.
                     36:  */
                     37: /*
                     38:  * Copyright (c) 1995 Carnegie-Mellon University.
                     39:  * All rights reserved.
                     40:  *
                     41:  * Author: Mark Holland
                     42:  *
                     43:  * Permission to use, copy, modify and distribute this software and
                     44:  * its documentation is hereby granted, provided that both the copyright
                     45:  * notice and this permission notice appear in all copies of the
                     46:  * software, derivative works or modified versions, and any portions
                     47:  * thereof, and that both notices appear in supporting documentation.
                     48:  *
                     49:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     50:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
                     51:  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     52:  *
                     53:  * Carnegie Mellon requests users of this software to return to
                     54:  *
                     55:  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
                     56:  *  School of Computer Science
                     57:  *  Carnegie Mellon University
                     58:  *  Pittsburgh PA 15213-3890
                     59:  *
                     60:  * any improvements or extensions that they make and grant Carnegie the
                     61:  * rights to redistribute these changes.
                     62:  */
                     63: 
                     64: /*
                     65:  * Copyright (c) 1995 Carnegie-Mellon University.
                     66:  * All rights reserved.
                     67:  *
                     68:  * Author: Jim Zelenka
                     69:  *
                     70:  * Permission to use, copy, modify and distribute this software and
                     71:  * its documentation is hereby granted, provided that both the copyright
                     72:  * notice and this permission notice appear in all copies of the
                     73:  * software, derivative works or modified versions, and any portions
                     74:  * thereof, and that both notices appear in supporting documentation.
                     75:  *
                     76:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     77:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
                     78:  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     79:  *
                     80:  * Carnegie Mellon requests users of this software to return to
                     81:  *
                     82:  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
                     83:  *  School of Computer Science
                     84:  *  Carnegie Mellon University
                     85:  *  Pittsburgh PA 15213-3890
                     86:  *
                     87:  * any improvements or extensions that they make and grant Carnegie the
                     88:  * rights to redistribute these changes.
                     89:  */
                     90: 
                     91: /*****************************************************
                     92:  *
                     93:  * raidframevar.h
                     94:  *
                     95:  * main header file for using raidframe in the kernel.
                     96:  *
                     97:  *****************************************************/
                     98: 
                     99: 
                    100: #ifndef _RF_RAIDFRAMEVAR_H_
                    101: #define _RF_RAIDFRAMEVAR_H_
                    102: 
                    103: 
                    104: #include <sys/ioctl.h>
                    105: 
                    106: #include <sys/errno.h>
                    107: #include <sys/types.h>
                    108: 
                    109: #include <sys/uio.h>
                    110: #include <sys/param.h>
                    111: #include <sys/proc.h>
                    112: #include <sys/lock.h>
                    113: 
1.2     ! thorpej   114: #include <sys/mallocvar.h>
        !           115: 
1.1       oster     116: /*
                    117:  * First, define system-dependent types and constants.
                    118:  *
                    119:  * If the machine is big-endian, RF_BIG_ENDIAN should be 1.
                    120:  * Otherwise, it should be 0.
                    121:  *
                    122:  * The various integer types should be self-explanatory; we
                    123:  * use these elsewhere to avoid size confusion.
                    124:  *
                    125:  * LONGSHIFT is lg(sizeof(long)) (that is, log base two of sizeof(long)
                    126:  *
                    127:  */
                    128: 
                    129: #include <sys/types.h>
                    130: #include <machine/endian.h>
                    131: #include <machine/limits.h>
                    132: 
                    133: #if BYTE_ORDER == BIG_ENDIAN
                    134: #define RF_IS_BIG_ENDIAN    1
                    135: #elif BYTE_ORDER == LITTLE_ENDIAN
                    136: #define RF_IS_BIG_ENDIAN    0
                    137: #else
                    138: #error byte order not defined
                    139: #endif
                    140: typedef int8_t RF_int8;
                    141: typedef u_int8_t RF_uint8;
                    142: typedef int16_t RF_int16;
                    143: typedef u_int16_t RF_uint16;
                    144: typedef int32_t RF_int32;
                    145: typedef u_int32_t RF_uint32;
                    146: typedef int64_t RF_int64;
                    147: typedef u_int64_t RF_uint64;
                    148: #if LONG_BIT == 32
                    149: #define RF_LONGSHIFT        2
                    150: #elif LONG_BIT == 64
                    151: #define RF_LONGSHIFT        3
                    152: #else
                    153: #error word size not defined
                    154: #endif
                    155: 
                    156: /*
                    157:  * These are just zero and non-zero. We don't use "TRUE"
                    158:  * and "FALSE" because there's too much nonsense trying
                    159:  * to get them defined exactly once on every platform, given
                    160:  * the different places they may be defined in system header
                    161:  * files.
                    162:  */
                    163: #define RF_TRUE  1
                    164: #define RF_FALSE 0
1.2     ! thorpej   165: 
        !           166: /* Malloc types. */
        !           167: MALLOC_DECLARE(M_RAIDFRAME);
1.1       oster     168: 
                    169: /*
                    170:  * Now, some generic types
                    171:  */
                    172: typedef RF_uint64 RF_IoCount_t;
                    173: typedef RF_uint64 RF_Offset_t;
                    174: typedef RF_uint32 RF_PSSFlags_t;
                    175: typedef RF_uint64 RF_SectorCount_t;
                    176: typedef RF_uint64 RF_StripeCount_t;
                    177: typedef RF_int64 RF_SectorNum_t;/* these are unsigned so we can set them to
                    178:                                 * (-1) for "uninitialized" */
                    179: typedef RF_int64 RF_StripeNum_t;
                    180: typedef RF_int64 RF_RaidAddr_t;
                    181: typedef int RF_RowCol_t;       /* unsigned so it can be (-1) */
                    182: typedef RF_int64 RF_HeadSepLimit_t;
                    183: typedef RF_int64 RF_ReconUnitCount_t;
                    184: typedef int RF_ReconUnitNum_t;
                    185: 
                    186: typedef char RF_ParityConfig_t;
                    187: 
                    188: typedef char RF_DiskQueueType_t[1024];
                    189: #define RF_DISK_QUEUE_TYPE_NONE ""
                    190: 
                    191: /* values for the 'type' field in a reconstruction buffer */
                    192: typedef int RF_RbufType_t;
                    193: #define RF_RBUF_TYPE_EXCLUSIVE   0     /* this buf assigned exclusively to
                    194:                                         * one disk */
                    195: #define RF_RBUF_TYPE_FLOATING    1     /* this is a floating recon buf */
                    196: #define RF_RBUF_TYPE_FORCED      2     /* this rbuf was allocated to complete
                    197:                                         * a forced recon */
                    198: 
                    199: typedef char RF_IoType_t;
                    200: #define RF_IO_TYPE_READ          'r'
                    201: #define RF_IO_TYPE_WRITE         'w'
                    202: #define RF_IO_TYPE_NOP           'n'
                    203: #define RF_IO_IS_R_OR_W(_type_) (((_type_) == RF_IO_TYPE_READ) \
                    204:                                 || ((_type_) == RF_IO_TYPE_WRITE))
                    205: 
                    206: typedef void (*RF_VoidFuncPtr) (void *,...);
                    207: 
                    208: typedef RF_uint32 RF_AccessStripeMapFlags_t;
                    209: typedef RF_uint32 RF_DiskQueueDataFlags_t;
                    210: typedef RF_uint32 RF_DiskQueueFlags_t;
                    211: typedef RF_uint32 RF_RaidAccessFlags_t;
                    212: 
                    213: #define RF_DISKQUEUE_DATA_FLAGS_NONE ((RF_DiskQueueDataFlags_t)0)
                    214: 
                    215: typedef struct RF_AccessStripeMap_s RF_AccessStripeMap_t;
                    216: typedef struct RF_AccessStripeMapHeader_s RF_AccessStripeMapHeader_t;
                    217: typedef struct RF_AllocListElem_s RF_AllocListElem_t;
                    218: typedef struct RF_CallbackDesc_s RF_CallbackDesc_t;
                    219: typedef struct RF_ChunkDesc_s RF_ChunkDesc_t;
                    220: typedef struct RF_CommonLogData_s RF_CommonLogData_t;
                    221: typedef struct RF_Config_s RF_Config_t;
                    222: typedef struct RF_CumulativeStats_s RF_CumulativeStats_t;
                    223: typedef struct RF_DagHeader_s RF_DagHeader_t;
                    224: typedef struct RF_DagList_s RF_DagList_t;
                    225: typedef struct RF_DagNode_s RF_DagNode_t;
                    226: typedef struct RF_DeclusteredConfigInfo_s RF_DeclusteredConfigInfo_t;
                    227: typedef struct RF_DiskId_s RF_DiskId_t;
                    228: typedef struct RF_DiskMap_s RF_DiskMap_t;
                    229: typedef struct RF_DiskQueue_s RF_DiskQueue_t;
                    230: typedef struct RF_DiskQueueData_s RF_DiskQueueData_t;
                    231: typedef struct RF_DiskQueueSW_s RF_DiskQueueSW_t;
                    232: typedef struct RF_Etimer_s RF_Etimer_t;
                    233: typedef struct RF_EventCreate_s RF_EventCreate_t;
                    234: typedef struct RF_FreeList_s RF_FreeList_t;
                    235: typedef struct RF_LockReqDesc_s RF_LockReqDesc_t;
                    236: typedef struct RF_LockTableEntry_s RF_LockTableEntry_t;
                    237: typedef struct RF_MCPair_s RF_MCPair_t;
                    238: typedef struct RF_OwnerInfo_s RF_OwnerInfo_t;
                    239: typedef struct RF_ParityLog_s RF_ParityLog_t;
                    240: typedef struct RF_ParityLogAppendQueue_s RF_ParityLogAppendQueue_t;
                    241: typedef struct RF_ParityLogData_s RF_ParityLogData_t;
                    242: typedef struct RF_ParityLogDiskQueue_s RF_ParityLogDiskQueue_t;
                    243: typedef struct RF_ParityLogQueue_s RF_ParityLogQueue_t;
                    244: typedef struct RF_ParityLogRecord_s RF_ParityLogRecord_t;
                    245: typedef struct RF_PerDiskReconCtrl_s RF_PerDiskReconCtrl_t;
                    246: typedef struct RF_PSStatusHeader_s RF_PSStatusHeader_t;
                    247: typedef struct RF_PhysDiskAddr_s RF_PhysDiskAddr_t;
                    248: typedef struct RF_PropHeader_s RF_PropHeader_t;
                    249: typedef struct RF_Raid_s RF_Raid_t;
                    250: typedef struct RF_RaidAccessDesc_s RF_RaidAccessDesc_t;
                    251: typedef struct RF_RaidDisk_s RF_RaidDisk_t;
                    252: typedef struct RF_RaidLayout_s RF_RaidLayout_t;
                    253: typedef struct RF_RaidReconDesc_s RF_RaidReconDesc_t;
                    254: typedef struct RF_ReconBuffer_s RF_ReconBuffer_t;
                    255: typedef struct RF_ReconConfig_s RF_ReconConfig_t;
                    256: typedef struct RF_ReconCtrl_s RF_ReconCtrl_t;
                    257: typedef struct RF_ReconDoneProc_s RF_ReconDoneProc_t;
                    258: typedef struct RF_ReconEvent_s RF_ReconEvent_t;
                    259: typedef struct RF_ReconMap_s RF_ReconMap_t;
                    260: typedef struct RF_ReconMapListElem_s RF_ReconMapListElem_t;
                    261: typedef struct RF_ReconParityStripeStatus_s RF_ReconParityStripeStatus_t;
                    262: typedef struct RF_RedFuncs_s RF_RedFuncs_t;
                    263: typedef struct RF_RegionBufferQueue_s RF_RegionBufferQueue_t;
                    264: typedef struct RF_RegionInfo_s RF_RegionInfo_t;
                    265: typedef struct RF_ShutdownList_s RF_ShutdownList_t;
                    266: typedef struct RF_SpareTableEntry_s RF_SpareTableEntry_t;
                    267: typedef struct RF_SparetWait_s RF_SparetWait_t;
                    268: typedef struct RF_StripeLockDesc_s RF_StripeLockDesc_t;
                    269: typedef struct RF_ThreadGroup_s RF_ThreadGroup_t;
                    270: typedef struct RF_ThroughputStats_s RF_ThroughputStats_t;
                    271: 
                    272: /*
                    273:  * Important assumptions regarding ordering of the states in this list
                    274:  * have been made!!!  Before disturbing this ordering, look at code in 
                    275:  * sys/dev/raidframe/rf_states.c
                    276:  */
                    277: typedef enum RF_AccessState_e {
                    278:        /* original states */
                    279:        rf_QuiesceState,            /* handles queisence for reconstruction */
                    280:        rf_IncrAccessesCountState,  /* count accesses in flight */
                    281:        rf_DecrAccessesCountState,
                    282:        rf_MapState,                /* map access to disk addresses */
                    283:        rf_LockState,               /* take stripe locks */
                    284:        rf_CreateDAGState,          /* create DAGs */
                    285:        rf_ExecuteDAGState,         /* execute DAGs */
                    286:        rf_ProcessDAGState,         /* DAGs are completing- check if correct,
                    287:                                     * or if we need to retry */
                    288:        rf_CleanupState,            /* release stripe locks, clean up */
                    289:        rf_LastState                /* must be the last state */
                    290: }       RF_AccessState_t;
                    291: 
                    292: 
                    293: /* Some constants related to RAIDframe.  These are arbitrary and 
                    294:    can be modified at will. */
                    295: 
                    296: #define RF_MAXROW    10
                    297: #define RF_MAXCOL    40
                    298: #define RF_MAXSPARE  10
                    299: #define RF_MAXDBGV   75                    /* max number of debug variables */
                    300: #define RF_MAX_DISKS 128           /* max disks per array */
                    301: #define RF_SPAREMAP_NAME_LEN 128
                    302: #define RF_PROTECTED_SECTORS 64L    /* # of sectors at start of disk to
                    303:                                       exclude from RAID address space */
                    304: 
                    305: struct RF_SpareTableEntry_s {
                    306:         u_int   spareDisk;          /* disk to which this block is spared */
                    307:         u_int   spareBlockOffsetInSUs;  /* offset into spare table for that
                    308:                                          * disk */
                    309: };
                    310: 
                    311: union RF_GenericParam_u {
                    312:        void   *p;
                    313:        RF_uint64 v;
                    314: };
                    315: typedef union RF_GenericParam_u RF_DagParam_t;
                    316: typedef union RF_GenericParam_u RF_CBParam_t;
                    317: 
                    318: /* the raidframe configuration, passed down through an ioctl.
                    319:  * the driver can be reconfigured (with total loss of data) at any time,
                    320:  * but it must be shut down first.
                    321:  */
                    322: struct RF_Config_s {
                    323:        RF_RowCol_t numRow, numCol, numSpare;   /* number of rows, columns,
                    324:                                                 * and spare disks */
                    325:        dev_t   devs[RF_MAXROW][RF_MAXCOL];     /* device numbers for disks
                    326:                                                 * comprising array */
                    327:        char    devnames[RF_MAXROW][RF_MAXCOL][50];     /* device names */
                    328:        dev_t   spare_devs[RF_MAXSPARE];        /* device numbers for spare
                    329:                                                 * disks */
                    330:        char    spare_names[RF_MAXSPARE][50];   /* device names */
                    331:        RF_SectorNum_t sectPerSU;       /* sectors per stripe unit */
                    332:        RF_StripeNum_t SUsPerPU;/* stripe units per parity unit */
                    333:        RF_StripeNum_t SUsPerRU;/* stripe units per reconstruction unit */
                    334:        RF_ParityConfig_t parityConfig; /* identifies the RAID architecture to
                    335:                                         * be used */
                    336:        RF_DiskQueueType_t diskQueueType;       /* 'f' = fifo, 'c' = cvscan,
                    337:                                                 * not used in kernel */
                    338:        char    maxOutstandingDiskReqs; /* # concurrent reqs to be sent to a
                    339:                                         * disk.  not used in kernel. */
                    340:        char    debugVars[RF_MAXDBGV][50];      /* space for specifying debug
                    341:                                                 * variables & their values */
                    342:        unsigned int layoutSpecificSize;        /* size in bytes of
                    343:                                                 * layout-specific info */
                    344:        void   *layoutSpecific; /* a pointer to a layout-specific structure to
                    345:                                 * be copied in */
                    346:        int     force;                          /* if !0, ignore many fatal
                    347:                                                   configuration conditions */
                    348:        /* 
                    349:           "force" is used to override cases where the component labels would 
                    350:           indicate that configuration should not proceed without user 
                    351:           intervention
                    352:         */
                    353: };
                    354: 
                    355: typedef RF_uint32 RF_ReconReqFlags_t;
                    356: /* flags that can be put in the rf_recon_req structure */
                    357: #define RF_FDFLAGS_NONE   0x0  /* just fail the disk */
                    358: #define RF_FDFLAGS_RECON  0x1  /* fail and initiate recon */
                    359: 
                    360: struct rf_recon_req {          /* used to tell the kernel to fail a disk */
                    361:        RF_RowCol_t row, col;
                    362:        RF_ReconReqFlags_t flags;
                    363:        void   *raidPtr;        /* used internally; need not be set at ioctl
                    364:                                 * time */
                    365:        struct rf_recon_req *next;      /* used internally; need not be set at
                    366:                                         * ioctl time */
                    367: };
                    368: 
                    369: struct RF_SparetWait_s {
                    370:        int     C, G, fcol;     /* C = # disks in row, G = # units in stripe,
                    371:                                 * fcol = which disk has failed */
                    372: 
                    373:        RF_StripeCount_t SUsPerPU;      /* this stuff is the info required to
                    374:                                         * create a spare table */
                    375:        int     TablesPerSpareRegion;
                    376:        int     BlocksPerTable;
                    377:        RF_StripeCount_t TableDepthInPUs;
                    378:        RF_StripeCount_t SpareSpaceDepthPerRegionInSUs;
                    379: 
                    380:        RF_SparetWait_t *next;  /* used internally; need not be set at ioctl
                    381:                                 * time */
                    382: };
                    383: /*
                    384:  * A physical disk can be in one of several states:
                    385:  * IF YOU ADD A STATE, CHECK TO SEE IF YOU NEED TO MODIFY RF_DEAD_DISK().
                    386:  */
                    387: enum RF_DiskStatus_e {
                    388:         rf_ds_optimal,          /* no problems */
                    389:         rf_ds_failed,           /* reconstruction ongoing */
                    390:         rf_ds_reconstructing,   /* reconstruction complete to spare, dead disk
                    391:                                  * not yet replaced */
                    392:         rf_ds_dist_spared,      /* reconstruction complete to distributed
                    393:                                  * spare space, dead disk not yet replaced */
                    394:         rf_ds_spared,           /* reconstruction complete to distributed
                    395:                                  * spare space, dead disk not yet replaced */
                    396:         rf_ds_spare,            /* an available spare disk */
                    397:         rf_ds_used_spare        /* a spare which has been used, and hence is
                    398:                                  * not available */
                    399: };
                    400: typedef enum RF_DiskStatus_e RF_DiskStatus_t;
                    401: 
                    402: struct RF_RaidDisk_s {
                    403:         char    devname[56];    /* name of device file */
                    404:         RF_DiskStatus_t status; /* whether it is up or down */
                    405:         RF_RowCol_t spareRow;   /* if in status "spared", this identifies the
                    406:                                  * spare disk */
                    407:         RF_RowCol_t spareCol;   /* if in status "spared", this identifies the
                    408:                                  * spare disk */
                    409:         RF_SectorCount_t numBlocks;     /* number of blocks, obtained via READ
                    410:                                          * CAPACITY */
                    411:         int     blockSize;
                    412:         RF_SectorCount_t partitionSize; /* The *actual* and *full* size of 
                    413:                                            the partition, from the disklabel */
                    414:         int     auto_configured;/* 1 if this component was autoconfigured.
                    415:                                    0 otherwise. */
                    416:         dev_t   dev;
                    417: };
                    418: /* The per-component label information that the user can set */
                    419: typedef struct RF_ComponentInfo_s {
                    420:        int row;              /* the row number of this component */
                    421:        int column;           /* the column number of this component */
                    422:        int serial_number;    /* a user-specified serial number for this
                    423:                                 RAID set */
                    424: } RF_ComponentInfo_t;
                    425: 
                    426: /* The per-component label information */
                    427: typedef struct RF_ComponentLabel_s {
                    428:        int version;          /* The version of this label. */
                    429:        int serial_number;    /* a user-specified serial number for this
                    430:                                 RAID set */
                    431:        int mod_counter;      /* modification counter.  Changed (usually
                    432:                                 by incrementing) every time the label 
                    433:                                 is changed */
                    434:        int row;              /* the row number of this component */
                    435:        int column;           /* the column number of this component */
                    436:        int num_rows;         /* number of rows in this RAID set */
                    437:        int num_columns;      /* number of columns in this RAID set */
                    438:        int clean;            /* 1 when clean, 0 when dirty */
                    439:        int status;           /* rf_ds_optimal, rf_ds_dist_spared, whatever. */
                    440:        /* stuff that will be in version 2 of the label */
                    441:        int sectPerSU;        /* Sectors per Stripe Unit */
                    442:        int SUsPerPU;         /* Stripe Units per Parity Units */
                    443:        int SUsPerRU;         /* Stripe Units per Reconstruction Units */
                    444:        int parityConfig;     /* '0' == RAID0, '1' == RAID1, etc. */
                    445:        int maxOutstanding;   /* maxOutstanding disk requests */
                    446:        int blockSize;        /* size of component block. 
                    447:                                 (disklabel->d_secsize) */
                    448:        int numBlocks;        /* number of blocks on this component.  May
                    449:                                 be smaller than the partition size. */
                    450:        int partitionSize;    /* number of blocks on this *partition*. 
                    451:                                 Must exactly match the partition size
                    452:                                 from the disklabel. */
                    453:        int future_use[33];   /* Future expansion */
                    454:        int autoconfigure;    /* automatically configure this RAID set. 
                    455:                                 0 == no, 1 == yes */
                    456:        int root_partition;   /* Use this set as /
                    457:                                 0 == no, 1 == yes*/
                    458:        int last_unit;        /* last unit number (e.g. 0 for /dev/raid0) 
                    459:                                 of this component.  Used for autoconfigure
                    460:                                 only. */
                    461:        int config_order;     /* 0 .. n.  The order in which the component
                    462:                                 should be auto-configured.  E.g. 0 is will 
                    463:                                 done first, (and would become raid0).
                    464:                                 This may be in conflict with last_unit!!?! */
                    465:                              /* Not currently used. */
                    466:        int future_use2[44];  /* More future expansion */
                    467: } RF_ComponentLabel_t;
                    468: 
                    469: typedef struct RF_SingleComponent_s {
                    470:        int row;
                    471:        int column;
                    472:        char component_name[50]; /* name of the component */
                    473: } RF_SingleComponent_t; 
                    474: 
                    475: typedef struct RF_DeviceConfig_s {
                    476:        u_int   rows;
                    477:        u_int   cols;
                    478:        u_int   maxqdepth;
                    479:        int     ndevs;
                    480:        RF_RaidDisk_t devs[RF_MAX_DISKS];
                    481:        int     nspares;
                    482:        RF_RaidDisk_t spares[RF_MAX_DISKS];
                    483: }       RF_DeviceConfig_t;
                    484: 
                    485: typedef struct RF_ProgressInfo_s {
                    486:        RF_uint64 remaining;
                    487:        RF_uint64 completed;
                    488:        RF_uint64 total;
                    489: } RF_ProgressInfo_t;
                    490: 
                    491: typedef struct RF_LayoutSW_s {
                    492:        RF_ParityConfig_t parityConfig;
                    493:        const char *configName;
                    494: 
                    495: #ifndef _KERNEL
                    496:        /* layout-specific parsing */
                    497:        int     (*MakeLayoutSpecific) (FILE * fp, RF_Config_t * cfgPtr, 
                    498:                                       void *arg);
                    499:        void   *makeLayoutSpecificArg;
                    500: #else                          /* !KERNEL */
                    501: 
                    502:        /* initialization routine */
                    503:        int     (*Configure) (RF_ShutdownList_t ** shutdownListp, 
                    504:                              RF_Raid_t * raidPtr, RF_Config_t * cfgPtr);
                    505: 
                    506:        /* routine to map RAID sector address -> physical (row, col, offset) */
                    507:        void    (*MapSector) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector,
                    508:                              RF_RowCol_t * row, RF_RowCol_t * col, 
                    509:                              RF_SectorNum_t * diskSector, int remap);
                    510: 
                    511:        /* routine to map RAID sector address -> physical (r,c,o) of parity
                    512:         * unit */
                    513:        void    (*MapParity) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector,
                    514:                              RF_RowCol_t * row, RF_RowCol_t * col, 
                    515:                              RF_SectorNum_t * diskSector, int remap);
                    516: 
                    517:        /* routine to map RAID sector address -> physical (r,c,o) of Q unit */
                    518:        void    (*MapQ) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector, 
                    519:                         RF_RowCol_t * row, RF_RowCol_t * col, 
                    520:                         RF_SectorNum_t * diskSector, int remap);
                    521: 
                    522:        /* routine to identify the disks comprising a stripe */
                    523:        void    (*IdentifyStripe) (RF_Raid_t * raidPtr, RF_RaidAddr_t addr,
                    524:                                   RF_RowCol_t ** diskids, 
                    525:                                   RF_RowCol_t * outRow);
                    526: 
                    527:        /* routine to select a dag */
                    528:        void    (*SelectionFunc) (RF_Raid_t * raidPtr, RF_IoType_t type,
                    529:                                  RF_AccessStripeMap_t * asmap,
                    530:                                  RF_VoidFuncPtr *);
                    531: 
                    532:        /* map a stripe ID to a parity stripe ID.  This is typically the
                    533:         * identity mapping */
                    534:        void    (*MapSIDToPSID) (RF_RaidLayout_t * layoutPtr, 
                    535:                                 RF_StripeNum_t stripeID,
                    536:                                 RF_StripeNum_t * psID, 
                    537:                                 RF_ReconUnitNum_t * which_ru);
                    538: 
                    539:        /* get default head separation limit (may be NULL) */
                    540:        RF_HeadSepLimit_t(*GetDefaultHeadSepLimit) (RF_Raid_t * raidPtr);
                    541: 
                    542:        /* get default num recon buffers (may be NULL) */
                    543:        int     (*GetDefaultNumFloatingReconBuffers) (RF_Raid_t * raidPtr);
                    544: 
                    545:        /* get number of spare recon units (may be NULL) */
                    546:        RF_ReconUnitCount_t(*GetNumSpareRUs) (RF_Raid_t * raidPtr);
                    547: 
                    548:        /* spare table installation (may be NULL) */
                    549:        int     (*InstallSpareTable) (RF_Raid_t * raidPtr, RF_RowCol_t frow, 
                    550:                                      RF_RowCol_t fcol);
                    551: 
                    552:        /* recon buffer submission function */
                    553:        int     (*SubmitReconBuffer) (RF_ReconBuffer_t * rbuf, int keep_it,
                    554:                                      int use_committed);
                    555: 
                    556:        /*
                    557:          * verify that parity information for a stripe is correct
                    558:          * see rf_parityscan.h for return vals
                    559:          */
                    560:        int     (*VerifyParity) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr,
                    561:                                 RF_PhysDiskAddr_t * parityPDA, 
                    562:                                 int correct_it, RF_RaidAccessFlags_t flags);
                    563: 
                    564:        /* number of faults tolerated by this mapping */
                    565:        int     faultsTolerated;
                    566: 
                    567:        /* states to step through in an access. Must end with "LastState". The
                    568:         * default is DefaultStates in rf_layout.c */
                    569:        RF_AccessState_t *states;
                    570: 
                    571:        RF_AccessStripeMapFlags_t flags;
                    572: #endif                         /* !KERNEL */
                    573: }       RF_LayoutSW_t;
                    574: 
                    575: #endif                         /* !_RF_RAIDFRAMEVAR_H_ */

CVSweb <webmaster@jp.NetBSD.org>