2 * Copyright 2000, International Business Machines Corporation and others.
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
9 * Portions Copyright (c) 2006 Sine Nomine Associates
12 /* file.h - include file for the File Server */
16 /************************************************************************/
18 * Revision 2.2 90/08/29 15:12:11
21 * Revision 2.1 90/08/07 19:46:16
22 * Start with clean version to sync test and dev trees.
25 #ifndef _AFS_VICED_VICED_H
26 #define _AFS_VICED_VICED_H
28 #include <afs/afssyscalls.h>
29 #include <afs/afsutil.h>
30 #include "fs_stats.h" /*Defs for xstat-based statistics */
32 #define AFS_HARDDEADTIME 120
34 typedef struct DirHandle {
35 /* device+inode+vid are low level disk addressing + validity check */
36 /* vid+vnode+unique+cacheCheck are to guarantee validity of cached copy */
37 /* ***NOTE*** size of this stucture must not exceed size in buffer
38 * package (dir/buffer.c. Also, dir/buffer uses the first int as a
39 * hash into the page hash table.
40 * ***NOTE*** The volume, device and inode numbers used to compare
41 * fids are copied out of the handle to allow the handle to be reused
42 * while pages for the old fid are still in the buffer cache.
48 afs_int32 dirh_cacheCheck;
50 IHandle_t *dirh_handle;
55 #define MAXCNTRS (AFS_HIGHEST_OPCODE+1)
58 #define CONSOLENAME "opcons"
59 #define NEWCONNECT "NEWCONNECT"
61 #define FETCHDATAOP 30
69 #define STOREDATAOP 40
77 /* N.B.: the biggest "opcode" here must not be as big as VICELOWEST_OPCODE */
85 #define BIGTIME (0x7FFFFFFF) /* Should be max u_int, rather than max int */
87 struct AFSCallStatistics {
88 /* References to AFS interface calls */
91 afs_uint32 FetchStatus;
94 afs_uint32 StoreStatus;
95 afs_uint32 RemoveFile;
96 afs_uint32 CreateFile;
101 afs_uint32 RemoveDir;
103 afs_uint32 ExtendLock;
104 afs_uint32 ReleaseLock;
105 afs_uint32 GetStatistics;
106 afs_uint32 GiveUpCallBacks;
107 afs_uint32 GetVolumeInfo;
108 afs_uint32 GetVolumeStatus;
109 afs_uint32 SetVolumeStatus;
110 afs_uint32 GetRootVolume;
111 afs_uint32 CheckToken;
113 afs_uint32 GetCapabilities;
115 /* General Fetch/Store Stats */
116 afs_uint32 TotalCalls;
117 afs_uint32 TotalFetchedBytes;
118 afs_uint32 AccumFetchTime;
119 afs_uint32 FetchSize1;
120 afs_uint32 FetchSize2;
121 afs_uint32 FetchSize3;
122 afs_uint32 FetchSize4;
123 afs_uint32 FetchSize5;
124 afs_uint32 TotalStoredBytes;
125 afs_uint32 AccumStoreTime;
126 afs_uint32 StoreSize1;
127 afs_uint32 StoreSize2;
128 afs_uint32 StoreSize3;
129 afs_uint32 StoreSize4;
130 afs_uint32 StoreSize5;
134 afs_int32 BlocksAvailable;
135 afs_int32 TotalBlocks;
139 #define AFS_MSTATSPARES 8
140 #define AFS_MSTATDISKS 10
141 struct AFSStatistics {
142 afs_uint32 CurrentMsgNumber;
143 afs_uint32 OldestMsgNumber;
144 afs_uint32 CurrentTime;
146 afs_uint32 StartTime;
147 afs_int32 CurrentConnections;
148 afs_uint32 TotalAFSCalls;
149 afs_uint32 TotalFetchs;
150 afs_uint32 FetchDatas;
151 afs_uint32 FetchedBytes;
152 afs_int32 FetchDataRate;
153 afs_uint32 TotalStores;
154 afs_uint32 StoreDatas;
155 afs_uint32 StoredBytes;
156 afs_int32 StoreDataRate;
157 afs_uint32 TotalRPCBytesSent;
158 afs_uint32 TotalRPCBytesReceived;
159 afs_uint32 TotalRPCPacketsSent;
160 afs_uint32 TotalRPCPacketsReceived;
161 afs_uint32 TotalRPCPacketsLost;
162 afs_uint32 TotalRPCBogusPackets;
170 afs_int32 EtherNetTotalErrors;
171 afs_int32 EtherNetTotalWrites;
172 afs_int32 EtherNetTotalInterupts;
173 afs_int32 EtherNetGoodReads;
174 afs_int32 EtherNetTotalBytesWritten;
175 afs_int32 EtherNetTotalBytesRead;
176 afs_int32 ProcessSize;
177 afs_int32 WorkStations;
178 afs_int32 ActiveWorkStations;
179 afs_int32 Spares[AFS_MSTATSPARES];
180 struct AFSDisk Disks[AFS_MSTATDISKS];
183 extern int busyonrst;
186 #define RESTART_ORDINARY 1
187 #define RESTART_FAST 2
188 #define RESTART_SAFE 3
193 #define MAX_FILESERVER_THREAD 16384 /* max number of threads in fileserver */
194 #define FILESERVER_HELPER_THREADS 8 /* Listner, IOMGR, FiveMinute, FsyncCk
195 * HostCheck, Signal, min 2 for RXSTATS */
196 #ifdef AFS_PTHREAD_ENV
198 extern pthread_mutex_t fileproc_glock_mutex;
199 #define FS_LOCK MUTEX_ENTER(&fileproc_glock_mutex);
200 #define FS_UNLOCK MUTEX_EXIT(&fileproc_glock_mutex);
201 extern pthread_mutex_t fsync_glock_mutex;
202 #define FSYNC_LOCK MUTEX_ENTER(&fsync_glock_mutex);
203 #define FSYNC_UNLOCK MUTEX_EXIT(&fsync_glock_mutex);
204 #else /* AFS_PTHREAD_ENV */
209 #endif /* AFS_PTHREAD_ENV */
212 #ifdef AFS_DEMAND_ATTACH_FS
215 * fileserver mode support
219 volatile byte FiveMinuteLWP_tranquil; /* five minute check thread is shutdown or sleeping */
220 volatile byte HostCheckLWP_tranquil; /* host check thread is shutdown or sleeping */
221 volatile byte FsyncCheckLWP_tranquil; /* fsync check thread is shutdown or sleeping */
222 volatile byte salvsync_fatal_error; /* fatal error with salvsync comm */
224 /* some command-line options we use in
227 * these fields are immutable once we
228 * go multithreaded */
231 byte fs_state_restore;
232 byte fs_state_verify_before_save;
233 byte fs_state_verify_after_restore;
236 pthread_cond_t worker_done_cv;
237 pthread_rwlock_t state_lock;
240 extern struct fs_state fs_state;
242 /* this lock is defined to be directly above FS_LOCK in the locking hierarchy */
244 #define FS_STATE_INIT fs_stateInit()
246 #define FS_STATE_INIT osi_Assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0)
248 #define FS_STATE_RDLOCK osi_Assert(pthread_rwlock_rdlock(&fs_state.state_lock) == 0)
249 #define FS_STATE_WRLOCK osi_Assert(pthread_rwlock_wrlock(&fs_state.state_lock) == 0)
250 #define FS_STATE_UNLOCK osi_Assert(pthread_rwlock_unlock(&fs_state.state_lock) == 0)
252 #define FS_MODE_NORMAL 0
253 #define FS_MODE_SHUTDOWN 1
254 #endif /* AFS_DEMAND_ATTACH_FS */
257 #endif /* _AFS_VICED_VICED_H */