cache-server-inlinebulk-support-and-enable-inlinebulk-20011019
[openafs.git] / src / afs / afs.h
index 352c1cf..2424c40 100644 (file)
@@ -63,6 +63,7 @@ extern int afs_shuttingdown;
 #define        PIGGYSIZE       1350        /* max piggyback size */
 #define        MAXVOLS         128         /* max vols we can store */
 #define        MAXSYSNAME      128         /* max sysname (i.e. @sys) size */
+#define MAXNUMSYSNAMES 16          /* max that current constants allow */
 #define        NOTOKTIMEOUT    (2*3600)    /* time after which to timeout conns sans tokens */
 #define        NOPAG           0xffffffff
 #define AFS_NCBRS      300         /* max # of call back return entries */
@@ -74,6 +75,11 @@ extern int afs_shuttingdown;
 #define        AFS_RXDEADTIME  50
 #define AFS_HARDDEADTIME        120
 
+struct sysname_info {
+  char *name;
+  short offset;
+  char index, allocked;
+};
 
 /* flags to use with AFSOP_CACHEINIT */
 #define AFSCALL_INIT_MEMCACHE        0x1         /* use a memory-based cache */
@@ -183,6 +189,7 @@ struct afs_cbr {
 #define        CNoSUID             2       /* 1 if no suid progs can run from this cell */
 #define CHasVolRef        16       /* Volumes were referenced in this cell*/
 #define CLinkedCell       32
+#define CAlias            64       /* This cell entry is an alias */
 
 struct cell {
     struct afs_q lruq;                      /* lru q next and prev */
@@ -194,6 +201,8 @@ struct cell {
     u_short vlport;                        /* volume server port */
     short states;                          /* state flags */
     short cellIndex;                       /* relative index number per cell */
+    time_t timeout;                        /* data expire time, if non-zero */
+    struct cell *alias;                            /* what this cell is an alias for */
 };
 
 #define        afs_PutCell(cellp, locktype)
@@ -320,6 +329,7 @@ struct srvAddr {
 #define        SRVR_ISDOWN                     0x20
 #define        SRVR_MULTIHOMED                 0x40
 #define        SRVR_ISGONE                     0x80
+#define        SNO_INLINEBULK                  0x100
 
 struct server {
     union {
@@ -347,7 +357,7 @@ struct server {
     afs_int32 numDowntimeIncidents;    /* # (completed) downtime incidents */
     afs_int32 sumOfDowntimes;  /* Total downtime experienced, in seconds */
     struct srvAddr *addr;
-    char flags;                        /* Misc flags*/
+    afs_uint32 flags;                  /* Misc flags*/
 };
 
 #define        afs_PutServer(servp, locktype)  
@@ -473,43 +483,59 @@ struct SimpleLocks {
 };
 
 /* vcache state bits */
-#define        CStatd      1           /* has this file ever been stat'd? */
-#define CBackup            2           /* file is on a backup volume */
-#define        CRO         4           /* is it on a read-only volume */
-#define        CMValid     8           /* is the mount point info valid? */
-#define        CCore       0x10        /* storing a core file, needed since we don't get an open */
-#define CDirty      0x20        /* file has been modified since first open (... O_RDWR) */
-#define        CSafeStore  0x40        /* close must wait for store to finish (should be in fd) */
-#define        CMAPPED     0x80        /* Mapped files; primarily used by SunOS 4.0.x */
-#define        CNSHARE     0x100       /* support O_NSHARE semantics */
-#define        CLied       0x200
-#define        CTruth      0x400
+#define CStatd         0x00000001      /* has this file ever been stat'd? */
+#define CBackup                0x00000002      /* file is on a backup volume */
+#define CRO            0x00000004      /* is it on a read-only volume */
+#define CMValid                0x00000008      /* is the mount point info valid? */
+#define CCore          0x00000010      /* storing a core file, needed since we don't get an open */
+#define CDirty         0x00000020      /* file has been modified since first open (... O_RDWR) */
+#define CSafeStore     0x00000040      /* close must wait for store to finish (should be in fd) */
+#define CMAPPED                0x00000080      /* Mapped files; primarily used by SunOS 4.0.x */
+#define CNSHARE                0x00000100      /* support O_NSHARE semantics */
+#define CLied          0x00000200
+#define CTruth         0x00000400
 #ifdef AFS_OSF_ENV
-#define        CWired      0x800       /* OSF hack only */
+#define CWired         0x00000800      /* OSF hack only */
 #else
-#define        CWRITE_IGN  0x800       /* Next OS hack only */
+#define CWRITE_IGN     0x00000800      /* Next OS hack only */
 #endif
-#define        CUnique     0x1000      /* vc's uniquifier - latest unifiquier for fid */
-#define        CForeign    0x2000      /* this is a non-afs vcache */
-#define CHasPages   0x4000
-#define CUnlinked   0x10000
-#define CBulkStat   0x20000    /* loaded by a bulk stat, and not ref'd since */
-#define CUnlinkedDel  0x40000
-#define CVFlushed   0x80000
-#define        CCore1      0x100000    /* osf1 core file; not same as CCore above */
-#define CWritingUFS 0x200000   /* to detect vm deadlock - used by sgi */
-#define CCreating   0x400000   /* avoid needless store after open truncate */
-#define CPageHog    0x800000   /* AIX - dumping large cores is a page hog. */
-#define CDCLock            0x200000    /* Vnode lock held over call to GetDownD */
-#define CBulkFetching 0x4000000 /* stats are being fetched by bulk stat */
-#define CExtendedFile 0x8000000 /* extended file via ftruncate call. */
+#define CUnique                0x00001000      /* vc's uniquifier - latest unifiquier for fid */
+#define CForeign       0x00002000      /* this is a non-afs vcache */
+#define CHasPages      0x00004000
+#define CUnlinked      0x00010000
+#define CBulkStat      0x00020000      /* loaded by a bulk stat, and not ref'd since */
+#define CUnlinkedDel   0x00040000
+#define CVFlushed      0x00080000
+#define CCore1         0x00100000      /* osf1 core file; not same as CCore above */
+#define CWritingUFS    0x00200000      /* to detect vm deadlock - used by sgi */
+#define CCreating      0x00400000      /* avoid needless store after open truncate */
+#define CPageHog       0x00800000      /* AIX - dumping large cores is a page hog. */
+#define CDCLock                0x02000000      /* Vnode lock held over call to GetDownD */
+#define CBulkFetching  0x04000000      /* stats are being fetched by bulk stat */
+#define CExtendedFile  0x08000000      /* extended file via ftruncate call. */
 
 /* vcache vstate bits */
 #define VRevokeWait   0x1
 #define VPageCleaning 0x2      /* Solaris - Cache Trunc Daemon sez keep out */
 
 #define        CPSIZE      2
+#if !defined(AFS_FBSD_ENV)
 #define        vrefCount   v.v_count
+#else
+#define vrefCount   v.v_usecount
+#endif /* AFS_FBSD_ENV */
+
+#ifdef AFS_LINUX24_ENV
+#define VREFCOUNT(v)           atomic_read(&((vnode_t *) v)->v_count)
+#define VREFCOUNT_SET(v, c)    atomic_set(&((vnode_t *) v)->v_count, c)
+#define VREFCOUNT_DEC(v)       atomic_dec(&((vnode_t *) v)->v_count)
+#define VREFCOUNT_INC(v)       atomic_inc(&((vnode_t *) v)->v_count)
+#else
+#define VREFCOUNT(v)           ((v)->vrefCount)
+#define VREFCOUNT_SET(v, c)    (v)->vrefCount = c;
+#define VREFCOUNT_DEC(v)       (v)->vrefCount--;
+#define VREFCOUNT_INC(v)       (v)->vrefCount++;
+#endif
 
 #define        AFS_MAXDV   0x7fffffff      /* largest dataversion number */
 #define        AFS_NOTRUNC 0x7fffffff      /* largest dataversion number */
@@ -935,6 +961,7 @@ extern struct brequest afs_brs[NBRS];               /* request structures */
 
 extern struct cell         *afs_GetCell();
 extern struct cell         *afs_GetCellByName();
+extern struct cell         *afs_GetCellByIndex();
 extern struct unixuser     *afs_GetUser();
 extern struct volume       *afs_GetVolume();
 extern struct volume       *afs_GetVolumeByName();
@@ -967,6 +994,17 @@ extern void afs_shutdown();
 /* afs_osifile.c */
 extern void shutdown_osifile();
 
+/* afs_dynroot.c */
+extern int afs_IsDynrootFid();
+extern void afs_GetDynrootFid();
+extern int afs_IsDynroot();
+extern void afs_RefreshDynroot();
+extern void afs_GetDynroot();
+extern void afs_PutDynroot();
+extern int afs_DynrootNewVnode();
+extern int afs_SetDynrootEnable();
+extern int afs_GetDynrootEnable();
+
 
 /* Performance hack - we could replace VerifyVCache2 with the appropriate
  * GetVCache incantation, and could eliminate even this code from afs_UFSRead 
@@ -1025,6 +1063,7 @@ extern int afs_CacheTooFull;
  * afs_GetDownD wakes those processes once the cache is 95% full
  * (CM_CACHESIZEDRAINEDPCT).
  */
+extern void afs_MaybeWakeupTruncateDaemon();
 extern void afs_CacheTruncateDaemon();
 extern int afs_WaitForCacheDrain;
 #define CM_MAXDISCARDEDCHUNKS  16      /* # of chunks */
@@ -1040,19 +1079,6 @@ extern int afs_WaitForCacheDrain;
      afs_freeDCCount - afs_discardDCCount < \
        ((100-CM_DCACHECOUNTFREEPCT)*afs_cacheFiles)/100)
 
-#define        afs_MaybeWakeupTruncateDaemon() \
-    do { \
-       if (!afs_CacheTooFull && afs_CacheIsTooFull()) { \
-           afs_CacheTooFull = 1; \
-            if (!afs_TruncateDaemonRunning) { \
-               afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); \
-           } \
-       } else if (!afs_TruncateDaemonRunning && \
-                  afs_blocksDiscarded > CM_MAXDISCARDEDCHUNKS) { \
-           afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); \
-       } \
-    } while (0)
-
 /* Handy max length of a numeric string. */
 #define        CVBS    12  /* max afs_int32 is 2^32 ~ 4*10^9, +1 for NULL, +luck */