[BACK]Return to rf_psstatus.h CVS log [TXT][DIR] Up to [local] / sys / dev / raidframe

Annotation of sys/dev/raidframe/rf_psstatus.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: rf_psstatus.h,v 1.3 2002/12/16 07:01:04 tdeval Exp $  */
        !             2: /*     $NetBSD: rf_psstatus.h,v 1.3 1999/02/05 00:06:15 oster Exp $    */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1995 Carnegie-Mellon University.
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Author: Mark Holland
        !             9:  *
        !            10:  * Permission to use, copy, modify and distribute this software and
        !            11:  * its documentation is hereby granted, provided that both the copyright
        !            12:  * notice and this permission notice appear in all copies of the
        !            13:  * software, derivative works or modified versions, and any portions
        !            14:  * thereof, and that both notices appear in supporting documentation.
        !            15:  *
        !            16:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
        !            17:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
        !            18:  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
        !            19:  *
        !            20:  * Carnegie Mellon requests users of this software to return to
        !            21:  *
        !            22:  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
        !            23:  *  School of Computer Science
        !            24:  *  Carnegie Mellon University
        !            25:  *  Pittsburgh PA 15213-3890
        !            26:  *
        !            27:  * any improvements or extensions that they make and grant Carnegie the
        !            28:  * rights to redistribute these changes.
        !            29:  */
        !            30:
        !            31: /*****************************************************************************
        !            32:  *
        !            33:  * psstatus.h
        !            34:  *
        !            35:  * The reconstruction code maintains a bunch of status related to the parity
        !            36:  * stripes that are currently under reconstruction. This header file defines
        !            37:  * the status structures.
        !            38:  *
        !            39:  *****************************************************************************/
        !            40:
        !            41: #ifndef        _RF__RF_PSSTATUS_H_
        !            42: #define        _RF__RF_PSSTATUS_H_
        !            43:
        !            44: #include "rf_types.h"
        !            45: #include "rf_threadstuff.h"
        !            46: #include "rf_callback.h"
        !            47:
        !            48: #define        RF_PS_MAX_BUFS                   10     /*
        !            49:                                                 * Max number of bufs we'll
        !            50:                                                 * accumulate before we do
        !            51:                                                 * an XOR.
        !            52:                                                 */
        !            53:
        !            54: #define        RF_PSS_DEFAULT_TABLESIZE        200
        !            55:
        !            56: /*
        !            57:  * Macros to acquire/release the mutex lock on a parity stripe status
        !            58:  * descriptor. Note that we use just one lock for the whole hash chain.
        !            59:  */
        !            60: /* Simple hash function. */
        !            61: #define        RF_HASH_PSID(_raid_,_psid_)     ((_psid_) % ((_raid_)->pssTableSize))
        !            62:
        !            63: #define        RF_LOCK_PSS_MUTEX(_raidPtr,_row,_psid)                          \
        !            64:        RF_LOCK_MUTEX((_raidPtr)->reconControl[_row]                    \
        !            65:            ->pssTable[RF_HASH_PSID(_raidPtr, _psid)].mutex)
        !            66: #define        RF_UNLOCK_PSS_MUTEX(_raidPtr, _row, _psid)                      \
        !            67:        RF_UNLOCK_MUTEX((_raidPtr)->reconControl[_row]                  \
        !            68:            ->pssTable[RF_HASH_PSID(_raidPtr, _psid)].mutex)
        !            69:
        !            70: struct RF_ReconParityStripeStatus_s {
        !            71:        RF_StripeNum_t           parityStripeID;/* The parity stripe ID. */
        !            72:        RF_ReconUnitNum_t        which_ru;      /*
        !            73:                                                 * Which reconstruction unit
        !            74:                                                 * with the indicated parity
        !            75:                                                 * stripe.
        !            76:                                                 */
        !            77:        RF_PSSFlags_t            flags;         /*
        !            78:                                                 * Flags indicating various
        !            79:                                                 * conditions.
        !            80:                                                 */
        !            81:        void                    *rbuf;          /*
        !            82:                                                 * This is the accumulating
        !            83:                                                 * xor sum.
        !            84:                                                 */
        !            85:        void                    *writeRbuf;     /*
        !            86:                                                 * DEBUG ONLY:  A pointer to
        !            87:                                                 * the rbuf after it has filled
        !            88:                                                 * & been sent to disk.
        !            89:                                                 */
        !            90:        void                    *rbufsForXor[RF_PS_MAX_BUFS];
        !            91:                                                /*
        !            92:                                                 * These are buffers still to
        !            93:                                                 * be xored into the
        !            94:                                                 * accumulating sum.
        !            95:                                                 */
        !            96:        int                      xorBufCount;   /*
        !            97:                                                 * Num buffers waiting to be
        !            98:                                                 * xored.
        !            99:                                                 */
        !           100:        int                      blockCount;    /*
        !           101:                                                 * Count of # proc that have
        !           102:                                                 * blocked recon on this parity
        !           103:                                                 * stripe.
        !           104:                                                 */
        !           105:        char                    *issued;        /*
        !           106:                                                 * issued[i]==1 <=> column i
        !           107:                                                 * has already issued a read
        !           108:                                                 * request for the indicated
        !           109:                                                 * RU.
        !           110:                                                 */
        !           111:        RF_CallbackDesc_t       *procWaitList;  /*
        !           112:                                                 * List of user procs waiting
        !           113:                                                 * for recon to be done.
        !           114:                                                 */
        !           115:        RF_CallbackDesc_t       *blockWaitList; /*
        !           116:                                                 * List of disks blocked
        !           117:                                                 * waiting for user write to
        !           118:                                                 * complete.
        !           119:                                                 */
        !           120:        RF_CallbackDesc_t       *bufWaitList;   /*
        !           121:                                                 * List of disks blocked
        !           122:                                                 * waiting to acquire a buffer
        !           123:                                                 * for this RU.
        !           124:                                                 */
        !           125:        RF_ReconParityStripeStatus_t *next;
        !           126: };
        !           127:
        !           128: struct RF_PSStatusHeader_s {
        !           129:        RF_DECLARE_MUTEX(mutex);                /* Mutex for this hash chain. */
        !           130:        RF_ReconParityStripeStatus_t *chain;    /* The hash chain. */
        !           131: };
        !           132:
        !           133: /* Masks for the "flags" field above. */
        !           134: #define        RF_PSS_NONE             0x00000000      /* No flags. */
        !           135: #define        RF_PSS_UNDER_RECON      0x00000001      /*
        !           136:                                                 * This parity stripe is
        !           137:                                                 * currently under
        !           138:                                                 * reconstruction.
        !           139:                                                 */
        !           140: #define        RF_PSS_FORCED_ON_WRITE  0x00000002      /*
        !           141:                                                 * Indicates a recon was
        !           142:                                                 * forced due to a user-write
        !           143:                                                 * operation.
        !           144:                                                 */
        !           145: #define        RF_PSS_FORCED_ON_READ   0x00000004      /*
        !           146:                                                 * Ditto for read, but not
        !           147:                                                 * currently implemented.
        !           148:                                                 */
        !           149: #define        RF_PSS_RECON_BLOCKED    0x00000008      /*
        !           150:                                                 * Reconstruction is currently
        !           151:                                                 * blocked due to a pending
        !           152:                                                 * user I/O.
        !           153:                                                 */
        !           154: #define        RF_PSS_CREATE           0x00000010      /*
        !           155:                                                 * Tells LookupRUStatus to
        !           156:                                                 * create the entry.
        !           157:                                                 */
        !           158: #define        RF_PSS_BUFFERWAIT       0x00000020      /*
        !           159:                                                 * Someone is waiting for a
        !           160:                                                 * buffer for this RU.
        !           161:                                                 */
        !           162:
        !           163: int  rf_ConfigurePSStatus(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *);
        !           164: RF_PSStatusHeader_t *rf_MakeParityStripeStatusTable(RF_Raid_t *);
        !           165: void rf_FreeParityStripeStatusTable(RF_Raid_t *, RF_PSStatusHeader_t *);
        !           166: RF_ReconParityStripeStatus_t *rf_LookupRUStatus(RF_Raid_t *,
        !           167:        RF_PSStatusHeader_t *, RF_StripeNum_t, RF_ReconUnitNum_t,
        !           168:        RF_PSSFlags_t, int *);
        !           169: void rf_PSStatusDelete(RF_Raid_t *, RF_PSStatusHeader_t *,
        !           170:        RF_ReconParityStripeStatus_t *);
        !           171: void rf_RemoveFromActiveReconTable(RF_Raid_t *, RF_RowCol_t,
        !           172:        RF_StripeNum_t, RF_ReconUnitNum_t);
        !           173: RF_ReconParityStripeStatus_t *rf_AllocPSStatus(RF_Raid_t *);
        !           174: void rf_FreePSStatus(RF_Raid_t *, RF_ReconParityStripeStatus_t *);
        !           175: void rf_PrintPSStatusTable(RF_Raid_t *, RF_RowCol_t);
        !           176:
        !           177: #endif /* !_RF__RF_PSSTATUS_H_ */

CVSweb