1 /*        $NetBSD: rf_desc.h,v 1.22 2021/07/23 02:35:14 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@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 #ifndef _RF__RF_DESC_H_
30 #define _RF__RF_DESC_H_
31 
32 #include <dev/raidframe/raidframevar.h>
33 
34 #include "rf_archs.h"
35 #include "rf_etimer.h"
36 #include "rf_dag.h"
37 #include "rf_layout.h"
38 
39 struct RF_RaidReconDesc_s {
40           RF_Raid_t *raidPtr; /* raid device descriptor */
41           RF_RowCol_t col;    /* col of failed disk */
42           RF_RaidDisk_t *spareDiskPtr;  /* describes target disk for recon
43                                                    * (not used in dist sparing) */
44           int     numDisksDone;         /* the number of surviving disks that have
45                                          * completed their work */
46           RF_RowCol_t scol;   /* col ID of the spare disk (not used in dist
47                                          * sparing) */
48           /*
49          * Prevent recon from hogging CPU
50          */
51           RF_Etimer_t recon_exec_timer;
52           RF_uint64 reconExecTimerRunning;
53           RF_uint64 reconExecTicks;
54           RF_uint64 maxReconExecTicks;
55 
56 #if RF_RECON_STATS > 0
57           RF_uint64 hsStallCount;       /* head sep stall count */
58           RF_uint64 numReconExecDelays;
59           RF_uint64 numReconEventWaits;
60 #endif                                  /* RF_RECON_STATS > 0 */
61           RF_RaidReconDesc_t *next;
62 };
63 
64 struct RF_RaidAccessDesc_s {
65           RF_Raid_t *raidPtr; /* raid device descriptor */
66           RF_IoType_t type;   /* read or write */
67           RF_RaidAddr_t raidAddress;    /* starting address in raid address
68                                                    * space */
69           RF_SectorCount_t numBlocks;   /* number of blocks (sectors) to
70                                                    * transfer */
71           RF_StripeCount_t numStripes;  /* number of stripes involved in
72                                                    * access */
73           void *bufPtr;                 /* pointer to data buffer */
74           RF_RaidAccessFlags_t flags;   /* flags controlling operation */
75           int     state;                /* index into states telling how far along the
76                                          * RAID operation has gotten */
77           const RF_AccessState_t *states;         /* array of states to be run */
78           int     status;               /* pass/fail status of the last operation */
79           int     numRetries;     /* number of times this IO has been attempted */
80           RF_DagList_t *dagList;        /* list of dag lists, one list per stripe */
81           RF_VoidPointerListElem_t *iobufs; /* iobufs that need to be cleaned
82                                                        up at the end of this IO */
83           RF_VoidPointerListElem_t *stripebufs; /* stripe buffers that need to
84                                                              be cleaned up at the end of
85                                                              this IO */
86           RF_AccessStripeMapHeader_t *asmap;      /* the asm for this I/O */
87           struct buf *bp;               /* buf pointer for this RAID acc */
88           RF_AccTraceEntry_t tracerec;  /* perf monitoring information for a
89                                                    * user access (not for dag stats) */
90           void    (*callbackFunc) (void *);       /* callback function for this
91                                                              * I/O */
92           void   *callbackArg;          /* arg to give to callback func */
93           RF_RaidAccessDesc_t *next;
94           RF_Etimer_t timer;  /* used for timing this access */
95 };
96 #endif                                  /* !_RF__RF_DESC_H_ */
97