fssync-interface-change-to-deal-with-callback-delays-20021204
[openafs.git] / src / viced / viced.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*  file.h      - include file for the File Server                      */
11 /*                                                                      */
12 /*  Date: 5/1/85                                                        */
13 /*                                                                      */
14 /************************************************************************/
15 /*
16  * Revision 2.2  90/08/29  15:12:11
17  * Cleanups.
18  * 
19  * Revision 2.1  90/08/07  19:46:16
20  * Start with clean version to sync test and dev trees.
21  * */
22
23 #include <afs/afssyscalls.h>
24 #include <afs/afsutil.h>
25 #include "fs_stats.h"   /*Defs for xstat-based statistics*/
26
27 #define AFS_HARDDEADTIME        120
28
29 typedef struct DirHandle {
30     /* device+inode+vid are low level disk addressing + validity check */
31     /* vid+vnode+unique+cacheCheck are to guarantee validity of cached copy */
32     /* ***NOTE*** size of this stucture must not exceed size in buffer
33      * package (dir/buffer.c. Also, dir/buffer uses the first int as a
34      * hash into the page hash table.
35      * ***NOTE*** The volume, device and inode numbers used to compare
36      * fids are copied out of the handle to allow the handle to be reused
37      * while pages for the old fid are still in the buffer cache.
38      */
39     int         dirh_vid;
40     int         dirh_dev;
41     Inode       dirh_ino;
42     VnodeId     dirh_vnode;
43     afs_int32   dirh_cacheCheck;
44     Unique      dirh_unique;
45     IHandle_t   *dirh_handle;
46 } DirHandle;
47
48
49 struct cbcounters {
50     int     DeleteFiles;
51     int     DeleteCallBacks;
52     int     BreakCallBacks;
53     int     AddCallBacks;
54     int     GotSomeSpaces;
55     int     DeleteAllCallBacks;
56     int     nFEs, nCBs, nblks;
57     int     CBsTimedOut;
58     int     nbreakers;
59     int     GSS1, GSS2, GSS3, GSS4, GSS5;
60 };
61
62 #define MAXCNTRS (AFS_HIGHEST_OPCODE+1)
63
64 #define MAXCONSOLE 5
65 #define CONSOLENAME "opcons"
66 #define NEWCONNECT "NEWCONNECT"
67 #define TOTAL 0
68 #define FETCHDATAOP 30
69 #define FETCHDATA 31
70 #define FETCHD1 32
71 #define FETCHD2 33
72 #define FETCHD3 34
73 #define FETCHD4 35
74 #define FETCHD5 36
75 #define FETCHTIME 37
76 #define STOREDATAOP 40
77 #define STOREDATA 41
78 #define STORED1 42
79 #define STORED2 43
80 #define STORED3 44
81 #define STORED4 45
82 #define STORED5 46
83 #define STORETIME 47
84 /* N.B.: the biggest "opcode" here must not be as big as VICELOWEST_OPCODE */
85
86
87 #define SIZE1 1024
88 #define SIZE2 SIZE1*8
89 #define SIZE3 SIZE2*8
90 #define SIZE4 SIZE3*8
91
92 #define BIGTIME (0x7FFFFFFF)    /* Should be max u_int, rather than max int */
93
94 struct AFSCallStatistics
95 {
96         /* References to AFS interface calls */
97         afs_uint32      FetchData;
98         afs_uint32      FetchACL;
99         afs_uint32      FetchStatus;
100         afs_uint32      StoreData;
101         afs_uint32      StoreACL;
102         afs_uint32      StoreStatus;
103         afs_uint32      RemoveFile;
104         afs_uint32      CreateFile;
105         afs_uint32      Rename;
106         afs_uint32      Symlink;
107         afs_uint32      Link;
108         afs_uint32      MakeDir;
109         afs_uint32      RemoveDir;
110         afs_uint32      SetLock;
111         afs_uint32      ExtendLock;     
112         afs_uint32      ReleaseLock;
113         afs_uint32      GetStatistics;
114         afs_uint32      GiveUpCallBacks;
115         afs_uint32      GetVolumeInfo;
116         afs_uint32      GetVolumeStatus;
117         afs_uint32      SetVolumeStatus;
118         afs_uint32      GetRootVolume;
119         afs_uint32      CheckToken;
120         afs_uint32      GetTime;
121
122         /* General Fetch/Store Stats */
123         afs_uint32      TotalCalls;
124         afs_uint32      TotalFetchedBytes;
125         afs_uint32      AccumFetchTime;
126         afs_uint32      FetchSize1;
127         afs_uint32      FetchSize2;
128         afs_uint32      FetchSize3;
129         afs_uint32      FetchSize4;
130         afs_uint32      FetchSize5;
131         afs_uint32      TotalStoredBytes;
132         afs_uint32      AccumStoreTime;
133         afs_uint32      StoreSize1;
134         afs_uint32      StoreSize2;
135         afs_uint32      StoreSize3;
136         afs_uint32      StoreSize4;
137         afs_uint32      StoreSize5;
138 };
139
140 struct AFSDisk
141 {
142         afs_int32               BlocksAvailable;
143         afs_int32               TotalBlocks;
144         DiskName        Name;
145 };
146
147 #define AFS_MSTATSPARES 8
148 #define AFS_MSTATDISKS  10      
149 struct AFSStatistics
150 {
151         afs_uint32      CurrentMsgNumber;
152         afs_uint32      OldestMsgNumber;
153         afs_uint32      CurrentTime;
154         afs_uint32      BootTime;
155         afs_uint32      StartTime;
156         afs_int32       CurrentConnections;
157         afs_uint32      TotalAFSCalls;
158         afs_uint32      TotalFetchs;
159         afs_uint32      FetchDatas;
160         afs_uint32      FetchedBytes;
161         afs_int32       FetchDataRate;
162         afs_uint32      TotalStores;
163         afs_uint32      StoreDatas;
164         afs_uint32      StoredBytes;
165         afs_int32       StoreDataRate;
166         afs_uint32      TotalRPCBytesSent;
167         afs_uint32      TotalRPCBytesReceived;
168         afs_uint32      TotalRPCPacketsSent;
169         afs_uint32      TotalRPCPacketsReceived;
170         afs_uint32      TotalRPCPacketsLost;
171         afs_uint32 TotalRPCBogusPackets;
172         afs_int32       SystemCPU;
173         afs_int32       UserCPU;
174         afs_int32       NiceCPU;
175         afs_int32       IdleCPU;
176         afs_int32       TotalIO;
177         afs_int32       ActiveVM;
178         afs_int32       TotalVM;
179         afs_int32       EtherNetTotalErrors;
180         afs_int32       EtherNetTotalWrites;
181         afs_int32       EtherNetTotalInterupts;
182         afs_int32       EtherNetGoodReads;
183         afs_int32       EtherNetTotalBytesWritten;
184         afs_int32       EtherNetTotalBytesRead;
185         afs_int32       ProcessSize;
186         afs_int32       WorkStations;
187         afs_int32       ActiveWorkStations;
188         afs_int32       Spares[AFS_MSTATSPARES];
189         struct AFSDisk  Disks[AFS_MSTATDISKS];
190 };
191
192 #define RESTART_ORDINARY 1
193 #define RESTART_FAST 2
194 #define RESTART_SAFE 3
195
196 #define DONTPANIC 0
197 #define PANIC 1
198
199 #define MAX_FILESERVER_THREAD   128 /* max number of threads in fileserver, subject to system limits */
200
201 #define FILESERVER_HELPER_THREADS 7 /* Listner, IOMGR, FiveMinute, 
202                                         HostCheck, Signal, min 2 for RXSTATS */
203 #ifdef AFS_PTHREAD_ENV
204 #include <pthread.h>
205 #include <assert.h>
206 extern pthread_mutex_t fileproc_glock_mutex;
207 #define FS_LOCK \
208     assert(pthread_mutex_lock(&fileproc_glock_mutex) == 0);
209 #define FS_UNLOCK \
210     assert(pthread_mutex_unlock(&fileproc_glock_mutex) == 0);
211 extern pthread_mutex_t fsync_glock_mutex;
212 #define FSYNC_LOCK \
213     assert(pthread_mutex_lock(&fsync_glock_mutex) == 0);
214 #define FSYNC_UNLOCK \
215     assert(pthread_mutex_unlock(&fsync_glock_mutex) == 0);
216 #else /* AFS_PTHREAD_ENV */
217 #define FS_LOCK
218 #define FS_UNLOCK
219 #define FSYNC_LOCK
220 #define FSYNC_UNLOCK
221 #endif /* AFS_PTHREAD_ENV */