* and it is safe to set the status information for this file.
*/
statSeqNo = bulkStatCounter++;
+ /* ensure against wrapping */
+ if (statSeqNo == 0)
+ statSeqNo = bulkStatCounter++;
/* now we have dir data in the cache, so scan the dir page */
fidIndex = 0;
}
} while (tvcp && retry);
if (!tvcp) { /* otherwise, create manually */
- tvcp = afs_NewVCache(&tfid, hostp);
+ tvcp = afs_NewBulkVCache(&tfid, hostp, statSeqNo);
if (tvcp)
{
ObtainWriteLock(&tvcp->lock, 505);
* if the new length will be ignored when afs_ProcessFS is
* called with new stats. */
#ifdef AFS_SGI_ENV
- if (!(tvcp->f.states & (CStatd | CBulkFetching))
+ if (!(tvcp->f.states & CStatd)
+ && (!((tvcp->f.states & CBulkFetching) &&
+ (tvcp->f.m.Length != statSeqNo)))
&& (tvcp->execsOrWriters <= 0)
&& !afs_DirtyPages(tvcp)
&& !AFS_VN_MAPPED((vnode_t *) tvcp))
#else
- if (!(tvcp->f.states & (CStatd | CBulkFetching))
+ if (!(tvcp->f.states & CStatd)
+ && (!((tvcp->f.states & CBulkFetching) &&
+ (tvcp->f.m.Length != statSeqNo)))
&& (tvcp->execsOrWriters <= 0)
&& !afs_DirtyPages(tvcp))
#endif
* CBulkFetching state bit and the value in the file size.
* It is safe to set the status only if the CBulkFetching
* flag is still set and the value in the file size does
- * not change.
+ * not change. NewBulkVCache sets us up.
*
* Don't fetch status for dirty files. We need to
* preserve the value of the file size. We could
*/
memcpy((char *)(fidsp + fidIndex), (char *)&tfid.Fid,
sizeof(*fidsp));
- tvcp->f.states |= CBulkFetching;
- tvcp->f.m.Length = statSeqNo;
fidIndex++;
}
afs_PutVCache(tvcp);
struct volume *tvolp);
extern struct vcache *afs_NewVCache(struct VenusFid *afid,
struct server *serverp);
+extern struct vcache *afs_NewBulkVCache(struct VenusFid *afid,
+ struct server *serverp, int seq);
extern int afs_VerifyVCache2(struct vcache *avc, struct vrequest *areq);
extern struct vcache *afs_GetVCache(register struct VenusFid *afid,
struct vrequest *areq, afs_int32 * cached,
*
* \return The new vcache struct.
*/
-struct vcache *
-afs_NewVCache(struct VenusFid *afid, struct server *serverp)
+
+static_inline struct vcache *
+afs_NewVCache_int(struct VenusFid *afid, struct server *serverp, int seq)
{
struct vcache *tvc;
afs_int32 i, j;
#endif
panic("afs getnewvnode"); /* can't happen */
#ifdef AFS_FBSD70_ENV
- /* XXX verified on 80--TODO check on 7x */
- if (!vp->v_mount) {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* !glocked */
- insmntque(vp, afs_globalVFS);
- VOP_UNLOCK(vp, 0);
- }
+ /* XXX verified on 80--TODO check on 7x */
+ if (!vp->v_mount) {
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* !glocked */
+ insmntque(vp, afs_globalVFS);
+ VOP_UNLOCK(vp, 0);
+ }
#endif
AFS_GLOCK();
ObtainWriteLock(&afs_xvcache,339);
memset(&(tvc->callsort), 0, sizeof(struct afs_q));
tvc->slocks = NULL;
tvc->f.states &=~ CVInit;
+ if (seq) {
+ tvc->f.states |= CBulkFetching;
+ tvc->f.m.Length = seq;
+ }
afs_osi_Wakeup(&tvc->f.states);
return tvc;
-
} /*afs_NewVCache */
+struct vcache *
+afs_NewVCache(struct VenusFid *afid, struct server *serverp)
+{
+ return afs_NewVCache_int(afid, serverp, 0);
+}
+
+struct vcache *
+afs_NewBulkVCache(struct VenusFid *afid, struct server *serverp, int seq)
+{
+ return afs_NewVCache_int(afid, serverp, seq);
+}
+
/*!
* ???
*