Annotation of sys/dev/raidframe/rf_reconstruct.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: rf_reconstruct.h,v 1.5 2002/12/16 07:01:05 tdeval Exp $ */
! 2: /* $NetBSD: rf_reconstruct.h,v 1.5 2000/05/28 00:48:30 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: * rf_reconstruct.h -- Header file for reconstruction code.
! 33: ***********************************************************/
! 34:
! 35: #ifndef _RF__RF_RECONSTRUCT_H_
! 36: #define _RF__RF_RECONSTRUCT_H_
! 37:
! 38: #include "rf_types.h"
! 39: #include <sys/time.h>
! 40: #include "rf_reconmap.h"
! 41: #include "rf_psstatus.h"
! 42:
! 43: /* Reconstruction configuration information. */
! 44: struct RF_ReconConfig_s {
! 45: unsigned numFloatingReconBufs;
! 46: /*
! 47: * Number of floating recon
! 48: * bufs to use.
! 49: */
! 50: RF_HeadSepLimit_t headSepLimit; /*
! 51: * How far apart the heads are
! 52: * allowed to become, in parity
! 53: * stripes.
! 54: */
! 55: };
! 56:
! 57: /* A reconstruction buffer. */
! 58: struct RF_ReconBuffer_s {
! 59: RF_Raid_t *raidPtr; /*
! 60: * (void *) to avoid recursive
! 61: * includes.
! 62: */
! 63: caddr_t buffer; /* Points to the data. */
! 64: RF_StripeNum_t parityStripeID;/*
! 65: * The parity stripe that this
! 66: * data relates to.
! 67: */
! 68: int which_ru; /*
! 69: * Which reconstruction unit
! 70: * within the PSS.
! 71: */
! 72: RF_SectorNum_t failedDiskSectorOffset;
! 73: /*
! 74: * The offset into the failed
! 75: * disk.
! 76: */
! 77: RF_RowCol_t row, col; /*
! 78: * Which disk this buffer
! 79: * belongs to or is targeted at.
! 80: */
! 81: RF_StripeCount_t count; /*
! 82: * Counts the # of SUs
! 83: * installed so far.
! 84: */
! 85: int priority; /*
! 86: * Used to force high priority
! 87: * recon.
! 88: */
! 89: RF_RbufType_t type; /* FORCED or FLOATING. */
! 90: char *arrived; /*
! 91: * [x] = 1/0 if SU from disk x
! 92: * has/hasn't arrived.
! 93: */
! 94: RF_ReconBuffer_t *next; /*
! 95: * Used for buffer management.
! 96: */
! 97: void *arg; /*
! 98: * Generic field for general
! 99: * use.
! 100: */
! 101: RF_RowCol_t spRow, spCol; /*
! 102: * Spare disk to which this buf
! 103: * should be written.
! 104: */
! 105: /* If dist sparing off, always identifies the replacement disk */
! 106: RF_SectorNum_t spOffset; /*
! 107: * Offset into the spare disk.
! 108: */
! 109: /* If dist sparing off, identical to failedDiskSectorOffset */
! 110: RF_ReconParityStripeStatus_t *pssPtr; /*
! 111: * Debug pss associated with
! 112: * issue-pending write.
! 113: */
! 114: };
! 115:
! 116: /*
! 117: * A reconstruction event descriptor. The event types currently are:
! 118: * RF_REVENT_READDONE -- A read operation has completed.
! 119: * RF_REVENT_WRITEDONE -- A write operation has completed.
! 120: * RF_REVENT_BUFREADY -- The buffer manager has produced a
! 121: * full buffer.
! 122: * RF_REVENT_BLOCKCLEAR -- A reconstruction blockage has been cleared.
! 123: * RF_REVENT_BUFCLEAR -- The buffer manager has released a process
! 124: * blocked on submission.
! 125: * RF_REVENT_SKIP -- We need to skip the current RU and go on
! 126: * to the next one, typ. b/c we found recon
! 127: * forced.
! 128: * RF_REVENT_FORCEDREADONE -- A forced-reconstructoin read operation has
! 129: * completed.
! 130: */
! 131: typedef enum RF_Revent_e {
! 132: RF_REVENT_READDONE,
! 133: RF_REVENT_WRITEDONE,
! 134: RF_REVENT_BUFREADY,
! 135: RF_REVENT_BLOCKCLEAR,
! 136: RF_REVENT_BUFCLEAR,
! 137: RF_REVENT_HEADSEPCLEAR,
! 138: RF_REVENT_SKIP,
! 139: RF_REVENT_FORCEDREADDONE
! 140: } RF_Revent_t;
! 141:
! 142: struct RF_ReconEvent_s {
! 143: RF_Revent_t type; /* What kind of event has occurred. */
! 144: RF_RowCol_t col; /*
! 145: * Row ID is implicit in the queue in
! 146: * which the event is placed.
! 147: */
! 148: void *arg; /* A generic argument. */
! 149: RF_ReconEvent_t *next;
! 150: };
! 151:
! 152: /*
! 153: * Reconstruction control information maintained per-disk.
! 154: * (for surviving disks)
! 155: */
! 156: struct RF_PerDiskReconCtrl_s {
! 157: RF_ReconCtrl_t *reconCtrl;
! 158: RF_RowCol_t row, col; /*
! 159: * To make this structure
! 160: * self-identifying.
! 161: */
! 162: RF_StripeNum_t curPSID; /*
! 163: * The next parity stripe ID
! 164: * to check on this disk.
! 165: */
! 166: RF_HeadSepLimit_t headSepCounter;/*
! 167: * Counter used to control
! 168: * maximum head separation.
! 169: */
! 170: RF_SectorNum_t diskOffset; /*
! 171: * The offset into the
! 172: * indicated disk
! 173: * of the current PU.
! 174: */
! 175: RF_ReconUnitNum_t ru_count; /*
! 176: * This counts off the recon
! 177: * units within each parity
! 178: * unit.
! 179: */
! 180: RF_ReconBuffer_t *rbuf; /*
! 181: * The recon buffer assigned
! 182: * to this disk.
! 183: */
! 184: };
! 185:
! 186: /* Main reconstruction control structure. */
! 187: struct RF_ReconCtrl_s {
! 188: RF_RaidReconDesc_t *reconDesc;
! 189: RF_RowCol_t fcol; /* Which column has failed. */
! 190: RF_PerDiskReconCtrl_t *perDiskInfo; /*
! 191: * Information maintained
! 192: * per-disk.
! 193: */
! 194: RF_ReconMap_t *reconMap; /*
! 195: * Map of what has/has not
! 196: * been reconstructed.
! 197: */
! 198: RF_RowCol_t spareRow; /*
! 199: * Which of the spare disks
! 200: * we're using.
! 201: */
! 202: RF_RowCol_t spareCol;
! 203: RF_StripeNum_t lastPSID; /*
! 204: * The ID of the last
! 205: * parity stripe we want
! 206: * reconstructed.
! 207: */
! 208: int percentComplete;
! 209: /*
! 210: * Percentage completion of
! 211: * reconstruction.
! 212: */
! 213: int numRUsComplete;/*
! 214: * Number of Reconstruction
! 215: * Units done.
! 216: */
! 217: int numRUsTotal; /*
! 218: * Total number of
! 219: * Reconstruction Units.
! 220: */
! 221:
! 222: /* Reconstruction event queue. */
! 223: RF_ReconEvent_t *eventQueue; /*
! 224: * Queue of pending
! 225: * reconstruction events.
! 226: */
! 227: RF_DECLARE_MUTEX (eq_mutex); /*
! 228: * Mutex for locking event
! 229: * queue.
! 230: */
! 231: RF_DECLARE_COND (eq_cond); /*
! 232: * Condition variable for
! 233: * signalling recon events.
! 234: */
! 235: int eq_count; /* Debug only. */
! 236:
! 237: /* Reconstruction buffer management. */
! 238: RF_DECLARE_MUTEX (rb_mutex); /*
! 239: * Mutex for messing around
! 240: * with recon buffers.
! 241: */
! 242: RF_ReconBuffer_t *floatingRbufs; /*
! 243: * Available floating
! 244: * reconstruction buffers.
! 245: */
! 246: RF_ReconBuffer_t *committedRbufs;/*
! 247: * Recon buffers that have
! 248: * been committed to some
! 249: * waiting disk.
! 250: */
! 251: RF_ReconBuffer_t *fullBufferList;/*
! 252: * Full buffers waiting to be
! 253: * written out.
! 254: */
! 255: RF_ReconBuffer_t *priorityList; /*
! 256: * Full buffers that have been
! 257: * elevated to higher priority.
! 258: */
! 259: RF_CallbackDesc_t *bufferWaitList;/*
! 260: * Disks that are currently
! 261: * blocked waiting for buffers.
! 262: */
! 263:
! 264: /* Parity stripe status table. */
! 265: RF_PSStatusHeader_t *pssTable; /*
! 266: * Stores the reconstruction
! 267: * status of active parity
! 268: * stripes.
! 269: */
! 270:
! 271: /* Maximum-head separation control. */
! 272: RF_HeadSepLimit_t minHeadSepCounter;
! 273: /*
! 274: * The minimum hs counter over
! 275: * all disks.
! 276: */
! 277: RF_CallbackDesc_t *headSepCBList; /*
! 278: * List of callbacks to be
! 279: * done as minPSID advances.
! 280: */
! 281:
! 282: /* Performance monitoring. */
! 283: struct timeval starttime; /* Recon start time. */
! 284:
! 285: void (*continueFunc) (void *);
! 286: /*
! 287: * Function to call when io
! 288: * returns.
! 289: */
! 290: void *continueArg; /* Argument for Func. */
! 291: };
! 292:
! 293: /* The default priority for reconstruction accesses. */
! 294: #define RF_IO_RECON_PRIORITY RF_IO_LOW_PRIORITY
! 295:
! 296: int rf_ConfigureReconstruction(RF_ShutdownList_t **);
! 297: int rf_ReconstructFailedDisk(RF_Raid_t *, RF_RowCol_t, RF_RowCol_t);
! 298: int rf_ReconstructFailedDiskBasic(RF_Raid_t *, RF_RowCol_t, RF_RowCol_t);
! 299: int rf_ReconstructInPlace(RF_Raid_t *, RF_RowCol_t, RF_RowCol_t);
! 300: int rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *);
! 301: int rf_ForceOrBlockRecon(RF_Raid_t *, RF_AccessStripeMap_t *,
! 302: void (*) (RF_Raid_t *, void *), void *);
! 303: int rf_UnblockRecon(RF_Raid_t *, RF_AccessStripeMap_t *);
! 304: int rf_RegisterReconDoneProc(RF_Raid_t *, void (*) (RF_Raid_t *, void *),
! 305: void *, RF_ReconDoneProc_t **);
! 306:
! 307: #endif /* !_RF__RF_RECONSTRUCT_H_ */
CVSweb