windows-64bit-data-version-20071114
[openafs.git] / src / WINNT / afsd / cm_scache.h
index 71810a7..01aef07 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __CM_SCACHE_H_ENV__
 #define __CM_SCACHE_H_ENV__ 1
 
-#define MOUNTPOINTLEN   1024
+#define MOUNTPOINTLEN   1024    /* max path length for symlink; same as AFSPATHMAX */
 
 typedef struct cm_fid {
        unsigned long cell;
@@ -85,6 +85,7 @@ typedef struct cm_scache {
     osi_queue_t q;                     /* lru queue; cm_scacheLock */
     afs_uint32      magic;
     struct cm_scache *nextp;           /* next in hash; cm_scacheLock */
+    struct cm_scache *allNextp;         /* next in all scache list; cm_scacheLock */
     cm_fid_t fid;
     afs_uint32 flags;                  /* flags; locked by mx */
 
@@ -115,7 +116,7 @@ typedef struct cm_scache {
     cm_prefetch_t prefetch;            /* prefetch info structure */
     afs_uint32 unixModeBits;           /* unix protection mode bits */
     afs_uint32 linkCount;              /* link count */
-    afs_uint32 dataVersion;            /* data version */
+    afs_uint64 dataVersion;            /* data version */
     afs_uint32 owner;                  /* file owner */
     afs_uint32 group;                  /* file owning group */
     cm_user_t *creator;                        /* user, if new file */
@@ -139,7 +140,7 @@ typedef struct cm_scache {
 
     /* callback info */
     struct cm_server *cbServerp;       /* server granting callback */
-    time_t cbExpires;          /* time callback expires */
+    time_t cbExpires;                  /* time callback expires */
 
     /* access cache */
     long anyAccess;                    /* anonymous user's access */
@@ -160,7 +161,7 @@ typedef struct cm_scache {
                                  */
     unsigned long lastRefreshCycle; /* protected with cm_scacheLock
                                      * for all scaches. */
-    afs_uint32 lockDataVersion; /* dataVersion of the scp at the time
+    afs_uint64  lockDataVersion; /* dataVersion of the scp at the time
                                    the server lock for the scp was
                                    asserted for this lock the last
                                    time. */
@@ -188,6 +189,13 @@ typedef struct cm_scache {
     /* bulk stat progress */
     osi_hyper_t bulkStatProgress;      /* track bulk stats of large dirs */
 
+#ifdef USE_BPLUS
+    /* directory B+ tree */             /* only allocated if is directory */
+    osi_rwlock_t dirlock;               /* controls access to dirBplus */
+    afs_uint64   dirDataVersion;        /* data version represented by dirBplus */
+    struct tree *dirBplus;              /* dirBplus */
+#endif
+
     /* open state */
     afs_uint16 openReads;              /* open for reading */
     afs_uint16 openWrites;             /* open for writing */
@@ -197,6 +205,12 @@ typedef struct cm_scache {
     /* syncop state */
     afs_uint32 waitCount;           /* number of threads waiting */
     afs_uint32 waitRequests;        /* num of thread wait requests */
+    osi_queue_t * waitQueueH;       /* Queue of waiting threads.
+                                       Holds queue of
+                                       cm_scache_waiter_t
+                                       objects. Protected by
+                                       cm_cacheLock. */
+    osi_queue_t * waitQueueT;       /* locked by cm_scacheLock */
 } cm_scache_t;
 
 /* mask field - tell what has been modified */
@@ -288,6 +302,7 @@ typedef struct cm_scache {
                                                 * used to see if we're merging
                                                 * in old info.
                                                  */
+#define CM_MERGEFLAG_STOREDATA         2       /* Merge due to storedata op */
 
 /* hash define.  Must not include the cell, since the callback revocation code
  * doesn't necessarily know the cell in the case of a multihomed server
@@ -297,7 +312,16 @@ typedef struct cm_scache {
                                   ((fidp)->volume +    \
                                    (fidp)->vnode +     \
                                    (fidp)->unique))    \
-                                       % cm_data.hashTableSize)
+                                       % cm_data.scacheHashTableSize)
+
+typedef struct cm_scache_waiter {
+    osi_queue_t q;
+    afs_int32   threadId;
+
+    cm_scache_t *scp;
+    afs_int32   flags;
+    void        *bufp;
+} cm_scache_waiter_t;
 
 #include "cm_conn.h"
 #include "cm_buf.h"
@@ -323,8 +347,11 @@ extern long cm_SyncOp(cm_scache_t *, struct cm_buf *, struct cm_user *,
 
 extern void cm_SyncOpDone(cm_scache_t *, struct cm_buf *, afs_uint32);
 
-extern void cm_MergeStatus(cm_scache_t *, struct AFSFetchStatus *, struct AFSVolSync *,
-       struct cm_user *, afs_uint32 flags);
+extern void cm_MergeStatus(cm_scache_t * dscp, cm_scache_t * scp, 
+                          struct AFSFetchStatus * statusp, 
+                          struct AFSVolSync * volsyncp,
+                          struct cm_user *userp, 
+                          afs_uint32 flags);
 
 extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *);
 
@@ -370,6 +397,8 @@ extern long cm_ValidateSCache(void);
 
 extern long cm_ShutdownSCache(void);
 
+extern void cm_SuspendSCache(void);
+
 extern long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags);
 
 extern void cm_RemoveSCacheFromHashTable(cm_scache_t *scp);