The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/raidframe/rf_paritylog.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: rf_paritylog.h,v 1.4 2001/10/04 15:58:55 oster Exp $   */
    2 /*
    3  * Copyright (c) 1995 Carnegie-Mellon University.
    4  * All rights reserved.
    5  *
    6  * Author: William V. Courtright II
    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@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 /* header file for parity log
   30  *
   31  */
   32 
   33 #ifndef _RF__RF_PARITYLOG_H_
   34 #define _RF__RF_PARITYLOG_H_
   35 
   36 #include <dev/raidframe/raidframevar.h>
   37 
   38 #define RF_DEFAULT_NUM_SECTORS_PER_LOG 64
   39 
   40 typedef int RF_RegionId_t;
   41 
   42 typedef enum RF_ParityRecordType_e {
   43         RF_STOP,
   44         RF_UPDATE,
   45         RF_OVERWRITE
   46 }       RF_ParityRecordType_t;
   47 
   48 struct RF_CommonLogData_s {
   49         RF_DECLARE_MUTEX(mutex) /* protects cnt */
   50         int     cnt;            /* when 0, time to call wakeFunc */
   51         RF_Raid_t *raidPtr;
   52 /*   int                    (*wakeFunc)(struct buf *); */
   53         int     (*wakeFunc) (RF_DagNode_t * node, int status);
   54         void   *wakeArg;
   55         RF_AccTraceEntry_t *tracerec;
   56         RF_Etimer_t startTime;
   57         caddr_t bufPtr;
   58         RF_ParityRecordType_t operation;
   59         RF_CommonLogData_t *next;
   60 };
   61 
   62 struct RF_ParityLogData_s {
   63         RF_RegionId_t regionID; /* this struct guaranteed to span a single
   64                                  * region */
   65         int     bufOffset;      /* offset from common->bufPtr */
   66         RF_PhysDiskAddr_t diskAddress;
   67         RF_CommonLogData_t *common;     /* info shared by one or more
   68                                          * parityLogData structs */
   69         RF_ParityLogData_t *next;
   70         RF_ParityLogData_t *prev;
   71 };
   72 
   73 struct RF_ParityLogAppendQueue_s {
   74         RF_DECLARE_MUTEX(mutex)
   75 };
   76 
   77 struct RF_ParityLogRecord_s {
   78         RF_PhysDiskAddr_t parityAddr;
   79         RF_ParityRecordType_t operation;
   80 };
   81 
   82 struct RF_ParityLog_s {
   83         RF_RegionId_t regionID;
   84         int     numRecords;
   85         int     diskOffset;
   86         RF_ParityLogRecord_t *records;
   87         caddr_t bufPtr;
   88         RF_ParityLog_t *next;
   89 };
   90 
   91 struct RF_ParityLogQueue_s {
   92         RF_DECLARE_MUTEX(mutex)
   93         RF_ParityLog_t *parityLogs;
   94 };
   95 
   96 struct RF_RegionBufferQueue_s {
   97         RF_DECLARE_MUTEX(mutex)
   98         RF_DECLARE_COND(cond)
   99         int     bufferSize;
  100         int     totalBuffers;   /* size of array 'buffers' */
  101         int     availableBuffers;       /* num available 'buffers' */
  102         int     emptyBuffersIndex;      /* stick next freed buffer here */
  103         int     availBuffersIndex;      /* grab next buffer from here */
  104         caddr_t *buffers;       /* array buffers used to hold parity */
  105 };
  106 #define RF_PLOG_CREATED   (1<<0)/* thread is created */
  107 #define RF_PLOG_RUNNING   (1<<1)/* thread is running */
  108 #define RF_PLOG_TERMINATE (1<<2)/* thread is terminated (should exit) */
  109 #define RF_PLOG_SHUTDOWN  (1<<3)/* thread is aware and exiting/exited */
  110 
  111 struct RF_ParityLogDiskQueue_s {
  112         RF_DECLARE_MUTEX(mutex) /* protects all vars in this struct */
  113         RF_DECLARE_COND(cond)
  114         int     threadState;    /* is thread running, should it shutdown  (see
  115                                  * above) */
  116         RF_ParityLog_t *flushQueue;     /* list of parity logs to be flushed
  117                                          * to log disk */
  118         RF_ParityLog_t *reintQueue;     /* list of parity logs waiting to be
  119                                          * reintegrated */
  120         RF_ParityLogData_t *bufHead;    /* head of FIFO list of log data,
  121                                          * waiting on a buffer */
  122         RF_ParityLogData_t *bufTail;    /* tail of FIFO list of log data,
  123                                          * waiting on a buffer */
  124         RF_ParityLogData_t *reintHead;  /* head of FIFO list of log data,
  125                                          * waiting on reintegration */
  126         RF_ParityLogData_t *reintTail;  /* tail of FIFO list of log data,
  127                                          * waiting on reintegration */
  128         RF_ParityLogData_t *logBlockHead;       /* queue of work, blocked
  129                                                  * until a log is available */
  130         RF_ParityLogData_t *logBlockTail;
  131         RF_ParityLogData_t *reintBlockHead;     /* queue of work, blocked
  132                                                  * until reintegration is
  133                                                  * complete */
  134         RF_ParityLogData_t *reintBlockTail;
  135         RF_CommonLogData_t *freeCommonList;     /* list of unused common data
  136                                                  * structs */
  137         RF_ParityLogData_t *freeDataList;       /* list of unused log data
  138                                                  * structs */
  139 };
  140 
  141 struct RF_DiskMap_s {
  142         RF_PhysDiskAddr_t parityAddr;
  143         RF_ParityRecordType_t operation;
  144 };
  145 
  146 struct RF_RegionInfo_s {
  147         RF_DECLARE_MUTEX(mutex) /* protects: diskCount, diskMap,
  148                                  * loggingEnabled, coreLog */
  149         RF_DECLARE_MUTEX(reintMutex)    /* protects: reintInProgress */
  150         int     reintInProgress;/* flag used to suspend flushing operations */
  151         RF_SectorCount_t capacity;      /* capacity of this region in sectors */
  152         RF_SectorNum_t regionStartAddr; /* starting disk address for this
  153                                          * region */
  154         RF_SectorNum_t parityStartAddr; /* starting disk address for this
  155                                          * region */
  156         RF_SectorCount_t numSectorsParity;      /* number of parity sectors
  157                                                  * protected by this region */
  158         RF_SectorCount_t diskCount;     /* num of sectors written to this
  159                                          * region's disk log */
  160         RF_DiskMap_t *diskMap;  /* in-core map of what's in this region's disk
  161                                  * log */
  162         int     loggingEnabled; /* logging enable for this region */
  163         RF_ParityLog_t *coreLog;/* in-core log for this region */
  164 };
  165 
  166 RF_ParityLogData_t *
  167 rf_CreateParityLogData(RF_ParityRecordType_t operation,
  168     RF_PhysDiskAddr_t * pda, caddr_t bufPtr, RF_Raid_t * raidPtr,
  169     int (*wakeFunc) (RF_DagNode_t * node, int status),
  170     void *wakeArg, RF_AccTraceEntry_t * tracerec,
  171     RF_Etimer_t startTime);
  172         RF_ParityLogData_t *rf_SearchAndDequeueParityLogData(RF_Raid_t * raidPtr,
  173             RF_RegionId_t regionID, RF_ParityLogData_t ** head,
  174             RF_ParityLogData_t ** tail, int ignoreLocks);
  175         void    rf_ReleaseParityLogs(RF_Raid_t * raidPtr, RF_ParityLog_t * firstLog);
  176         int     rf_ParityLogAppend(RF_ParityLogData_t * logData, int finish,
  177             RF_ParityLog_t ** incomingLog, int clearReintFlag);
  178         void    rf_EnableParityLogging(RF_Raid_t * raidPtr);
  179 
  180 #endif                          /* !_RF__RF_PARITYLOG_H_ */

Cache object: be52c1fb1b5914a2d7a1749aa3c392ca


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.