From: Derrick Brashear Date: Fri, 12 Feb 2010 21:37:19 +0000 (-0500) Subject: add bulk newvcache method X-Git-Tag: openafs-devel-1_5_73~184 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c892043b9545ce6c87a062546b9cdab48f32186e;p=packages%2Fo%2Fopenafs.git add bulk newvcache method let NewVCache return a vcache which is already configured for bulkfetching takes the bulkstatus "sequence number" and sets the flags and length Change-Id: Ife67c3deccda2ceefb4a0f1c98a837a3b6401cd2 Reviewed-on: http://gerrit.openafs.org/1302 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index a47a03432..31a6cc185 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -750,6 +750,9 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * 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; @@ -799,7 +802,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) } } 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); @@ -836,12 +839,16 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * 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 @@ -855,7 +862,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * 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 @@ -863,8 +870,6 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) */ memcpy((char *)(fidsp + fidIndex), (char *)&tfid.Fid, sizeof(*fidsp)); - tvcp->f.states |= CBulkFetching; - tvcp->f.m.Length = statSeqNo; fidIndex++; } afs_PutVCache(tvcp); diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 39d52979b..40e9ec854 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -1012,6 +1012,8 @@ extern struct vcache *afs_GetRootVCache(struct VenusFid *afid, 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, diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 525bf46bf..ade8bc663 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -799,8 +799,9 @@ afs_AllocVCache(void) * * \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; @@ -1049,12 +1050,12 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) #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); @@ -1200,13 +1201,28 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) 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); +} + /*! * ??? *