From: Simon Wilkinson Date: Mon, 26 Jan 2009 19:33:06 +0000 (+0000) Subject: discon-allow-saving-vcaches-on-shutdown-20090126 X-Git-Tag: openafs-devel-1_5_61~569 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=8552f84b8ed0bce52dab1fd168054038d6ce20a9 discon-allow-saving-vcaches-on-shutdown-20090126 LICENSE IPL10 FIXES 124211 restructure so we can save info necessary to keep dirty changes across offline shutdown --- diff --git a/src/afs/AIX/osi_vfsops.c b/src/afs/AIX/osi_vfsops.c index 9c51c67..31eab8e 100644 --- a/src/afs/AIX/osi_vfsops.c +++ b/src/afs/AIX/osi_vfsops.c @@ -115,7 +115,7 @@ afs_root_nolock(struct vfs *afsp, struct vnode **avpp) register struct vcache *tvp = 0; AFS_STATCNT(afs_root); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { struct ucred *credp; diff --git a/src/afs/AIX/osi_vm.c b/src/afs/AIX/osi_vm.c index 336db19..bc0ff13 100644 --- a/src/afs/AIX/osi_vm.c +++ b/src/afs/AIX/osi_vm.c @@ -101,8 +101,8 @@ osi_VM_StoreAllSegments(struct vcache *avc) * avc was "VN_HELD" and "crheld" when CCore was set in * afs_FakeClose */ - if (avc->states & CCore) { - avc->states &= ~CCore; + if (avc->f.states & CCore) { + avc->f.states &= ~CCore; avc->opens--; avc->execsOrWriters--; AFS_RELE(AFSTOV(avc)); diff --git a/src/afs/AIX/osi_vnodeops.c b/src/afs/AIX/osi_vnodeops.c index 33958e6..d21af26 100644 --- a/src/afs/AIX/osi_vnodeops.c +++ b/src/afs/AIX/osi_vnodeops.c @@ -277,7 +277,7 @@ afs_gn_open(struct vnode *vp, } if (flags & FNSHARE) - tvp->states |= CNSHARE; + tvp->f.states |= CNSHARE; if (!error) { *vinfop = cred; /* fp->f_vinfo is like fp->f_cred in suns */ @@ -378,9 +378,9 @@ afs_gn_rele(struct vnode *vp) if (vp->v_count == 0) osi_Panic("afs_rele: zero v_count"); if (--(vp->v_count) == 0) { - if (vcp->states & CPageHog) { + if (vcp->f.states & CPageHog) { vmPageHog--; - vcp->states &= ~CPageHog; + vcp->f.states &= ~CPageHog; } error = afs_inactive(vp, 0); } @@ -401,7 +401,7 @@ afs_gn_close(struct vnode *vp, AFS_STATCNT(afs_gn_close); if (flags & FNSHARE) { - tvp->states &= ~CNSHARE; + tvp->f.states &= ~CNSHARE; afs_osi_Wakeup(&tvp->opens); } @@ -437,14 +437,14 @@ afs_gn_map(struct vnode *vp, #endif osi_FlushPages(vcp, cred); /* XXX ensure old pages are gone XXX */ ObtainWriteLock(&vcp->lock, 401); - vcp->states |= CMAPPED; /* flag cleared at afs_inactive */ + vcp->f.states |= CMAPPED; /* flag cleared at afs_inactive */ /* * We map the segment into our address space using the handle returned by vm_create. */ if (!vcp->segid) { - afs_uint32 tlen = vcp->m.Length; + afs_uint32 tlen = vcp->f.m.Length; #ifdef AFS_64BIT_CLIENT - if (vcp->m.Length > afs_vmMappingEnd) + if (vcp->f.m.Length > afs_vmMappingEnd) tlen = afs_vmMappingEnd; #endif /* Consider V_INTRSEG too for interrupts */ @@ -812,7 +812,7 @@ afs_gn_rdwr(struct vnode *vp, if (ubuf->afsio_offset < afs_vmMappingEnd) { #endif /* AFS_64BIT_CLIENT */ ObtainWriteLock(&vcp->lock, 240); - vcp->states |= CDirty; /* Set the dirty bit */ + vcp->f.states |= CDirty; /* Set the dirty bit */ afs_FakeOpen(vcp); ReleaseWriteLock(&vcp->lock); #ifdef AFS_64BIT_CLIENT @@ -880,7 +880,7 @@ afs_vm_rdwr(struct vnode *vp, return 0; ObtainReadLock(&vcp->lock); - fileSize = vcp->m.Length; + fileSize = vcp->f.m.Length; if (rw == UIO_WRITE && (ioflag & IO_APPEND)) { /* handle IO_APPEND mode */ uiop->afsio_offset = fileSize; } @@ -953,9 +953,9 @@ afs_vm_rdwr(struct vnode *vp, #endif /* AFS_64BIT_CLIENT */ if (!vcp->segid) { - afs_uint32 tlen = vcp->m.Length; + afs_uint32 tlen = vcp->f.m.Length; #ifdef AFS_64BIT_CLIENT - if (vcp->m.Length > afs_vmMappingEnd) + if (vcp->f.m.Length > afs_vmMappingEnd) tlen = afs_vmMappingEnd; #endif /* Consider V_INTRSEG too for interrupts */ @@ -1023,21 +1023,21 @@ afs_vm_rdwr(struct vnode *vp, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(xfrSize)); ReleaseReadLock(&vcp->lock); ObtainWriteLock(&vcp->lock, 400); - vcp->m.Date = osi_Time(); /* Set file date (for ranlib) */ + vcp->f.m.Date = osi_Time(); /* Set file date (for ranlib) */ /* extend file */ /* un-protect last page. */ - last_page = vcp->m.Length / PAGESIZE; + last_page = vcp->f.m.Length / PAGESIZE; #ifdef AFS_64BIT_CLIENT - if (vcp->m.Length > afs_vmMappingEnd) + if (vcp->f.m.Length > afs_vmMappingEnd) last_page = afs_vmMappingEnd / PAGESIZE; #endif vm_protectp(vcp->segid, last_page, 1, FILEKEY); if (xfrSize + xfrOffset > fileSize) { - vcp->m.Length = xfrSize + xfrOffset; + vcp->f.m.Length = xfrSize + xfrOffset; } - if ((!(vcp->states & CPageHog)) && (xfrSize >= MIN_PAGE_HOG_SIZE)) { + if ((!(vcp->f.states & CPageHog)) && (xfrSize >= MIN_PAGE_HOG_SIZE)) { vmPageHog++; - vcp->states |= CPageHog; + vcp->f.states |= CPageHog; } ReleaseWriteLock(&vcp->lock); @@ -1094,10 +1094,10 @@ afs_vm_rdwr(struct vnode *vp, */ if (counter > 0 && code == 0 && xfrOffset == offset) { ObtainWriteLock(&vcp->lock, 403); - if (xfrOffset > vcp->m.Length) - vcp->m.Length = xfrOffset; + if (xfrOffset > vcp->f.m.Length) + vcp->f.m.Length = xfrOffset; code = afs_DoPartialWrite(vcp, &treq); - vcp->states |= CDirty; + vcp->f.states |= CDirty; ReleaseWriteLock(&vcp->lock); if (code) { goto fail; @@ -1164,7 +1164,7 @@ afs_vm_rdwr(struct vnode *vp, } ObtainWriteLock(&vcp->lock, 242); - if (code == 0 && (vcp->states & CDirty)) { + if (code == 0 && (vcp->f.states & CDirty)) { code = afs_DoPartialWrite(vcp, &treq); } vm_protectp(vcp->segid, last_page, 1, RDONLY); @@ -1221,7 +1221,7 @@ afs_direct_rdwr(struct vnode *vp, return 0; ObtainReadLock(&vcp->lock); - fileSize = vcp->m.Length; + fileSize = vcp->f.m.Length; if (rw == UIO_WRITE && (ioflag & IO_APPEND)) { /* handle IO_APPEND mode */ uiop->afsio_offset = fileSize; } @@ -1244,10 +1244,10 @@ afs_direct_rdwr(struct vnode *vp, ReleaseReadLock(&vcp->lock); if (rw == UIO_WRITE) { ObtainWriteLock(&vcp->lock, 400); - vcp->m.Date = osi_Time(); /* Set file date (for ranlib) */ + vcp->f.m.Date = osi_Time(); /* Set file date (for ranlib) */ /* extend file */ if (xfrSize + xfrOffset > fileSize) - vcp->m.Length = xfrSize + xfrOffset; + vcp->f.m.Length = xfrSize + xfrOffset; ReleaseWriteLock(&vcp->lock); } afs_Trace3(afs_iclSetp, CM_TRACE_DIRECTRDWR, ICL_TYPE_POINTER, vp, @@ -1269,7 +1269,7 @@ afs_direct_rdwr(struct vnode *vp, if (AFS_CHUNKBASE(uiop->afsio_offset) != AFS_CHUNKBASE(xfrOffset)) { ObtainWriteLock(&vcp->lock, 402); code = afs_DoPartialWrite(vcp, &treq); - vcp->states |= CDirty; + vcp->f.states |= CDirty; ReleaseWriteLock(&vcp->lock); } } diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index f39ab3a..71bc5aa 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -261,7 +261,7 @@ afs_root(struct mount *mp, struct vnode **vpp) AFS_GLOCK(); AFS_STATCNT(afs_root); if (mdata == NULL && afs_globalVp - && (afs_globalVp->states & CStatd)) { + && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; error = 0; #ifdef AFS_DARWIN80_ENV diff --git a/src/afs/DARWIN/osi_vm.c b/src/afs/DARWIN/osi_vm.c index ed845d1..d4427b8 100644 --- a/src/afs/DARWIN/osi_vm.c +++ b/src/afs/DARWIN/osi_vm.c @@ -130,8 +130,8 @@ osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) size = ubc_getsize(vp); ubc_sync_range(vp, 0, size, UBC_INVALIDATE); /* XXX what about when not CStatd */ - if (avc->states & CStatd && size != avc->m.Length) - ubc_setsize(vp, avc->m.Length); + if (avc->f.states & CStatd && size != avc->f.m.Length) + ubc_setsize(vp, avc->f.m.Length); #else if (UBCINFOEXISTS(vp)) { size = ubc_getsize(vp); @@ -139,9 +139,9 @@ osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) if (kret != 1) /* Should be KERN_SUCCESS */ printf("VMFlushPages: invalidate failed (error = %d)\n", kret); /* XXX what about when not CStatd */ - if (avc->states & CStatd && size != avc->m.Length) + if (avc->f.states & CStatd && size != avc->f.m.Length) if (UBCISVALID(vp)) - ubc_setsize(vp, avc->m.Length); + ubc_setsize(vp, avc->f.m.Length); } #endif } @@ -190,23 +190,23 @@ osi_VM_Setup(struct vcache *avc, int force) struct vnode *vp = AFSTOV(avc); #ifndef AFS_DARWIN80_ENV - if (UBCISVALID(vp) && ((avc->states & CStatd) || force)) { + if (UBCISVALID(vp) && ((avc->f.states & CStatd) || force)) { if (!UBCINFOEXISTS(vp)) { osi_vnhold(avc, 0); - avc->states |= CUBCinit; + avc->f.states |= CUBCinit; AFS_GUNLOCK(); if ((error = ubc_info_init(vp))) { AFS_GLOCK(); - avc->states &= ~CUBCinit; + avc->f.states &= ~CUBCinit; AFS_RELE(vp); return error; } AFS_GLOCK(); - avc->states &= ~CUBCinit; + avc->f.states &= ~CUBCinit; AFS_RELE(vp); } if (UBCINFOEXISTS(vp) && UBCISVALID(vp)) { - ubc_setsize(vp, avc->m.Length); + ubc_setsize(vp, avc->f.m.Length); } } #endif diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index e9840f6..a015fc1 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -237,11 +237,11 @@ darwin_vn_hold(struct vnode *vp) struct vcache *tvc = VTOAFS(vp); #ifndef AFS_DARWIN80_ENV - tvc->states |= CUBCinit; + tvc->f.states |= CUBCinit; #endif #ifdef AFS_DARWIN80_ENV - osi_Assert((tvc->states & CVInit) == 0); - if (tvc->states & CDeadVnode) + osi_Assert((tvc->f.states & CVInit) == 0); + if (tvc->f.states & CDeadVnode) osi_Assert(!vnode_isinuse(vp, 1)); #endif if (haveGlock) AFS_GUNLOCK(); @@ -287,7 +287,7 @@ darwin_vn_hold(struct vnode *vp) if (haveGlock) AFS_GLOCK(); #ifndef AFS_DARWIN80_ENV - tvc->states &= ~CUBCinit; + tvc->f.states &= ~CUBCinit; #endif } int @@ -449,9 +449,9 @@ afs_vop_create(ap) (*ap->a_vpp)->v_vfsp = dvp->v_vfsp; vn_lock(*ap->a_vpp, LK_EXCLUSIVE | LK_RETRY, p); if (UBCINFOMISSING(*ap->a_vpp) || UBCINFORECLAIMED(*ap->a_vpp)) { - vcp->states |= CUBCinit; + vcp->f.states |= CUBCinit; ubc_info_init(*ap->a_vpp); - vcp->states &= ~CUBCinit; + vcp->f.states &= ~CUBCinit; } #endif } else @@ -582,7 +582,7 @@ afs_vop_access(ap) code = afs_CheckCode(code, &treq, 56); goto out; } - if (afs_fakestat_enable && tvc->mvstat && !(tvc->states & CStatd)) { + if (afs_fakestat_enable && tvc->mvstat && !(tvc->f.states & CStatd)) { code = 0; goto out; } @@ -645,7 +645,7 @@ afs_vop_access(ap) #endif if (code == 1 && vnode_vtype(ap->a_vp) == VREG && ap->a_action & KAUTH_VNODE_EXECUTE && - (tvc->m.Mode & 0100) != 0100) { + (tvc->f.m.Mode & 0100) != 0100) { code = 0; } if (code) { @@ -844,7 +844,7 @@ afs_vop_pagein(ap) code = afs_read(tvc, uio, cred, 0, 0, 0); if (code == 0) { ObtainWriteLock(&tvc->lock, 2); - tvc->states |= CMAPPED; + tvc->f.states |= CMAPPED; ReleaseWriteLock(&tvc->lock); } AFS_GUNLOCK(); @@ -994,7 +994,7 @@ afs_vop_pageout(ap) UPL_ABORT_FREE_ON_EMPTY); return (EINVAL); } - if (f_offset >= tvc->m.Length) { + if (f_offset >= tvc->f.m.Length) { if (!nocommit) OSI_UPL_ABORT_RANGE(pl, pl_offset, size, UPL_ABORT_FREE_ON_EMPTY); @@ -1006,8 +1006,8 @@ afs_vop_pageout(ap) /* size will always be a multiple of PAGE_SIZE */ /* pageout isn't supposed to extend files */ - if (f_offset + size > tvc->m.Length) - iosize = tvc->m.Length - f_offset; + if (f_offset + size > tvc->f.m.Length) + iosize = tvc->f.m.Length - f_offset; else iosize = size; @@ -1039,8 +1039,8 @@ afs_vop_pageout(ap) * contents past end of the file before * releasing it in the VM page cache */ - if ((f_offset < tvc->m.Length) && (f_offset + size) > tvc->m.Length) { - size_t io = tvc->m.Length - f_offset; + if ((f_offset < tvc->f.m.Length) && (f_offset + size) > tvc->f.m.Length) { + size_t io = tvc->f.m.Length - f_offset; memset((caddr_t) (ioaddr + pl_offset + io), 0, size - io); } @@ -1212,7 +1212,7 @@ afs_vop_remove(ap) #ifdef AFS_DARWIN80_ENV struct vcache *tvc = VTOAFS(vp); - if (!(tvc->states & CUnlinked)) { + if (!(tvc->f.states & CUnlinked)) { ubc_setsize(vp, (off_t)0); vnode_recycle(vp); } @@ -1425,10 +1425,10 @@ afs_vop_rename(ap) * run mv as the user, thus: */ printf("su %d -c /bin/mv /afs/.:mount/%d:%d:%d:%d/%s /afs/.:mount/%d:%d:%d:%d/%s\n", - (cn_cred(tcnp))->cr_uid, fvc->fid.Cell, fvc->fid.Fid.Volume, - fvc->fid.Fid.Vnode, fvc->fid.Fid.Unique, fname, - tvc->fid.Cell, tvc->fid.Fid.Volume, tvc->fid.Fid.Vnode, - tvc->fid.Fid.Unique, tname); + (cn_cred(tcnp))->cr_uid, fvc->f.fid.Cell, fvc->f.fid.Fid.Volume, + fvc->f.fid.Fid.Vnode, fvc->f.fid.Fid.Unique, fname, + tvc->f.fid.Cell, tvc->f.fid.Fid.Volume, tvc->f.fid.Fid.Vnode, + tvc->f.fid.Fid.Unique, tname); } #endif #ifdef AFS_DARWIN80_ENV @@ -1665,7 +1665,7 @@ afs_vop_inactive(ap) #endif if (tvc) { #ifdef AFS_DARWIN80_ENV - int unlinked = tvc->states & CUnlinked; + int unlinked = tvc->f.states & CUnlinked; #endif AFS_GLOCK(); afs_InactiveVCache(tvc, 0); /* decrs ref counts */ @@ -1708,23 +1708,23 @@ afs_vop_reclaim(ap) tvc->v->v_data = NULL; /* remove from vnode */ #endif AFSTOV(tvc) = NULL; /* also drop the ptr to vnode */ - tvc->states |= CVInit; /* also CDeadVnode? */ + tvc->f.states |= CVInit; /* also CDeadVnode? */ tvc->nextfree = ReclaimedVCList; ReclaimedVCList = tvc; ReleaseWriteLock(&afs_xvreclaim); } else { error = afs_FlushVCache(tvc, &sl); /* toss our stuff from vnode */ - if (tvc->states & (CVInit + if (tvc->f.states & (CVInit #ifdef AFS_DARWIN80_ENV | CDeadVnode #endif )) { - tvc->states &= ~(CVInit + tvc->f.states &= ~(CVInit #ifdef AFS_DARWIN80_ENV | CDeadVnode #endif ); - afs_osi_Wakeup(&tvc->states); + afs_osi_Wakeup(&tvc->f.states); } if (!error && vnode_fsnode(vp)) panic("afs_reclaim: vnode not cleaned"); @@ -1968,10 +1968,10 @@ afs_vop_print(ap) { register struct vnode *vp = ap->a_vp; register struct vcache *vc = VTOAFS(ap->a_vp); - int s = vc->states; + int s = vc->f.states; printf("tag %d, fid: %ld.%x.%x.%x, opens %d, writers %d", vp->v_tag, - vc->fid.Cell, vc->fid.Fid.Volume, vc->fid.Fid.Vnode, - vc->fid.Fid.Unique, vc->opens, vc->execsOrWriters); + vc->f.fid.Cell, vc->f.fid.Fid.Volume, vc->f.fid.Fid.Vnode, + vc->f.fid.Fid.Unique, vc->opens, vc->execsOrWriters); printf("\n states%s%s%s%s%s", (s & CStatd) ? " statd" : "", (s & CRO) ? " readonly" : "", (s & CDirty) ? " dirty" : "", (s & CMAPPED) ? " mapped" : "", @@ -2033,10 +2033,10 @@ afs_darwin_getnewvnode(struct vcache *avc) #if 0 AFS_GLOCK(); ObtainWriteLock(&avc->lock,342); - if (avc->states & CStatd) { - par.vnfs_vtype = avc->m.Type; + if (avc->f.states & CStatd) { + par.vnfs_vtype = avc->f.m.Type; par.vnfs_vops = afs_vnodeop_p; - par.vnfs_filesize = avc->m.Length; + par.vnfs_filesize = avc->f.m.Length; if (!ac->cnp) par.vnfs_flags = VNFS_NOCACHE; dead = 0; @@ -2067,7 +2067,7 @@ afs_darwin_getnewvnode(struct vcache *avc) #if 0 if (dead) { vnode_recycle(vp); /* terminate as soon as iocount drops */ - avc->states |= CDeadVnode; + avc->f.states |= CDeadVnode; } else if (!ac->markroot && !ac->cnp) { /* the caller doesn't know anything about this vnode. if markroot should have been set and wasn't, bad things may happen, so encourage @@ -2076,7 +2076,7 @@ afs_darwin_getnewvnode(struct vcache *avc) } #else vnode_recycle(vp); /* terminate as soon as iocount drops */ - avc->states |= CDeadVnode; + avc->f.states |= CDeadVnode; #endif } return error; @@ -2101,7 +2101,7 @@ afs_darwin_finalizevnode(struct vcache *avc, struct vnode *dvp, struct component AFS_GLOCK(); ObtainWriteLock(&avc->lock,325); ovp = AFSTOV(avc); - if (!(avc->states & CDeadVnode) && vnode_vtype(ovp) != VNON) { + if (!(avc->f.states & CDeadVnode) && vnode_vtype(ovp) != VNON) { AFS_GUNLOCK(); #if 0 /* unsupported */ if (dvp && cnp) @@ -2116,14 +2116,14 @@ afs_darwin_finalizevnode(struct vcache *avc, struct vnode *dvp, struct component AFS_GUNLOCK(); return 0; } - if ((avc->states & CDeadVnode) && vnode_vtype(ovp) != VNON) + if ((avc->f.states & CDeadVnode) && vnode_vtype(ovp) != VNON) panic("vcache %p should not be CDeadVnode", avc); AFS_GUNLOCK(); memset(&par, 0, sizeof(struct vnode_fsparam)); par.vnfs_mp = afs_globalVFS; - par.vnfs_vtype = avc->m.Type; + par.vnfs_vtype = avc->f.m.Type; par.vnfs_vops = afs_vnodeop_p; - par.vnfs_filesize = avc->m.Length; + par.vnfs_filesize = avc->f.m.Length; par.vnfs_fsnode = avc; par.vnfs_dvp = dvp; if (cnp && (cnp->cn_flags & ISDOTDOT) == 0) @@ -2135,23 +2135,23 @@ afs_darwin_finalizevnode(struct vcache *avc, struct vnode *dvp, struct component error = vnode_create(VNCREATE_FLAVOR, VCREATESIZE, &par, &nvp); if (!error) { vnode_addfsref(nvp); - if ((avc->states & CDeadVnode) && vnode_vtype(ovp) != VNON) + if ((avc->f.states & CDeadVnode) && vnode_vtype(ovp) != VNON) printf("vcache %p should not be CDeadVnode", avc); if (avc->v == ovp) { - if (!(avc->states & CVInit)) { + if (!(avc->f.states & CVInit)) { vnode_clearfsnode(ovp); vnode_removefsref(ovp); } } avc->v = nvp; - avc->states &=~ CDeadVnode; + avc->f.states &=~ CDeadVnode; } vnode_put(ovp); vnode_rele(ovp); AFS_GLOCK(); ReleaseWriteLock(&avc->lock); if (!error) - afs_osi_Wakeup(&avc->states); + afs_osi_Wakeup(&avc->f.states); AFS_GUNLOCK(); return error; } diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index 1765054..4ea239e 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -190,7 +190,7 @@ afs_root(struct mount *mp, struct vnode **vpp) AFS_GLOCK(); AFS_STATCNT(afs_root); crhold(cr); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; error = 0; } else { diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index 146e09f..d09d46d 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -650,7 +650,7 @@ afs_vop_open(ap) #endif AFS_GUNLOCK(); #ifdef AFS_FBSD60_ENV - vnode_create_vobject(ap->a_vp, vc->m.Length, ap->a_td); + vnode_create_vobject(ap->a_vp, vc->f.m.Length, ap->a_td); #endif osi_FlushPages(vc, ap->a_cred); return error; @@ -1571,17 +1571,17 @@ afs_vop_print(ap) { register struct vnode *vp = ap->a_vp; register struct vcache *vc = VTOAFS(ap->a_vp); - int s = vc->states; + int s = vc->f.states; #ifdef AFS_FBSD50_ENV printf("tag %s, fid: %d.%x.%x.%x, opens %d, writers %d", vp->v_tag, - (int)vc->fid.Cell, (u_int) vc->fid.Fid.Volume, - (u_int) vc->fid.Fid.Vnode, (u_int) vc->fid.Fid.Unique, vc->opens, + (int)vc->f.fid.Cell, (u_int) vc->f.fid.Fid.Volume, + (u_int) vc->f.fid.Fid.Vnode, (u_int) vc->f.fid.Fid.Unique, vc->opens, vc->execsOrWriters); #else printf("tag %d, fid: %ld.%x.%x.%x, opens %d, writers %d", vp->v_tag, - vc->fid.Cell, (u_int) vc->fid.Fid.Volume, - (u_int) vc->fid.Fid.Vnode, (u_int) vc->fid.Fid.Unique, vc->opens, + vc->f.fid.Cell, (u_int) vc->f.fid.Fid.Volume, + (u_int) vc->f.fid.Fid.Vnode, (u_int) vc->f.fid.Fid.Unique, vc->opens, vc->execsOrWriters); #endif printf("\n states%s%s%s%s%s", (s & CStatd) ? " statd" : "", diff --git a/src/afs/HPUX/osi_vfsops.c b/src/afs/HPUX/osi_vfsops.c index 4a7b739..e3a5179 100644 --- a/src/afs/HPUX/osi_vfsops.c +++ b/src/afs/HPUX/osi_vfsops.c @@ -120,7 +120,7 @@ afs_root(struct vfs *afsp, struct vnode **avpp, char *unused1) AFS_GLOCK(); AFS_STATCNT(afs_root); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { if (afs_globalVp) { diff --git a/src/afs/IRIX/osi_idbg.c b/src/afs/IRIX/osi_idbg.c index 03f0ed7..da72b9d 100644 --- a/src/afs/IRIX/osi_idbg.c +++ b/src/afs/IRIX/osi_idbg.c @@ -59,25 +59,25 @@ idbg_prafsnode(OSI_VC_DECL(avc)) AFS_GLOCK(); qprintf(" Len %d DV %d Date %d Own %d Grp %d Mode 0%o Lnk %d\n", - avc->m.Length, avc->m.DataVersion, avc->m.Date, avc->m.Owner, - avc->m.Group, avc->m.Mode, avc->m.LinkCount); + avc->f.m.Length, avc->f.m.DataVersion, avc->f.m.Date, avc->f.m.Owner, + avc->f.m.Group, avc->f.m.Mode, avc->f.m.LinkCount); qprintf(" flushDV %d mapDV %d truncpos 0x%x cb 0x%x cbE 0x%x\n", - avc->flushDV, avc->mapDV, avc->truncPos, avc->callback, + avc->flushDV, avc->mapDV, avc->f.truncPos, avc->callback, avc->cbExpires); qprintf(" opens %d ex/wr %d flckcnt %d state 0x%x ", avc->opens, - avc->execsOrWriters, avc->flockCount, avc->states); - printflags(avc->states, tab_vcache); + avc->execsOrWriters, avc->flockCount, avc->f.states); + printflags(avc->f.states, tab_vcache); qprintf("\n"); #ifdef AFS_SGI64_ENV qprintf(" mapcnt %llu, mvstat %d anyAcc 0x%x Access 0x%x\n", - avc->mapcnt, avc->mvstat, avc->anyAccess, avc->Access); + avc->mapcnt, avc->mvstat, avc->f.anyAccess, avc->Access); qprintf(" mvid 0x%x &lock 0x%x cred 0x%x\n", avc->mvid, &avc->lock, avc->cred); qprintf(" rwlock 0x%x (%d) id %llu trips %d\n", &avc->vc_rwlock, valusema(&avc->vc_rwlock), avc->vc_rwlockid, avc->vc_locktrips); #else qprintf(" mapcnt %d mvstat %d anyAcc 0x%x Access 0x%x\n", avc->mapcnt, - avc->mvstat, avc->anyAccess, avc->Access); + avc->mvstat, avc->f.anyAccess, avc->Access); qprintf(" mvid 0x%x &lock 0x%x cred 0x%x\n", avc->mvid, &avc->lock, avc->cred); qprintf(" rwlock 0x%x (%d) id %d trips %d\n", &avc->vc_rwlock, @@ -114,7 +114,7 @@ idbg_afsvfslist() for (tq = VLRU.prev; tq != &VLRU; tq = uq) { tvc = QTOV(tq); uq = QPrev(tq); - nodeid = tvc->fid.Fid.Vnode + (tvc->fid.Fid.Volume << 16); + nodeid = tvc->f.fid.Fid.Vnode + (tvc->f.fid.Fid.Volume << 16); nodeid &= 0x7fffffff; qprintf("avp 0x%x type %s cnt %d pg %d map %d nodeid %d(0x%x)\n", tvc, tab_vtypes[((vnode_t *) tvc)->v_type], diff --git a/src/afs/IRIX/osi_vfsops.c b/src/afs/IRIX/osi_vfsops.c index ddab234..2dc3d73 100644 --- a/src/afs/IRIX/osi_vfsops.c +++ b/src/afs/IRIX/osi_vfsops.c @@ -274,7 +274,7 @@ afs_root(OSI_VFS_ARG(afsp), avpp) OSI_VFS_CONVERT(afsp); AFS_STATCNT(afs_root); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { if (afs_globalVp) { @@ -459,7 +459,7 @@ afs_sync(OSI_VFS_DECL(afsp), AFS_GUNLOCK(); if (flags & SYNC_CLOSE) { - PFLUSHINVALVP(vp, (off_t) 0, (off_t) tvc->m.Length); + PFLUSHINVALVP(vp, (off_t) 0, (off_t) tvc->f.m.Length); } #ifdef AFS_SGI61_ENV else if (flags & SYNC_PDFLUSH) { @@ -472,18 +472,18 @@ afs_sync(OSI_VFS_DECL(afsp), if ((flags & SYNC_DELWRI) && AFS_VN_DIRTY(vp)) { #ifdef AFS_SGI61_ENV - PFLUSHVP(vp, (off_t) tvc->m.Length, + PFLUSHVP(vp, (off_t) tvc->f.m.Length, (flags & SYNC_WAIT) ? 0 : B_ASYNC, error); #else /* AFS_SGI61_ENV */ if (flags & SYNC_WAIT) /* push all and wait */ - PFLUSHVP(vp, (off_t) tvc->m.Length, (off_t) 0, error); + PFLUSHVP(vp, (off_t) tvc->f.m.Length, (off_t) 0, error); else if (flags & SYNC_BDFLUSH) { /* push oldest */ error = pdflush(vp, B_ASYNC); } else { /* push all but don't wait */ - PFLUSHVP(vp, (off_t) tvc->m.Length, (off_t) B_ASYNC, error); + PFLUSHVP(vp, (off_t) tvc->f.m.Length, (off_t) B_ASYNC, error); } #endif /* AFS_SGI61_ENV */ } diff --git a/src/afs/IRIX/osi_vm.c b/src/afs/IRIX/osi_vm.c index 93a29aba..6978e9f 100644 --- a/src/afs/IRIX/osi_vm.c +++ b/src/afs/IRIX/osi_vm.c @@ -166,7 +166,7 @@ void osi_VM_FSyncInval(struct vcache *avc) { AFS_GUNLOCK(); - PFLUSHINVALVP((vnode_t *) avc, (off_t) 0, (off_t) avc->m.Length); + PFLUSHINVALVP((vnode_t *) avc, (off_t) 0, (off_t) avc->f.m.Length); AFS_GLOCK(); } @@ -193,7 +193,7 @@ osi_VM_StoreAllSegments(struct vcache *avc) pdflush(AFSTOV(avc), 0); } - PFLUSHVP(AFSTOV(avc), (off_t) avc->m.Length, (off_t) 0, error); + PFLUSHVP(AFSTOV(avc), (off_t) avc->f.m.Length, (off_t) 0, error); AFS_GLOCK(); if (error) { /* @@ -204,10 +204,10 @@ osi_VM_StoreAllSegments(struct vcache *avc) * does what we want (we don't use this normally since * it also unhashes pages ..) */ - PINVALFREE((vnode_t *) avc, avc->m.Length); + PINVALFREE((vnode_t *) avc, avc->f.m.Length); } ObtainWriteLock(&avc->lock, 121); - if (error && avc->m.LinkCount) + if (error && avc->f.m.LinkCount) cmn_err(CE_WARN, "AFS:Failed to push back pages for vnode 0x%x error %d (from afs_StoreOnLastReference)", avc, error); @@ -222,9 +222,9 @@ osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) { vnode_t *vp = (vnode_t *) avc; - remapf(vp, /*avc->m.Length */ 0, 0); + remapf(vp, /*avc->f.m.Length */ 0, 0); - /* Used to grab locks and recheck avc->m.DataVersion and + /* Used to grab locks and recheck avc->f.m.DataVersion and * avc->execsOrWriters here, but we have to drop locks before calling * ptossvp() anyway, so why bother. */ diff --git a/src/afs/IRIX/osi_vnodeops.c b/src/afs/IRIX/osi_vnodeops.c index 7bad6c8..adb4fc0 100644 --- a/src/afs/IRIX/osi_vnodeops.c +++ b/src/afs/IRIX/osi_vnodeops.c @@ -320,7 +320,7 @@ OSI_VC_DECL(avc); return EISDIR; if (ioflag & IO_APPEND) - uiop->uio_offset = avc->m.Length; + uiop->uio_offset = avc->f.m.Length; #ifdef AFS_SGI64_ENV #ifdef AFS_SGI65_ENV if (!(ioflag & IO_ISLOCKED)) @@ -434,7 +434,7 @@ afsrwvp(register struct vcache *avc, register struct uio *uio, enum uio_rw rw, if (rw == UIO_WRITE) { ObtainWriteLock(&avc->lock, 330); - avc->states |= CDirty; + avc->f.states |= CDirty; ReleaseWriteLock(&avc->lock); } @@ -473,7 +473,7 @@ afsrwvp(register struct vcache *avc, register struct uio *uio, enum uio_rw rw, /* * read/paging in a normal file */ - rem = avc->m.Length - uio->uio_offset; + rem = avc->f.m.Length - uio->uio_offset; if (rem <= 0) /* EOF */ break; @@ -572,7 +572,7 @@ afsrwvp(register struct vcache *avc, register struct uio *uio, enum uio_rw rw, ObtainWriteLock(&avc->lock, 90); error = afs_DoPartialWrite(avc, &treq); if (error == 0) - avc->states |= CDirty; + avc->f.states |= CDirty; ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); if (error) @@ -599,7 +599,7 @@ afsrwvp(register struct vcache *avc, register struct uio *uio, enum uio_rw rw, else bp = chunkread(vp, bmv, 1, cr); - avc->m.Date = osi_Time(); /* Set file date (for ranlib) */ + avc->f.m.Date = osi_Time(); /* Set file date (for ranlib) */ } if (bp->b_flags & B_ERROR) { /* @@ -638,10 +638,10 @@ afsrwvp(register struct vcache *avc, register struct uio *uio, enum uio_rw rw, * Make sure it is at least as high as the last byte we just wrote * into the buffer. */ - if (avc->m.Length < uio->uio_offset) { + if (avc->f.m.Length < uio->uio_offset) { AFS_GLOCK(); ObtainWriteLock(&avc->lock, 235); - avc->m.Length = uio->uio_offset; + avc->f.m.Length = uio->uio_offset; ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); } @@ -658,18 +658,18 @@ afsrwvp(register struct vcache *avc, register struct uio *uio, enum uio_rw rw, * explanation */ if (error) { - if (avc->m.LinkCount == 0) + if (avc->f.m.LinkCount == 0) cmn_err(CE_WARN, "AFS: Process pid %d write error %d writing to unlinked file.", OSI_GET_CURRENT_PID(), error); } } } while (!error && uio->uio_resid > 0); - afs_chkpgoob(&avc->v, btoc(avc->m.Length)); + afs_chkpgoob(&avc->v, btoc(avc->f.m.Length)); AFS_GLOCK(); - if (rw == UIO_WRITE && error == 0 && (avc->states & CDirty)) { + if (rw == UIO_WRITE && error == 0 && (avc->f.states & CDirty)) { ObtainWriteLock(&avc->lock, 405); error = afs_DoPartialWrite(avc, &treq); ReleaseWriteLock(&avc->lock); @@ -723,7 +723,7 @@ OSI_VC_DECL(avc); bmv->bn = BTOBBT(offset - off); bmv->offset = bmv->bn; bmv->pboff = off; - rem = avc->m.Length - offset; + rem = avc->f.m.Length - offset; if (rem <= 0) cnt = 0; /* EOF */ else @@ -815,7 +815,7 @@ OSI_VC_DECL(avc); */ ObtainReadLock(&avc->lock); if (bp->b_flags & B_READ) { - if (BBTOB(bp->b_blkno) >= avc->m.Length) { + if (BBTOB(bp->b_blkno) >= avc->f.m.Length) { /* we are responsible for zero'ing the page */ caddr_t c; c = bp_mapin(bp); @@ -824,7 +824,7 @@ OSI_VC_DECL(avc); ReleaseReadLock(&avc->lock); return; } - } else if ((avc->states & CWritingUFS) && (bp->b_flags & B_DELWRI)) { + } else if ((avc->f.states & CWritingUFS) && (bp->b_flags & B_DELWRI)) { bp->b_ref = 3; ReleaseReadLock(&avc->lock); iodone(bp); @@ -945,7 +945,7 @@ OSI_VC_DECL(avc); /* on last mapping push back and remove our reference */ osi_Assert(avc->execsOrWriters > 0); osi_Assert(avc->opens > 0); - if (avc->m.LinkCount == 0) { + if (avc->f.m.LinkCount == 0) { ObtainWriteLock(&avc->lock, 238); AFS_GUNLOCK(); PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG); @@ -968,7 +968,7 @@ OSI_VC_DECL(avc); if (code == VNOVNODE) code = 0; if (code) { - afs_StoreWarn(code, avc->fid.Fid.Volume, /* /dev/console */ + afs_StoreWarn(code, avc->f.fid.Fid.Volume, /* /dev/console */ 1); } code = afs_CheckCode(code, &treq, 52); @@ -1053,7 +1053,7 @@ OSI_VC_DECL(avc); AFS_RWLOCK(vp, VRWLOCK_WRITE); AFS_GUNLOCK(); error = - fs_map_subr(vp, (off_t) avc->m.Length, (u_int) avc->m.Mode, off, prp, + fs_map_subr(vp, (off_t) avc->f.m.Length, (u_int) avc->f.m.Mode, off, prp, *addrp, len, prot, maxprot, flags, cr); AFS_GLOCK(); AFS_RWUNLOCK(vp, VRWLOCK_WRITE); @@ -1116,9 +1116,9 @@ OSI_VC_DECL(avc); AFS_RWUNLOCK(vp, VRWLOCK_WRITE); return VN_INACTIVE_CACHE; } - if (avc->states & CUnlinked) { + if (avc->f.states & CUnlinked) { if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) { - avc->states |= CUnlinkedDel; + avc->f.states |= CUnlinkedDel; ReleaseWriteLock(&avc->lock); AFS_RWUNLOCK(vp, VRWLOCK_WRITE); } else { @@ -1128,7 +1128,7 @@ OSI_VC_DECL(avc); } return VN_INACTIVE_CACHE; } - if ((avc->states & CDirty) || (avc->execsOrWriters > 0)) { + if ((avc->f.states & CDirty) || (avc->execsOrWriters > 0)) { /* File either already has dirty chunks (CDirty) or was mapped at * time in its life with the potential for being written into. * Note that afs_close defers storebacks if the vnode's ref count @@ -1151,9 +1151,9 @@ OSI_VC_DECL(avc); if (mapcnt) { cmn_err(CE_WARN, "AFS: Failed to store FID (%x:%lu.%lu.%lu) in VOP_INACTIVE, error = %d\n", - (int)(avc->fid.Cell) & 0xffffffff, - avc->fid.Fid.Volume, avc->fid.Fid.Vnode, - avc->fid.Fid.Unique, code); + (int)(avc->f.fid.Cell) & 0xffffffff, + avc->f.fid.Fid.Volume, avc->f.fid.Fid.Vnode, + avc->f.fid.Fid.Unique, code); } afs_InvalidateAllSegments(avc); } @@ -1171,7 +1171,7 @@ OSI_VC_DECL(avc); } #endif - osi_Assert((avc->states & (CCore | CMAPPED)) == 0); + osi_Assert((avc->f.states & (CCore | CMAPPED)) == 0); if (avc->cred) { crfree(avc->cred); @@ -1184,19 +1184,19 @@ OSI_VC_DECL(avc); * If someone unlinked a file and this is the last hurrah - * nuke all the pages. */ - if (avc->m.LinkCount == 0) { + if (avc->f.m.LinkCount == 0) { AFS_GUNLOCK(); PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG); AFS_GLOCK(); } #ifndef AFS_SGI65_ENV osi_Assert(avc->mapcnt == 0); - afs_chkpgoob(&avc->v, btoc(avc->m.Length)); + afs_chkpgoob(&avc->v, btoc(avc->f.m.Length)); - avc->states &= ~CDirty; /* Give up on store-backs */ - if (avc->states & CUnlinked) { + avc->f.states &= ~CDirty; /* Give up on store-backs */ + if (avc->f.states & CUnlinked) { if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) { - avc->states |= CUnlinkedDel; + avc->f.states |= CUnlinkedDel; } else { afs_remunlink(avc, 1); /* ignore any return code */ } @@ -1284,13 +1284,13 @@ afs_fid2(OSI_VC_DECL(avc), struct fid *fidp) osi_Assert(sizeof(fid_t) >= sizeof(afs_fid2_t)); afid->af_len = sizeof(afs_fid2_t) - sizeof(afid->af_len); - tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); + tcell = afs_GetCell(avc->f.fid.Cell, READ_LOCK); afid->af_cell = tcell->cellIndex & 0xffff; afs_PutCell(tcell, READ_LOCK); - afid->af_volid = avc->fid.Fid.Volume; - afid->af_vno = avc->fid.Fid.Vnode; - afid->af_uniq = avc->fid.Fid.Unique; + afid->af_volid = avc->f.fid.Fid.Volume; + afid->af_vno = avc->f.fid.Fid.Vnode; + afid->af_uniq = avc->f.fid.Fid.Unique; return 0; } diff --git a/src/afs/LINUX/osi_export.c b/src/afs/LINUX/osi_export.c index 3218090..02d81be 100644 --- a/src/afs/LINUX/osi_export.c +++ b/src/afs/LINUX/osi_export.c @@ -82,11 +82,11 @@ static int afs_encode_fh(struct dentry *de, __u32 *fh, int *max_len, #ifdef OSI_EXPORT_DEBUG printk("afs: encode_fh(0x%08x/%d/%d.%d)\n", - tvc->fid.Cell, tvc->fid.Fid.Volume, - tvc->fid.Fid.Vnode, tvc->fid.Fid.Unique); + tvc->f.fid.Cell, tvc->f.fid.Fid.Volume, + tvc->f.fid.Fid.Vnode, tvc->f.fid.Fid.Unique); #endif - if (afs_IsDynrootAnyFid(&tvc->fid)) { - vntype = VNUM_TO_VNTYPE(tvc->fid.Fid.Vnode); + if (afs_IsDynrootAnyFid(&tvc->f.fid)) { + vntype = VNUM_TO_VNTYPE(tvc->f.fid.Fid.Vnode); switch (vntype) { case 0: /* encode as a normal filehandle */ @@ -101,7 +101,7 @@ static int afs_encode_fh(struct dentry *de, __u32 *fh, int *max_len, case VN_TYPE_CELL: case VN_TYPE_ALIAS: AFS_GLOCK(); - tc = afs_GetCellByIndex(VNUM_TO_CIDX(tvc->fid.Fid.Vnode), + tc = afs_GetCellByIndex(VNUM_TO_CIDX(tvc->f.fid.Fid.Vnode), READ_LOCK); if (!tc) { AFS_GUNLOCK(); @@ -111,15 +111,15 @@ static int afs_encode_fh(struct dentry *de, __u32 *fh, int *max_len, afs_PutCell(tc, READ_LOCK); AFS_GUNLOCK(); if (vntype == VN_TYPE_MOUNT) { - fh[4] = htonl(tvc->fid.Fid.Unique); + fh[4] = htonl(tvc->f.fid.Fid.Unique); *max_len = 5; return AFSFH_DYN_MOUNT; } *max_len = 4; if (vntype == VN_TYPE_CELL) { - return AFSFH_DYN_RO_CELL | VNUM_TO_RW(tvc->fid.Fid.Vnode); + return AFSFH_DYN_RO_CELL | VNUM_TO_RW(tvc->f.fid.Fid.Vnode); } else { - return AFSFH_DYN_RO_LINK | VNUM_TO_RW(tvc->fid.Fid.Vnode); + return AFSFH_DYN_RO_LINK | VNUM_TO_RW(tvc->f.fid.Fid.Vnode); } case VN_TYPE_SYMLINK: @@ -134,16 +134,16 @@ static int afs_encode_fh(struct dentry *de, __u32 *fh, int *max_len, if (*max_len < 7) { /* not big enough for a migratable filehandle */ /* always encode in network order */ - fh[0] = htonl(tvc->fid.Cell); - fh[1] = htonl(tvc->fid.Fid.Volume); - fh[2] = htonl(tvc->fid.Fid.Vnode); - fh[3] = htonl(tvc->fid.Fid.Unique); + fh[0] = htonl(tvc->f.fid.Cell); + fh[1] = htonl(tvc->f.fid.Fid.Volume); + fh[2] = htonl(tvc->f.fid.Fid.Vnode); + fh[3] = htonl(tvc->f.fid.Fid.Unique); *max_len = 4; return AFSFH_NET_VENUSFID; } AFS_GLOCK(); - tc = afs_GetCell(tvc->fid.Cell, READ_LOCK); + tc = afs_GetCell(tvc->f.fid.Cell, READ_LOCK); if (!tc) { AFS_GUNLOCK(); return 255; @@ -152,9 +152,9 @@ static int afs_encode_fh(struct dentry *de, __u32 *fh, int *max_len, afs_PutCell(tc, READ_LOCK); AFS_GUNLOCK(); /* always encode in network order */ - fh[4] = htonl(tvc->fid.Fid.Volume); - fh[5] = htonl(tvc->fid.Fid.Vnode); - fh[6] = htonl(tvc->fid.Fid.Unique); + fh[4] = htonl(tvc->f.fid.Fid.Volume); + fh[5] = htonl(tvc->f.fid.Fid.Vnode); + fh[6] = htonl(tvc->f.fid.Fid.Unique); *max_len = 7; return AFSFH_NET_CELLFID; @@ -318,12 +318,12 @@ static int update_dir_parent(struct vrequest *areq, struct vcache *adp) int code; redo: - if (!(adp->states & CStatd)) { + if (!(adp->f.states & CStatd)) { if ((code = afs_VerifyVCache2(adp, areq))) { #ifdef OSI_EXPORT_DEBUG printk("afs: update_dir_parent(0x%08x/%d/%d.%d): VerifyVCache2: %d\n", - adp->fid.Cell, adp->fid.Fid.Volume, - adp->fid.Fid.Vnode, adp->fid.Fid.Unique, code); + adp->f.fid.Cell, adp->f.fid.Fid.Volume, + adp->f.fid.Fid.Vnode, adp->f.fid.Fid.Unique, code); #endif return code; } @@ -333,8 +333,8 @@ redo: if (!tdc) { #ifdef OSI_EXPORT_DEBUG printk("afs: update_dir_parent(0x%08x/%d/%d.%d): no dcache\n", - adp->fid.Cell, adp->fid.Fid.Volume, - adp->fid.Fid.Vnode, adp->fid.Fid.Unique); + adp->f.fid.Cell, adp->f.fid.Fid.Volume, + adp->f.fid.Fid.Vnode, adp->f.fid.Fid.Unique); #endif return EIO; } @@ -350,24 +350,24 @@ redo: * 1. The cache data is being fetched by another process. * 2. The cache data is no longer valid */ - while ((adp->states & CStatd) + while ((adp->f.states & CStatd) && (tdc->dflags & DFFetching) - && hsame(adp->m.DataVersion, tdc->f.versionNo)) { + && hsame(adp->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseSharedLock(&adp->lock); afs_osi_Sleep(&tdc->validPos); ObtainSharedLock(&adp->lock, 802); ObtainReadLock(&tdc->lock); } - if (!(adp->states & CStatd) - || !hsame(adp->m.DataVersion, tdc->f.versionNo)) { + if (!(adp->f.states & CStatd) + || !hsame(adp->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseSharedLock(&adp->lock); afs_PutDCache(tdc); #ifdef OSI_EXPORT_DEBUG printk("afs: update_dir_parent(0x%08x/%d/%d.%d): dir changed; retrying\n", - adp->fid.Cell, adp->fid.Fid.Volume, - adp->fid.Fid.Vnode, adp->fid.Fid.Unique); + adp->f.fid.Cell, adp->f.fid.Fid.Volume, + adp->f.fid.Fid.Vnode, adp->f.fid.Fid.Unique); #endif goto redo; } @@ -381,19 +381,19 @@ redo: if (!code) { UpgradeSToWLock(&adp->lock, 803); - adp->parentVnode = tfid.Fid.Vnode; - adp->parentUnique = tfid.Fid.Unique; + adp->f.parent.vnode = tfid.Fid.Vnode; + adp->f.parent.unique = tfid.Fid.Unique; } #ifdef OSI_EXPORT_DEBUG if (code) { printk("afs: update_dir_parent(0x%08x/%d/%d.%d): afs_dir_Lookup: %d\n", - adp->fid.Cell, adp->fid.Fid.Volume, - adp->fid.Fid.Vnode, adp->fid.Fid.Unique, code); + adp->f.fid.Cell, adp->f.fid.Fid.Volume, + adp->f.fid.Fid.Vnode, adp->f.fid.Fid.Unique, code); } else { printk("afs: update_dir_parent(0x%08x/%d/%d.%d) => %d.%d\n", - adp->fid.Cell, adp->fid.Fid.Volume, - adp->fid.Fid.Vnode, adp->fid.Fid.Unique, - adp->parentVnode, adp->parentUnique); + adp->f.fid.Cell, adp->f.fid.Fid.Volume, + adp->f.fid.Fid.Vnode, adp->f.fid.Fid.Unique, + adp->parent.vnode, adp->parent.unique); } #endif ReleaseSharedLock(&adp->lock); @@ -415,12 +415,12 @@ static int UnEvalFakeStat(struct vrequest *areq, struct vcache **vcpp) return 0; /* Figure out what FID to look for */ - tvp = afs_GetVolume(&(*vcpp)->fid, 0, READ_LOCK); + tvp = afs_GetVolume(&(*vcpp)->f.fid, 0, READ_LOCK); if (!tvp) { #ifdef OSI_EXPORT_DEBUG printk("afs: UnEvalFakeStat(0x%08x/%d/%d.%d): no volume\n", - (*vcpp)->fid.Cell, (*vcpp)->fid.Fid.Volume, - (*vcpp)->fid.Fid.Vnode, (*vcpp)->fid.Fid.Unique); + (*vcpp)->f.fid.Cell, (*vcpp)->f.fid.Fid.Volume, + (*vcpp)->f.fid.Fid.Vnode, (*vcpp)->f.fid.Fid.Unique); #endif return ENOENT; } @@ -431,8 +431,8 @@ static int UnEvalFakeStat(struct vrequest *areq, struct vcache **vcpp) if (!tvc) { #ifdef OSI_EXPORT_DEBUG printk("afs: UnEvalFakeStat(0x%08x/%d/%d.%d): GetVCache(0x%08x/%d/%d.%d) failed\n", - (*vcpp)->fid.Cell, (*vcpp)->fid.Fid.Volume, - (*vcpp)->fid.Fid.Vnode, (*vcpp)->fid.Fid.Unique, + (*vcpp)->f.fid.Cell, (*vcpp)->f.fid.Fid.Volume, + (*vcpp)->f.fid.Fid.Vnode, (*vcpp)->f.fid.Fid.Unique, tfid.Cell, tfid.Fid.Volume, tfid.Fid.Vnode, tfid.Fid.Unique); #endif @@ -500,7 +500,7 @@ static struct dentry *get_dentry_from_fid(cred_t *credp, struct VenusFid *afid) * at parentVnode on directories, except for VIOCGETVCXSTATUS. * So, if this fails, we don't really care very much. */ - if (vType(vcp) == VDIR && vcp->mvstat != 2 && !vcp->parentVnode) + if (vType(vcp) == VDIR && vcp->mvstat != 2 && !vcp->f.parent.vnode) update_dir_parent(&treq, vcp); /* @@ -621,10 +621,10 @@ static int afs_export_get_name(struct dentry *parent, char *name, #ifdef OSI_EXPORT_DEBUG printk("afs: get_name(%s, 0x%08x/%d/%d.%d): this is the dynmount dir\n", parent->d_name.name ? (char *)parent->d_name.name : "?", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique); #endif - data.fid = vcp->fid; + data.fid = vcp->f.fid; if (VTOAFS(parent->d_inode) == afs_globalVp) strcpy(name, AFS_DYNROOT_MOUNTNAME); else @@ -634,13 +634,13 @@ static int afs_export_get_name(struct dentry *parent, char *name, /* Figure out what FID to look for */ if (vcp->mvstat == 2) { /* volume root */ - tvp = afs_GetVolume(&vcp->fid, 0, READ_LOCK); + tvp = afs_GetVolume(&vcp->f.fid, 0, READ_LOCK); if (!tvp) { #ifdef OSI_EXPORT_DEBUG printk("afs: get_name(%s, 0x%08x/%d/%d.%d): no volume for root\n", parent->d_name.name ? (char *)parent->d_name.name : "?", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique); #endif code = ENOENT; goto done; @@ -648,7 +648,7 @@ static int afs_export_get_name(struct dentry *parent, char *name, data.fid = tvp->mtpoint; afs_PutVolume(tvp, READ_LOCK); } else { - data.fid = vcp->fid; + data.fid = vcp->f.fid; } vcp = VTOAFS(parent->d_inode); @@ -657,8 +657,8 @@ static int afs_export_get_name(struct dentry *parent, char *name, parent->d_name.name ? (char *)parent->d_name.name : "?", data.fid.Cell, data.fid.Fid.Volume, data.fid.Fid.Vnode, data.fid.Fid.Unique, - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique); #endif code = afs_InitReq(&treq, credp); @@ -706,8 +706,8 @@ static int afs_export_get_name(struct dentry *parent, char *name, if (code) goto done; - if (vcp->fid.Cell != data.fid.Cell || - vcp->fid.Fid.Volume != data.fid.Fid.Volume) { + if (vcp->f.fid.Cell != data.fid.Cell || + vcp->f.fid.Fid.Volume != data.fid.Fid.Volume) { /* parent is not the expected cell and volume; thus it * cannot possibly contain the fid we are looking for */ #ifdef OSI_EXPORT_DEBUG @@ -715,7 +715,7 @@ static int afs_export_get_name(struct dentry *parent, char *name, parent->d_name.name ? (char *)parent->d_name.name : "?", data.fid.Cell, data.fid.Fid.Volume, data.fid.Fid.Vnode, data.fid.Fid.Unique, - vcp->fid.Cell, vcp->fid.Fid.Volume); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume); #endif code = ENOENT; goto done; @@ -723,15 +723,15 @@ static int afs_export_get_name(struct dentry *parent, char *name, redo: - if (!(vcp->states & CStatd)) { + if (!(vcp->f.states & CStatd)) { if ((code = afs_VerifyVCache2(vcp, &treq))) { #ifdef OSI_EXPORT_DEBUG printk("afs: get_name(%s, 0x%08x/%d/%d.%d): VerifyVCache2(0x%08x/%d/%d.%d): %d\n", parent->d_name.name ? (char *)parent->d_name.name : "?", data.fid.Cell, data.fid.Fid.Volume, data.fid.Fid.Vnode, data.fid.Fid.Unique, - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique, code); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique, code); #endif goto done; } @@ -744,8 +744,8 @@ redo: parent->d_name.name ? (char *)parent->d_name.name : "?", data.fid.Cell, data.fid.Fid.Volume, data.fid.Fid.Vnode, data.fid.Fid.Unique, - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique, code); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique, code); #endif code = EIO; goto done; @@ -760,17 +760,17 @@ redo: * 1. The cache data is being fetched by another process. * 2. The cache data is no longer valid */ - while ((vcp->states & CStatd) + while ((vcp->f.states & CStatd) && (tdc->dflags & DFFetching) - && hsame(vcp->m.DataVersion, tdc->f.versionNo)) { + && hsame(vcp->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&vcp->lock); afs_osi_Sleep(&tdc->validPos); ObtainReadLock(&vcp->lock); ObtainReadLock(&tdc->lock); } - if (!(vcp->states & CStatd) - || !hsame(vcp->m.DataVersion, tdc->f.versionNo)) { + if (!(vcp->f.states & CStatd) + || !hsame(vcp->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&vcp->lock); afs_PutDCache(tdc); @@ -779,8 +779,8 @@ redo: parent->d_name.name ? (char *)parent->d_name.name : "?", data.fid.Cell, data.fid.Fid.Volume, data.fid.Fid.Vnode, data.fid.Fid.Unique, - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique); #endif goto redo; } @@ -802,8 +802,8 @@ redo: parent->d_name.name ? (char *)parent->d_name.name : "?", data.fid.Cell, data.fid.Fid.Volume, data.fid.Fid.Vnode, data.fid.Fid.Unique, - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique, code); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique, code); #endif } @@ -855,10 +855,10 @@ static struct dentry *afs_export_get_parent(struct dentry *child) if (afs_IsDynrootMount(vcp)) { /* the dynmount directory; parent is always the AFS root */ - tfid = afs_globalVp->fid; + tfid = afs_globalVp->f.fid; } else if (afs_IsDynrootAny(vcp) && - VNUM_TO_VNTYPE(vcp->fid.Fid.Vnode) == VN_TYPE_MOUNT) { + VNUM_TO_VNTYPE(vcp->f.fid.Fid.Vnode) == VN_TYPE_MOUNT) { /* a mount point in the dynmount directory */ afs_GetDynrootMountFid(&tfid); @@ -870,12 +870,12 @@ static struct dentry *afs_export_get_parent(struct dentry *child) ReleaseReadLock(&vcp->lock); } else { ReleaseReadLock(&vcp->lock); - tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK); + tcell = afs_GetCell(vcp->f.fid.Cell, READ_LOCK); if (!tcell) { #ifdef OSI_EXPORT_DEBUG printk("afs: get_parent(0x%08x/%d/%d.%d): no cell\n", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique); #endif dp = ERR_PTR(-ENOENT); goto done; @@ -886,18 +886,18 @@ static struct dentry *afs_export_get_parent(struct dentry *child) afs_GetDynrootMountFid(&tfid); tfid.Fid.Vnode = VNUM_FROM_TYPEID(VN_TYPE_MOUNT, cellidx << 2); - tfid.Fid.Unique = vcp->fid.Fid.Volume; + tfid.Fid.Unique = vcp->f.fid.Fid.Volume; } } else { /* any other vnode */ - if (vType(vcp) == VDIR && !vcp->parentVnode && vcp->mvstat != 1) { + if (vType(vcp) == VDIR && !vcp->f.parent.vnode && vcp->mvstat != 1) { code = afs_InitReq(&treq, credp); if (code) { #ifdef OSI_EXPORT_DEBUG printk("afs: get_parent(0x%08x/%d/%d.%d): InitReq: %d\n", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique, code); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique, code); #endif dp = ERR_PTR(-ENOENT); goto done; @@ -906,8 +906,8 @@ static struct dentry *afs_export_get_parent(struct dentry *child) if (code) { #ifdef OSI_EXPORT_DEBUG printk("afs: get_parent(0x%08x/%d/%d.%d): update_dir_parent: %d\n", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique, code); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique, code); #endif dp = ERR_PTR(-ENOENT); goto done; @@ -915,16 +915,16 @@ static struct dentry *afs_export_get_parent(struct dentry *child) } } - tfid.Cell = vcp->fid.Cell; - tfid.Fid.Volume = vcp->fid.Fid.Volume; - tfid.Fid.Vnode = vcp->parentVnode; - tfid.Fid.Unique = vcp->parentUnique; + tfid.Cell = vcp->f.fid.Cell; + tfid.Fid.Volume = vcp->f.fid.Fid.Volume; + tfid.Fid.Vnode = vcp->f.parent.vnode; + tfid.Fid.Unique = vcp->f.parent.unique; } #ifdef OSI_EXPORT_DEBUG printk("afs: get_parent(0x%08x/%d/%d.%d): => 0x%08x/%d/%d.%d\n", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique, + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique, tfid.Cell, tfid.Fid.Volume, tfid.Fid.Vnode, tfid.Fid.Unique); #endif @@ -932,8 +932,8 @@ static struct dentry *afs_export_get_parent(struct dentry *child) if (!dp) { #ifdef OSI_EXPORT_DEBUG printk("afs: get_parent(0x%08x/%d/%d.%d): no dentry\n", - vcp->fid.Cell, vcp->fid.Fid.Volume, - vcp->fid.Fid.Vnode, vcp->fid.Fid.Unique); + vcp->f.fid.Cell, vcp->f.fid.Fid.Volume, + vcp->f.fid.Fid.Vnode, vcp->f.fid.Fid.Unique); #endif dp = ERR_PTR(-ENOENT); } diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 4b609e0..9a166d8 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -198,7 +198,7 @@ afs_root(struct super_block *afsp) register struct vcache *tvp = 0; AFS_STATCNT(afs_root); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { cred_t *credp = crref(); diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c index c7e39e2..c618228 100644 --- a/src/afs/LINUX/osi_vm.c +++ b/src/afs/LINUX/osi_vm.c @@ -102,8 +102,8 @@ osi_VM_StoreAllSegments(struct vcache *avc) { struct inode *ip = AFSTOV(avc); - if (!avc->states & CPageWrite) - avc->states |= CPageWrite; + if (!avc->f.states & CPageWrite) + avc->f.states |= CPageWrite; else return; /* someone already writing */ @@ -120,7 +120,7 @@ osi_VM_StoreAllSegments(struct vcache *avc) AFS_GLOCK(); ObtainWriteLock(&avc->lock, 121); #endif - avc->states &= ~CPageWrite; + avc->f.states &= ~CPageWrite; } /* Purge VM for a file when its callback is revoked. diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index d90a4bc..470f7d0 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -238,17 +238,17 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) * 1. The cache data is being fetched by another process. * 2. The cache data is no longer valid */ - while ((avc->states & CStatd) + while ((avc->f.states & CStatd) && (tdc->dflags & DFFetching) - && hsame(avc->m.DataVersion, tdc->f.versionNo)) { + && hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseSharedLock(&avc->lock); afs_osi_Sleep(&tdc->validPos); ObtainSharedLock(&avc->lock, 812); ObtainReadLock(&tdc->lock); } - if (!(avc->states & CStatd) - || !hsame(avc->m.DataVersion, tdc->f.versionNo)) { + if (!(avc->f.states & CStatd) + || !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseSharedLock(&avc->lock); afs_PutDCache(tdc); @@ -258,7 +258,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) /* Set the readdir-in-progress flag, and downgrade the lock * to shared so others will be able to acquire a read lock. */ - avc->states |= CReadDir; + avc->f.states |= CReadDir; avc->dcreaddir = tdc; avc->readdir_pid = MyPidxx; ConvertWToSLock(&avc->lock); @@ -277,7 +277,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) if (!de) break; - ino = afs_calc_inum (avc->fid.Fid.Volume, ntohl(de->fid.vnode)); + ino = afs_calc_inum (avc->f.fid.Fid.Volume, ntohl(de->fid.vnode)); if (de->name) len = strlen(de->name); @@ -298,16 +298,16 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) struct VenusFid afid; struct vcache *tvc; int vtype; - afid.Cell = avc->fid.Cell; - afid.Fid.Volume = avc->fid.Fid.Volume; + afid.Cell = avc->f.fid.Cell; + afid.Fid.Volume = avc->f.fid.Fid.Volume; afid.Fid.Vnode = ntohl(de->fid.vnode); afid.Fid.Unique = ntohl(de->fid.vunique); - if ((avc->states & CForeign) == 0 && (ntohl(de->fid.vnode) & 1)) { + if ((avc->f.states & CForeign) == 0 && (ntohl(de->fid.vnode) & 1)) { type = DT_DIR; } else if ((tvc = afs_FindVCache(&afid, 0, 0))) { if (tvc->mvstat) { type = DT_DIR; - } else if (((tvc->states) & (CStatd | CTruth))) { + } else if (((tvc->f.states) & (CStatd | CTruth))) { /* CTruth will be set if the object has *ever* been statd */ vtype = vType(tvc); @@ -348,7 +348,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) ReleaseReadLock(&tdc->lock); afs_PutDCache(tdc); UpgradeSToWLock(&avc->lock, 813); - avc->states &= ~CReadDir; + avc->f.states &= ~CReadDir; avc->dcreaddir = 0; avc->readdir_pid = 0; ReleaseSharedLock(&avc->lock); @@ -413,7 +413,7 @@ afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) code = generic_file_mmap(fp, vmap); AFS_GLOCK(); if (!code) - vcp->states |= CMAPPED; + vcp->f.states |= CMAPPED; out: AFS_GUNLOCK(); @@ -770,7 +770,7 @@ check_bad_parent(struct dentry *dp) struct vcache *vcp = VTOAFS(dp->d_inode), *avc = NULL; struct vcache *pvc = VTOAFS(dp->d_parent->d_inode); - if (vcp->mvid->Fid.Volume != pvc->fid.Fid.Volume) { /* bad parent */ + if (vcp->mvid->Fid.Volume != pvc->f.fid.Fid.Volume) { /* bad parent */ credp = crref(); /* force a lookup, so vcp->mvid is fixed up */ @@ -807,7 +807,7 @@ afs_linux_revalidate(struct dentry *dp) #ifdef notyet /* Make this a fast path (no crref), since it's called so often. */ - if (vcp->states & CStatd) { + if (vcp->f.states & CStatd) { if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */ check_bad_parent(dp); /* check and correct mvid */ @@ -885,7 +885,7 @@ afs_linux_dentry_revalidate(struct dentry *dp) goto good_dentry; if (vcp->mvstat == 1) { /* mount point */ - if (vcp->mvid && (vcp->states & CMValid)) { + if (vcp->mvid && (vcp->f.states & CMValid)) { int tryEvalOnly = 0; int code = 0; struct vrequest treq; @@ -931,7 +931,7 @@ afs_linux_dentry_revalidate(struct dentry *dp) * isn't enough since the vnode may have been renamed. */ - if (hgetlo(pvcp->m.DataVersion) > dp->d_time || !(vcp->states & CStatd)) { + if (hgetlo(pvcp->f.m.DataVersion) > dp->d_time || !(vcp->f.states & CStatd)) { credp = crref(); afs_lookup(pvcp, dp->d_name.name, &tvc, credp); @@ -942,7 +942,7 @@ afs_linux_dentry_revalidate(struct dentry *dp) goto bad_dentry; vattr2inode(AFSTOV(vcp), &vattr); - dp->d_time = hgetlo(pvcp->m.DataVersion); + dp->d_time = hgetlo(pvcp->f.m.DataVersion); } /* should we always update the attributes at this point? */ @@ -951,7 +951,7 @@ afs_linux_dentry_revalidate(struct dentry *dp) } else { #ifdef notyet pvcp = VTOAFS(dp->d_parent->d_inode); /* dget_parent()? */ - if (hgetlo(pvcp->m.DataVersion) > dp->d_time) + if (hgetlo(pvcp->f.m.DataVersion) > dp->d_time) goto bad_dentry; #endif @@ -999,7 +999,7 @@ afs_dentry_iput(struct dentry *dp, struct inode *ip) struct vcache *vcp = VTOAFS(ip); AFS_GLOCK(); - if (!AFS_IS_DISCONNECTED || (vcp->states & CUnlinked)) { + if (!AFS_IS_DISCONNECTED || (vcp->f.states & CUnlinked)) { (void) afs_InactiveVCache(vcp, NULL); } AFS_GUNLOCK(); @@ -1019,7 +1019,7 @@ afs_dentry_iput(struct dentry *dp, struct inode *ip) static int afs_dentry_delete(struct dentry *dp) { - if (dp->d_inode && (VTOAFS(dp->d_inode)->states & CUnlinked)) + if (dp->d_inode && (VTOAFS(dp->d_inode)->f.states & CUnlinked)) return 1; /* bad inode? */ return 0; @@ -1075,7 +1075,7 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) afs_fill_inode(ip, &vattr); insert_inode_hash(ip); dp->d_op = &afs_dentry_operations; - dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); + dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); d_instantiate(dp, ip); } AFS_GUNLOCK(); @@ -1134,7 +1134,7 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) insert_inode_hash(ip); } dp->d_op = &afs_dentry_operations; - dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); + dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); AFS_GUNLOCK(); #if defined(AFS_LINUX24_ENV) @@ -1226,7 +1226,7 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) maybe_lock_kernel(); #endif if (VREFCOUNT(tvc) > 1 && tvc->opens > 0 - && !(tvc->states & CUnlinked)) { + && !(tvc->f.states & CUnlinked)) { struct dentry *__dp; char *__name; @@ -1256,7 +1256,7 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) crfree(tvc->uncred); } tvc->uncred = credp; - tvc->states |= CUnlinked; + tvc->f.states |= CUnlinked; #ifdef DCACHE_NFSFS_RENAMED #ifdef AFS_LINUX26_ENV spin_lock(&dp->d_lock); @@ -1272,7 +1272,7 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) AFS_GUNLOCK(); if (!code) { - __dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); + __dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); d_move(dp, __dp); } dput(__dp); @@ -1340,7 +1340,7 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) afs_fill_inode(ip, &vattr); dp->d_op = &afs_dentry_operations; - dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); + dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); d_instantiate(dp, ip); } AFS_GUNLOCK(); @@ -1887,7 +1887,7 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp, ICL_TYPE_INT32, 99999); ObtainReadLock(&vcp->lock); - if (vcp->states & CPageWrite) { + if (vcp->f.states & CPageWrite) { ReleaseReadLock(&vcp->lock); AFS_GUNLOCK(); maybe_unlock_kernel(); @@ -1910,8 +1910,8 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp, code = afs_write(vcp, &tuio, f_flags, credp, 0); - i_size_write(ip, vcp->m.Length); - ip->i_blocks = ((vcp->m.Length + 1023) >> 10) << 1; + i_size_write(ip, vcp->f.m.Length); + ip->i_blocks = ((vcp->f.m.Length + 1023) >> 10) << 1; if (!code) { struct vrequest treq; @@ -2014,14 +2014,14 @@ afs_linux_updatepage(struct file *fp, struct page *pp, unsigned long offset, code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); - i_size_write(ip, vcp->m.Length); - ip->i_blocks = ((vcp->m.Length + 1023) >> 10) << 1; + i_size_write(ip, vcp->f.m.Length); + ip->i_blocks = ((vcp->f.m.Length + 1023) >> 10) << 1; if (!code) { struct vrequest treq; ObtainWriteLock(&vcp->lock, 533); - vcp->m.Date = osi_Time(); /* set modification time */ + vcp->f.m.Date = osi_Time(); /* set modification time */ if (!afs_InitReq(&treq, credp)) code = afs_DoPartialWrite(vcp, &treq); ReleaseWriteLock(&vcp->lock); diff --git a/src/afs/NBSD/osi_vfsops.c b/src/afs/NBSD/osi_vfsops.c index 4bb0b3c..3a1e73d 100644 --- a/src/afs/NBSD/osi_vfsops.c +++ b/src/afs/NBSD/osi_vfsops.c @@ -136,7 +136,7 @@ mp_afs_root(struct mount *afsp, struct vnode **avpp) AFS_GLOCK(); AFS_STATCNT(afs_root); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { if (afs_globalVp) { @@ -288,15 +288,15 @@ mp_afs_vptofh(struct vnode *avn, struct fid *fidp) if (afs_NFSRootOnly && (avc == afs_globalVp)) rootvp = 1; if (!afs_NFSRootOnly || rootvp) { - tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); - Sfid.Volume = avc->fid.Fid.Volume; - fidp->fid_reserved = avc->fid.Fid.Vnode; + tcell = afs_GetCell(avc->f.fid.Cell, READ_LOCK); + Sfid.Volume = avc->f.fid.Fid.Volume; + fidp->fid_reserved = avc->f.fid.Fid.Vnode; Sfid.CellAndUnique = - ((tcell->cellIndex << 24) + (avc->fid.Fid.Unique & 0xffffff)); + ((tcell->cellIndex << 24) + (avc->f.fid.Fid.Unique & 0xffffff)); afs_PutCell(tcell, READ_LOCK); - if (avc->fid.Fid.Vnode > 0xffff) + if (avc->f.fid.Fid.Vnode > 0xffff) afs_fid_vnodeoverflow++; - if (avc->fid.Fid.Unique > 0xffffff) + if (avc->f.fid.Fid.Unique > 0xffffff) afs_fid_uniqueoverflow++; } else { fidp->fid_reserved = AFS_XLATOR_MAGIC; diff --git a/src/afs/NBSD/osi_vnodeops.c b/src/afs/NBSD/osi_vnodeops.c index a5bd347..af8e71d 100644 --- a/src/afs/NBSD/osi_vnodeops.c +++ b/src/afs/NBSD/osi_vnodeops.c @@ -372,10 +372,10 @@ mp_afs_page_read(avc, uio, acred) AFS_GLOCK(); error = afs_rdwr(avc, uio, UIO_READ, 0, acred); afs_Trace3(afs_iclSetp, CM_TRACE_PAGE_READ, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, error, ICL_TYPE_INT32, avc->states); + ICL_TYPE_INT32, error, ICL_TYPE_INT32, avc->f.states); if (error) { error = EIO; - } else if ((avc->states) == 0) { + } else if ((avc->f.states) == 0) { afs_InitReq(&treq, acred); ObtainWriteLock(&avc->lock, 161); afs_Wire(avc, &treq); @@ -398,7 +398,7 @@ mp_afs_page_write(avc, uio, acred, pager, offset) AFS_GLOCK(); error = afs_rdwr(avc, uio, UIO_WRITE, 0, acred); afs_Trace3(afs_iclSetp, CM_TRACE_PAGE_WRITE, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, error, ICL_TYPE_INT32, avc->states); + ICL_TYPE_INT32, error, ICL_TYPE_INT32, avc->f.states); if (error) { error = EIO; } @@ -458,9 +458,9 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred) ObtainWriteLock(&avc->lock, 162); /* adjust parameters when appending files */ if ((ioflag & IO_APPEND) && uio->uio_rw == UIO_WRITE) - uio->uio_offset = avc->m.Length; /* write at EOF position */ + uio->uio_offset = avc->f.m.Length; /* write at EOF position */ if (uio->uio_rw == UIO_WRITE) { - avc->states |= CDirty; + avc->f.states |= CDirty; afs_FakeOpen(avc); didFakeOpen = 1; /* @@ -469,9 +469,9 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred) * the I/O. */ size = uio->afsio_resid + uio->afsio_offset; /* new file size */ - if (size > avc->m.Length) - avc->m.Length = size; /* file grew */ - avc->m.Date = osi_Time(); /* Set file date (for ranlib) */ + if (size > avc->f.m.Length) + avc->f.m.Length = size; /* file grew */ + avc->f.m.Date = osi_Time(); /* Set file date (for ranlib) */ if (uio->afsio_resid > PAGE_SIZE) cnt = uio->afsio_resid / PAGE_SIZE; save_resid = uio->afsio_resid; @@ -496,8 +496,8 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred) eof = 0; /* flag telling us if we hit the EOF on the read */ if (uio->uio_rw == UIO_READ) { /* we're doing a read operation */ /* don't read past EOF */ - if (tsize + fileBase > avc->m.Length) { - tsize = avc->m.Length - fileBase; + if (tsize + fileBase > avc->f.m.Length) { + tsize = avc->f.m.Length - fileBase; eof = 1; /* we did hit the EOF */ if (tsize < 0) tsize = 0; /* better safe than sorry */ @@ -513,7 +513,7 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred) if (uio->uio_rw == UIO_WRITE && counter > 0 && AFS_CHUNKOFFSET(fileBase) == 0) { code = afs_DoPartialWrite(avc, &treq); - avc->states |= CDirty; + avc->f.states |= CDirty; } if (code) { @@ -543,7 +543,7 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred) if ((uio->uio_rw == UIO_WRITE) && ((pageOffset == 0 - && (size == PAGE_SIZE || fileBase >= avc->m.Length)))) { + && (size == PAGE_SIZE || fileBase >= avc->f.m.Length)))) { struct vnode *vp = (struct vnode *)avc; /* we're doing a write operation past eof; no need to read it */ newpage = 1; @@ -644,7 +644,7 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred) } if (didFakeOpen) afs_FakeClose(avc, cred); - if (uio->uio_rw == UIO_WRITE && code == 0 && (avc->states & CDirty)) { + if (uio->uio_rw == UIO_WRITE && code == 0 && (avc->f.states & CDirty)) { code = afs_DoPartialWrite(avc, &treq); } ReleaseWriteLock(&avc->lock); @@ -721,7 +721,7 @@ mp_afs_mmap(avc, offset, map, addrp, len, prot, maxprot, flags, cred) } osi_FlushPages(avc); /* ensure old pages are gone */ ObtainWriteLock(&avc->lock, 166); - avc->states |= CMAPPED; + avc->f.states |= CMAPPED; ReleaseWriteLock(&avc->lock); ap->a_offset = offset; ap->a_vaddr = addrp; @@ -797,7 +797,7 @@ mp_afs_getpage(vop, offset, len, protp, pl, plsz, mape, addr, rw, cred) goto out; } if (flags & B_NOCACHE) { /* if (page) */ - if ((rw & B_WRITE) && (offset + len >= avc->m.Length)) { + if ((rw & B_WRITE) && (offset + len >= avc->f.m.Length)) { struct vnode *vp = (struct vnode *)avc; /* we're doing a write operation past eof; no need to read it */ AFS_GUNLOCK(); @@ -910,7 +910,7 @@ mp_afs_putpage(vop, pl, pcnt, flags, cred) done: ReleaseWriteLock(&avc->lock); afs_Trace2(afs_iclSetp, CM_TRACE_PAGEOUTDONE, ICL_TYPE_INT32, code, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_INT32, avc->f.m.Length); AFS_GUNLOCK(); return code; } diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index e01b1bf..7abc321 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -1028,9 +1028,9 @@ afs_nbsd_print(void *v) struct vnode *vp = ap->a_vp; struct vcache *vc = VTOAFS(ap->a_vp); - printf("tag %d, fid: %d.%x.%x.%x, ", vp->v_tag, vc->fid.Cell, - (int)vc->fid.Fid.Volume, (int)vc->fid.Fid.Vnode, - (int)vc->fid.Fid.Unique); + printf("tag %d, fid: %d.%x.%x.%x, ", vp->v_tag, vc->f.fid.Cell, + (int)vc->f.fid.Fid.Volume, (int)vc->f.fid.Fid.Vnode, + (int)vc->f.fid.Fid.Unique); lockmgr_printinfo(&vc->rwlock); printf("\n"); return 0; diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index 2792397..ffc5abc 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -120,7 +120,7 @@ afs_root(struct vfs *afsp, struct vnode **avpp) AFS_STATCNT(afs_root); again: - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { if (MUTEX_HELD(&vp->v_lock)) { diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index d5f5d27..71db899 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -342,8 +342,8 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp, ObtainReadLock(&tdc->lock); /* Check to see whether the cache entry is still valid */ - if (!(avc->states & CStatd) - || !hsame(avc->m.DataVersion, tdc->f.versionNo)) { + if (!(avc->f.states & CStatd) + || !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&avc->lock); afs_BozonUnlock(&avc->pvnLock, avc); @@ -520,7 +520,7 @@ afs_putpage(struct vnode *vp, offset_t off, u_int len, int flags, if (len) { endPos = (afs_offs_t) off + len; /* position we're supposed to write up to */ while ((afs_offs_t) toff < endPos - && (afs_offs_t) toff < avc->m.Length) { + && (afs_offs_t) toff < avc->f.m.Length) { /* If not invalidating pages use page_lookup_nowait to avoid reclaiming * them from the free list */ @@ -606,8 +606,8 @@ afs_putapage(struct vnode *vp, struct page *pages, u_int * offp, * XXX Find a kluster that fits in one block (or page). We also * adjust the i/o if the file space is less than a while page. XXX */ - if (off + tlen > avc->m.Length) { - tlen = avc->m.Length - off; + if (off + tlen > avc->f.m.Length) { + tlen = avc->f.m.Length - off; } /* can't call mapout with 0 length buffers (rmfree panics) */ if (((tlen >> 24) & 0xff) == 0xff) { @@ -720,9 +720,9 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw, /* adjust parameters when appending files */ if ((ioflag & IO_APPEND) && arw == UIO_WRITE) { #if defined(AFS_SUN56_ENV) - auio->uio_loffset = avc->m.Length; /* write at EOF position */ + auio->uio_loffset = avc->f.m.Length; /* write at EOF position */ #else - auio->uio_offset = avc->m.Length; /* write at EOF position */ + auio->uio_offset = avc->f.m.Length; /* write at EOF position */ #endif } if (auio->afsio_offset < 0 || (auio->afsio_offset + auio->uio_resid) < 0) { @@ -785,19 +785,19 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw, * to hold the results (since afs_putpage will be called to force the I/O */ size = auio->afsio_resid + auio->afsio_offset; /* new file size */ appendLength = size; - origLength = avc->m.Length; - if (size > avc->m.Length) { + origLength = avc->f.m.Length; + if (size > avc->f.m.Length) { afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, ICL_TYPE_STRING, __FILE__, ICL_TYPE_LONG, __LINE__, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length), ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(size)); - avc->m.Length = size; /* file grew */ + avc->f.m.Length = size; /* file grew */ } - avc->states |= CDirty; /* Set the dirty bit */ - avc->m.Date = osi_Time(); /* Set file date (for ranlib) */ + avc->f.states |= CDirty; /* Set the dirty bit */ + avc->f.m.Date = osi_Time(); /* Set file date (for ranlib) */ } else { mode = S_READ; /* map-in read-only */ - origLength = avc->m.Length; + origLength = avc->f.m.Length; } if (acred && AFS_NFSXLATORREQ(acred)) { @@ -866,7 +866,7 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw, break; /* nothing to transfer, we're done */ } if (arw == UIO_WRITE) - avc->states |= CDirty; /* may have been cleared by DoPartialWrite */ + avc->f.states |= CDirty; /* may have been cleared by DoPartialWrite */ /* Before dropping lock, hold the chunk (create it if necessary). This * serves two purposes: (1) Ensure Cache Truncate Daemon doesn't try @@ -925,12 +925,12 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw, AFS_GLOCK(); dcp_newpage = afs_FindDCache(avc, pageBase); if (dcp_newpage - && hsame(avc->m.DataVersion, dcp_newpage->f.versionNo)) { + && hsame(avc->f.m.DataVersion, dcp_newpage->f.versionNo)) { ObtainWriteLock(&avc->lock, 251); ObtainWriteLock(&avc->vlock, 576); ObtainReadLock(&dcp_newpage->lock); if ((avc->activeV == 0) - && hsame(avc->m.DataVersion, dcp_newpage->f.versionNo) + && hsame(avc->f.m.DataVersion, dcp_newpage->f.versionNo) && !(dcp_newpage->dflags & (DFFetching))) { AFS_GUNLOCK(); segmap_pagecreate(segkmap, raddr, rsize, 1); @@ -977,7 +977,7 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw, if (didFakeOpen) { afs_FakeClose(avc, acred); } - if (arw == UIO_WRITE && (avc->states & CDirty)) { + if (arw == UIO_WRITE && (avc->f.states & CDirty)) { code2 = afs_DoPartialWrite(avc, &treq); if (!code) code = code2; @@ -1053,7 +1053,7 @@ afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len, } afs_BozonLock(&avc->pvnLock, avc); osi_FlushPages(avc, cred); /* ensure old pages are gone */ - avc->states |= CMAPPED; /* flag cleared at afs_inactive */ + avc->f.states |= CMAPPED; /* flag cleared at afs_inactive */ afs_BozonUnlock(&avc->pvnLock, avc); AFS_GUNLOCK(); @@ -1791,7 +1791,7 @@ afs_inactive(struct vcache *avc, struct AFS_UCRED *acred) * lose the open count for volume roots (mvstat 2), even though they * will get VOP_INACTIVE'd when released by afs_PutFakeStat(). */ - if (avc->opens > 0 && avc->mvstat == 0 && !(avc->states & CCore)) + if (avc->opens > 0 && avc->mvstat == 0 && !(avc->f.states & CCore)) avc->opens = avc->execsOrWriters = 0; afs_InactiveVCache(avc, acred); diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 7ae78e9..466a6c1 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -1044,13 +1044,13 @@ void osi_FlushPages(register struct vcache *avc, struct AFS_UCRED *credp) { ObtainSharedLock(&avc->lock, 555); - if ((hcmp((avc->m.DataVersion), (avc->mapDV)) <= 0) + if ((hcmp((avc->f.m.DataVersion), (avc->mapDV)) <= 0) || ((avc->execsOrWriters > 0) && afs_DirtyPages(avc))) { ReleaseSharedLock(&avc->lock); return; } UpgradeSToWLock(&avc->lock, 565); - hset(avc->mapDV, avc->m.DataVersion); + hset(avc->mapDV, avc->f.m.DataVersion); ReleaseWriteLock(&avc->lock); return; } @@ -1058,8 +1058,8 @@ osi_FlushPages(register struct vcache *avc, struct AFS_UCRED *credp) void osi_FlushText_really(register struct vcache *vp) { - if (hcmp(vp->m.DataVersion, vp->flushDV) > 0) { - hset(vp->flushDV, vp->m.DataVersion); + if (hcmp(vp->f.m.DataVersion, vp->flushDV) > 0) { + hset(vp->flushDV, vp->f.m.DataVersion); } return; } diff --git a/src/afs/UKERNEL/osi_vfsops.c b/src/afs/UKERNEL/osi_vfsops.c index b9e95e9..8ee58a9 100644 --- a/src/afs/UKERNEL/osi_vfsops.c +++ b/src/afs/UKERNEL/osi_vfsops.c @@ -78,7 +78,7 @@ afs_root(OSI_VFS_ARG(afsp), avpp) OSI_VFS_CONVERT(afsp); AFS_STATCNT(afs_root); - if (afs_globalVp && (afs_globalVp->states & CStatd)) { + if (afs_globalVp && (afs_globalVp->f.states & CStatd)) { tvp = afs_globalVp; } else { if (afs_globalVp) { diff --git a/src/afs/VNOPS/afs_vnop_access.c b/src/afs/VNOPS/afs_vnop_access.c index 66aa9de..b497dd9 100644 --- a/src/afs/VNOPS/afs_vnop_access.c +++ b/src/afs/VNOPS/afs_vnop_access.c @@ -58,7 +58,7 @@ afs_GetAccessBits(register struct vcache *avc, register afs_int32 arights, { AFS_STATCNT(afs_GetAccessBits); /* see if anyuser has the required access bits */ - if ((arights & avc->anyAccess) == arights) { + if ((arights & avc->f.anyAccess) == arights) { return arights; } @@ -72,19 +72,19 @@ afs_GetAccessBits(register struct vcache *avc, register afs_int32 arights, } } - if (!(avc->states & CForeign)) { + if (!(avc->f.states & CForeign)) { /* If there aren't any bits cached for this user (but the vnode * _is_ cached, obviously), make sure this user has valid tokens * before bothering with the RPC. */ struct unixuser *tu; - tu = afs_FindUser(areq->uid, avc->fid.Cell, READ_LOCK); + tu = afs_FindUser(areq->uid, avc->f.fid.Cell, READ_LOCK); if (!tu) { - return (arights & avc->anyAccess); + return (arights & avc->f.anyAccess); } if ((tu->vid == UNDEFVID) || !(tu->states & UHasTokens) || (tu->states & UTokensBad)) { afs_PutUser(tu, READ_LOCK); - return (arights & avc->anyAccess); + return (arights & avc->f.anyAccess); } else { afs_PutUser(tu, READ_LOCK); } @@ -99,7 +99,7 @@ afs_GetAccessBits(register struct vcache *avc, register afs_int32 arights, struct AFSFetchStatus OutStatus; afs_int32 code; - code = afs_FetchStatus(avc, &avc->fid, areq, &OutStatus); + code = afs_FetchStatus(avc, &avc->f.fid, areq, &OutStatus); return (code ? 0 : OutStatus.CallerAccess & arights); } } @@ -120,7 +120,7 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq, AFS_STATCNT(afs_AccessOK); - if ((vType(avc) == VDIR) || (avc->states & CForeign)) { + if ((vType(avc) == VDIR) || (avc->f.states & CForeign)) { /* rights are just those from acl */ if (afs_InReadDir(avc)) { /* if we are already in readdir, then they may have read and @@ -142,11 +142,11 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq, * rights for free. These rights will then be restricted by * the access mask. */ dirBits = 0; - if (avc->parentVnode) { - dirFid.Cell = avc->fid.Cell; - dirFid.Fid.Volume = avc->fid.Fid.Volume; - dirFid.Fid.Vnode = avc->parentVnode; - dirFid.Fid.Unique = avc->parentUnique; + if (avc->f.parent.vnode) { + dirFid.Cell = avc->f.fid.Cell; + dirFid.Fid.Volume = avc->f.fid.Fid.Volume; + dirFid.Fid.Vnode = avc->f.parent.vnode; + dirFid.Fid.Unique = avc->f.parent.unique; /* Avoid this GetVCache call */ tvc = afs_GetVCache(&dirFid, areq, NULL, NULL); if (tvc) { @@ -178,10 +178,10 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq, * NFS translator and we don't know if it's a read or execute * on the NFS client, but both need to read the data. */ - mask = (avc->m.Mode & 0700) >> 6; /* file restrictions to use */ + mask = (avc->f.m.Mode & 0700) >> 6; /* file restrictions to use */ fileBits &= ~fileModeMap[mask]; if (check_mode_bits & CMB_ALLOW_EXEC_AS_READ) { - if (avc->m.Mode & 0100) + if (avc->f.m.Mode & 0100) fileBits |= PRSFS_READ; } } @@ -208,7 +208,7 @@ afs_access(OSI_VC_DECL(avc), register afs_int32 amode, AFS_STATCNT(afs_access); afs_Trace3(afs_iclSetp, CM_TRACE_ACCESS, ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, amode, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); afs_InitFakeStat(&fakestate); if ((code = afs_InitReq(&treq, acred))) return code; @@ -243,7 +243,7 @@ afs_access(OSI_VC_DECL(avc), register afs_int32 amode, } /* if we're looking for write access and we have a read-only file system, report it */ - if ((amode & VWRITE) && (avc->states & CRO)) { + if ((amode & VWRITE) && (avc->f.states & CRO)) { afs_PutFakeStat(&fakestate); AFS_DISCON_UNLOCK(); return EROFS; @@ -258,7 +258,7 @@ afs_access(OSI_VC_DECL(avc), register afs_int32 amode, } code = 1; /* Default from here on in is access ok. */ - if (avc->states & CForeign) { + if (avc->f.states & CForeign) { /* In the dfs xlator the EXEC bit is mapped to LOOKUP */ if (amode & VEXEC) code = afs_AccessOK(avc, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS); @@ -309,9 +309,9 @@ afs_access(OSI_VC_DECL(avc), register afs_int32 amode, */ if (!((amode & VREAD) && AFS_NFSXLATORREQ(acred))) #endif - if ((avc->m.Mode & 0100) == 0) + if ((avc->f.m.Mode & 0100) == 0) code = 0; - } else if (avc->m.Mode & 0100) + } else if (avc->f.m.Mode & 0100) code = 1; } if (code && (amode & VWRITE)) { @@ -325,7 +325,7 @@ afs_access(OSI_VC_DECL(avc), register afs_int32 amode, ** call returns failure. hence, we retry without any file ** mode bit checking */ if (!code && AFS_NFSXLATORREQ(acred) - && avc->m.Owner == ANONYMOUSID) + && avc->f.m.Owner == ANONYMOUSID) code = afs_AccessOK(avc, PRSFS_WRITE, &treq, DONT_CHECK_MODE_BITS); diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 46b9886..ce85878 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -54,14 +54,14 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) fakedir = 1; attrs->va_type = fakedir ? VDIR : vType(avc); #if defined(AFS_SGI_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) - attrs->va_mode = fakedir ? 0755 : (mode_t) (avc->m.Mode & 0xffff); + attrs->va_mode = fakedir ? 0755 : (mode_t) (avc->f.m.Mode & 0xffff); #else - attrs->va_mode = fakedir ? VDIR | 0755 : avc->m.Mode; + attrs->va_mode = fakedir ? VDIR | 0755 : avc->f.m.Mode; #endif - if (avc->m.Mode & (VSUID | VSGID)) { + if (avc->f.m.Mode & (VSUID | VSGID)) { /* setuid or setgid, make sure we're allowed to run them from this cell */ - tcell = afs_GetCell(avc->fid.Cell, 0); + tcell = afs_GetCell(avc->f.fid.Cell, 0); if (tcell && (tcell->states & CNoSUID)) attrs->va_mode &= ~(VSUID | VSGID); } @@ -88,8 +88,8 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) } } #endif /* AFS_DARWIN_ENV */ - attrs->va_uid = fakedir ? 0 : avc->m.Owner; - attrs->va_gid = fakedir ? 0 : avc->m.Group; /* yeah! */ + attrs->va_uid = fakedir ? 0 : avc->f.m.Owner; + attrs->va_gid = fakedir ? 0 : avc->f.m.Group; /* yeah! */ #if defined(AFS_SUN56_ENV) attrs->va_fsid = avc->v.v_vfsp->vfs_fsid.val[0]; #elif defined(AFS_OSF_ENV) @@ -102,26 +102,26 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) attrs->va_fsid = 1; #endif if (avc->mvstat == 2) { - tvp = afs_GetVolume(&avc->fid, 0, READ_LOCK); + tvp = afs_GetVolume(&avc->f.fid, 0, READ_LOCK); /* The mount point's vnode. */ if (tvp) { attrs->va_nodeid = afs_calc_inum (tvp->mtpoint.Fid.Volume, tvp->mtpoint.Fid.Vnode); - if (FidCmp(&afs_rootFid, &avc->fid) && !attrs->va_nodeid) + if (FidCmp(&afs_rootFid, &avc->f.fid) && !attrs->va_nodeid) attrs->va_nodeid = 2; afs_PutVolume(tvp, READ_LOCK); } else attrs->va_nodeid = 2; } else attrs->va_nodeid = - afs_calc_inum (avc->fid.Fid.Volume, - avc->fid.Fid.Vnode); + afs_calc_inum (avc->f.fid.Fid.Volume, + avc->f.fid.Fid.Vnode); attrs->va_nodeid &= 0x7fffffff; /* Saber C hates negative inode #s! */ - attrs->va_nlink = fakedir ? 100 : avc->m.LinkCount; - attrs->va_size = fakedir ? 4096 : avc->m.Length; + attrs->va_nlink = fakedir ? 100 : avc->f.m.LinkCount; + attrs->va_size = fakedir ? 4096 : avc->f.m.Length; attrs->va_atime.tv_sec = attrs->va_mtime.tv_sec = attrs->va_ctime.tv_sec = - fakedir ? 0 : (int)avc->m.Date; + fakedir ? 0 : (int)avc->f.m.Date; /* set microseconds to be dataversion # so that we approximate NFS-style * use of mtime as a dataversion #. We take it mod 512K because * microseconds *must* be less than a million, and 512K is the biggest @@ -135,14 +135,14 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec = attrs->va_ctime.tv_nsec = 0; - attrs->va_gen = hgetlo(avc->m.DataVersion); + attrs->va_gen = hgetlo(avc->f.m.DataVersion); #elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_OBSD_ENV) attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec = attrs->va_ctime.tv_nsec = - (hgetlo(avc->m.DataVersion) & 0x7ffff) * 1000; + (hgetlo(avc->f.m.DataVersion) & 0x7ffff) * 1000; #else attrs->va_atime.tv_usec = attrs->va_mtime.tv_usec = - attrs->va_ctime.tv_usec = (hgetlo(avc->m.DataVersion) & 0x7ffff); + attrs->va_ctime.tv_usec = (hgetlo(avc->f.m.DataVersion) & 0x7ffff); #endif #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_OSF_ENV) attrs->va_flags = 0; @@ -198,7 +198,7 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, struct AFS_UCRED *acred) AFS_STATCNT(afs_getattr); afs_Trace2(afs_iclSetp, CM_TRACE_GETATTR, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); if (afs_fakestat_enable && avc->mvstat == 1) { struct afs_fakestat_state fakestat; @@ -224,7 +224,7 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, struct AFS_UCRED *acred) } #endif #if defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN80_ENV) - if (avc->states & CUBCinit) { + if (avc->f.states & CUBCinit) { code = afs_CopyOutAttrs(avc, attrs); return code; } @@ -239,7 +239,7 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, struct AFS_UCRED *acred) if (afs_shuttingdown) return EIO; - if (!(avc->states & CStatd)) { + if (!(avc->f.states & CStatd)) { if (!(code = afs_InitReq(&treq, acred))) { code = afs_VerifyVCache2(avc, &treq); inited = 1; @@ -363,7 +363,7 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, #endif mask |= AFS_SETMODE; as->UnixModeBits = av->va_mode & 0xffff; - if (avc->states & CForeign) { + if (avc->f.states & CForeign) { ObtainWriteLock(&avc->lock, 127); afs_FreeAllAxs(&(avc->Access)); ReleaseWriteLock(&avc->lock); @@ -434,7 +434,7 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, return 0; } -/* We don't set CDirty bit in avc->states because setattr calls WriteVCache +/* We don't set CDirty bit in avc->f.states because setattr calls WriteVCache * synchronously, therefore, it's not needed. */ #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) @@ -458,12 +458,12 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, afs_Trace4(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, attrs->va_mask, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(attrs->va_size), ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); #else afs_Trace4(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, attrs->va_mode, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(attrs->va_size), ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); #endif if ((code = afs_InitReq(&treq, acred))) return code; @@ -475,7 +475,7 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, if (code) goto done; - if (avc->states & CRO) { + if (avc->f.states & CRO) { code = EROFS; goto done; } @@ -543,9 +543,9 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, #endif afs_size_t tsize = attrs->va_size; ObtainWriteLock(&avc->lock, 128); - avc->states |= CDirty; + avc->f.states |= CDirty; - if (AFS_IS_DISCONNECTED && tsize >=avc->m.Length) { + if (AFS_IS_DISCONNECTED && tsize >=avc->f.m.Length) { /* If we're growing the file, and we're disconnected, we need * to make the relevant dcache chunks appear ourselves. */ code = afs_ExtendSegments(avc, tsize, &treq); @@ -567,7 +567,7 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, } if (code == 0) { - if (((avc->execsOrWriters <= 0) && (avc->states & CCreating) == 0) + if (((avc->execsOrWriters <= 0) && (avc->f.states & CCreating) == 0) || (avc->execsOrWriters == 1 && AFS_NFSXLATORREQ(acred))) { /* Store files now if not disconnected. */ @@ -575,11 +575,11 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, if (!AFS_IS_DISCONNECTED) { code = afs_StoreAllSegments(avc, &treq, AFS_ASYNC); if (!code) - avc->states &= ~CDirty; + avc->f.states &= ~CDirty; } } } else - avc->states &= ~CDirty; + avc->f.states &= ~CDirty; ReleaseWriteLock(&avc->lock); hzero(avc->flushDV); @@ -595,9 +595,9 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, if (code) { ObtainWriteLock(&afs_xcbhash, 487); afs_DequeueCallback(avc); - avc->states &= ~CStatd; + avc->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); /* error? erase any changes we made to vcache entry */ } diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index d8d46ee..63ec220 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -117,7 +117,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, /** If the volume is read-only, return error without making an RPC to the * fileserver */ - if (adp->states & CRO) { + if (adp->f.states & CRO) { code = EROFS; goto done; } @@ -136,8 +136,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, * Make sure that the data in the cache is current. We may have * received a callback while we were waiting for the write lock. */ - if (!(adp->states & CStatd) - || (tdc && !hsame(adp->m.DataVersion, tdc->f.versionNo))) { + if (!(adp->f.states & CStatd) + || (tdc && !hsame(adp->f.m.DataVersion, tdc->f.versionNo))) { ReleaseWriteLock(&adp->lock); if (tdc) { ReleaseSharedLock(&tdc->lock); @@ -162,8 +162,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, goto done; } /* found the file, so use it */ - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; tvc = NULL; if (newFid.Fid.Unique == 0) { tvc = afs_LookupVCache(&newFid, &treq, NULL, adp, aname); @@ -196,8 +196,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, #endif { /* needed for write access check */ - tvc->parentVnode = adp->fid.Fid.Vnode; - tvc->parentUnique = adp->fid.Fid.Unique; + tvc->f.parent.vnode = adp->f.fid.Fid.Vnode; + tvc->f.parent.unique = adp->f.fid.Fid.Unique; /* need write mode for these guys */ if (!afs_AccessOK (tvc, PRSFS_WRITE, &treq, CHECK_MODE_BITS)) { @@ -233,7 +233,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, #endif attrs->va_size = len; ObtainWriteLock(&tvc->lock, 136); - tvc->states |= CCreating; + tvc->f.states |= CCreating; ReleaseWriteLock(&tvc->lock); #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) #if defined(AFS_SGI64_ENV) @@ -247,7 +247,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, code = afs_setattr(tvc, attrs, acred); #endif /* SUN5 || SGI */ ObtainWriteLock(&tvc->lock, 137); - tvc->states &= ~CCreating; + tvc->f.states &= ~CCreating; ReleaseWriteLock(&tvc->lock); if (code) { afs_PutVCache(tvc); @@ -264,7 +264,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, /* if we create the file, we don't do any access checks, since * that's how O_CREAT is supposed to work */ - if (adp->states & CForeign) { + if (adp->f.states & CForeign) { origCBs = afs_allCBs; origZaps = afs_allZaps; } else { @@ -299,14 +299,14 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, InStatus.UnixModeBits = attrs->va_mode & 0xffff; /* only care about protection bits */ do { - tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); if (tc) { hostp = tc->srvr->server; /* remember for callback processing */ now = osi_Time(); XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_CREATEFILE); RX_AFS_GUNLOCK(); code = - RXAFS_CreateFile(tc->id, (struct AFSFid *)&adp->fid.Fid, + RXAFS_CreateFile(tc->id, (struct AFSFid *)&adp->f.fid.Fid, aname, &InStatus, (struct AFSFid *) &newFid.Fid, &OutFidStatus, &OutDirStatus, &CallBack, &tsync); @@ -316,7 +316,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else code = -1; } while (afs_Analyze - (tc, code, &adp->fid, &treq, AFS_STATS_FS_RPCIDX_CREATEFILE, + (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, NULL)); if ((code == EEXIST || code == UAEEXIST) && @@ -355,7 +355,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (code < 0) { ObtainWriteLock(&afs_xcbhash, 488); afs_DequeueCallback(adp); - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); } @@ -370,8 +370,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else { #if defined(AFS_DISCON_ENV) /* Generate a fake FID for disconnected mode. */ - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; afs_GenFakeFid(&newFid, VREG, 1); #endif } /* if (!AFS_IS_DISCON_RW) */ @@ -394,10 +394,10 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, afs_PutDCache(tdc); } if (AFS_IS_DISCON_RW) - adp->m.LinkCount++; + adp->f.m.LinkCount++; - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; ReleaseWriteLock(&adp->lock); volp = afs_FindVolume(&newFid, READ_LOCK); @@ -419,7 +419,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, * would fail, since no call would be able to update the local vnode status after modifying * a file on a file server. */ ObtainWriteLock(&afs_xvcache, 138); - if (adp->states & CForeign) + if (adp->f.states & CForeign) finalZaps = afs_allZaps; /* do this before calling newvcache */ else finalZaps = afs_evenZaps; /* do this before calling newvcache */ @@ -438,22 +438,22 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, ObtainWriteLock(&afs_xcbhash, 489); finalCBs = afs_evenCBs; /* add the callback in */ - if (adp->states & CForeign) { - tvc->states |= CForeign; + if (adp->f.states & CForeign) { + tvc->f.states |= CForeign; finalCBs = afs_allCBs; } if (origCBs == finalCBs && origZaps == finalZaps) { - tvc->states |= CStatd; /* we've fake entire thing, so don't stat */ - tvc->states &= ~CBulkFetching; + tvc->f.states |= CStatd; /* we've fake entire thing, so don't stat */ + tvc->f.states &= ~CBulkFetching; if (!AFS_IS_DISCON_RW) { tvc->cbExpires = CallBack.ExpirationTime; afs_QueueCallback(tvc, CBHash(CallBack.ExpirationTime), volp); } } else { afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CUnique); + tvc->f.states &= ~(CStatd | CUnique); tvc->callback = 0; - if (tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)) + if (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)) osi_dnlc_purgedp(tvc); } ReleaseWriteLock(&afs_xcbhash); @@ -466,8 +466,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, afs_ProcessFS(tvc, &OutFidStatus, &treq); } - tvc->parentVnode = adp->fid.Fid.Vnode; - tvc->parentUnique = adp->fid.Fid.Unique; + tvc->f.parent.vnode = adp->f.fid.Fid.Vnode; + tvc->f.parent.unique = adp->f.fid.Fid.Unique; ReleaseWriteLock(&tvc->lock); *avcp = tvc; code = 0; @@ -501,7 +501,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } #ifdef AFS_OSF_ENV if (!code && !strcmp(aname, "core")) - tvc->states |= CCore1; + tvc->f.states |= CCore1; #endif afs_PutFakeStat(&fakestate); @@ -533,8 +533,8 @@ afs_LocalHero(register struct vcache *avc, register struct dcache *adc, hset64(avers, astat->dataVersionHigh, astat->DataVersion); /* this *is* the version number, no matter what */ if (adc) { - ok = (hsame(avc->m.DataVersion, adc->f.versionNo) && avc->callback - && (avc->states & CStatd) && avc->cbExpires >= osi_Time()); + ok = (hsame(avc->f.m.DataVersion, adc->f.versionNo) && avc->callback + && (avc->f.states & CStatd) && avc->cbExpires >= osi_Time()); } else { ok = 0; } @@ -543,14 +543,14 @@ afs_LocalHero(register struct vcache *avc, register struct dcache *adc, #endif /* The bulk status code used the length as a sequence number. */ /* Don't update the vcache entry unless the stats are current. */ - if (avc->states & CStatd) { - hset(avc->m.DataVersion, avers); + if (avc->f.states & CStatd) { + hset(avc->f.m.DataVersion, avers); #ifdef AFS_64BIT_CLIENT - FillInt64(avc->m.Length, astat->Length_hi, astat->Length); + FillInt64(avc->f.m.Length, astat->Length_hi, astat->Length); #else /* AFS_64BIT_CLIENT */ - avc->m.Length = astat->Length; + avc->f.m.Length = astat->Length; #endif /* AFS_64BIT_CLIENT */ - avc->m.Date = astat->ClientModTime; + avc->f.m.Date = astat->ClientModTime; } if (ok) { /* we've been tracking things correctly */ @@ -562,7 +562,7 @@ afs_LocalHero(register struct vcache *avc, register struct dcache *adc, ZapDCE(adc); DZap(adc); } - if (avc->states & CStatd) { + if (avc->f.states & CStatd) { osi_dnlc_purgedp(avc); } return 0; diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index 58fe676..6b35d5b 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -86,7 +86,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, /** If the volume is read-only, return error without making an RPC to the * fileserver */ - if (adp->states & CRO) { + if (adp->f.states & CRO) { code = EROFS; goto done; } @@ -105,14 +105,14 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (!AFS_IS_DISCON_RW) { do { - tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_MAKEDIR); now = osi_Time(); RX_AFS_GUNLOCK(); code = RXAFS_MakeDir(tc->id, - (struct AFSFid *)&adp->fid.Fid, + (struct AFSFid *)&adp->f.fid.Fid, aname, &InStatus, (struct AFSFid *)&newFid.Fid, @@ -127,14 +127,14 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else code = -1; } while (afs_Analyze - (tc, code, &adp->fid, &treq, AFS_STATS_FS_RPCIDX_MAKEDIR, + (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_MAKEDIR, SHARED_LOCK, NULL)); if (code) { if (code < 0) { ObtainWriteLock(&afs_xcbhash, 490); afs_DequeueCallback(adp); - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); } @@ -151,8 +151,8 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, /* We have the dir entry now, we can use it while disconnected. */ if (adp->mvid == NULL) { /* If not mount point, generate a new fid. */ - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; afs_GenFakeFid(&newFid, VDIR, 1); } /* XXX: If mount point???*/ @@ -183,11 +183,11 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (AFS_IS_DISCON_RW) /* We will have to settle with the local link count. */ - adp->m.LinkCount++; + adp->f.m.LinkCount++; else - adp->m.LinkCount = OutDirStatus.LinkCount; - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + adp->f.m.LinkCount = OutDirStatus.LinkCount; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; ReleaseWriteLock(&adp->lock); if (AFS_IS_DISCON_RW) { #if defined(AFS_DISCON_ENV) @@ -217,8 +217,8 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, ObtainWriteLock(&afs_xdcache, 739); code = afs_dir_MakeDir(new_dc, - (afs_int32 *) &newFid.Fid, - (afs_int32 *) &adp->fid.Fid); + (afs_int32 *) &newFid.Fid, + (afs_int32 *) &adp->f.fid.Fid); ReleaseWriteLock(&afs_xdcache); if (code) printf("afs_mkdir: afs_dirMakeDir code = %u\n", code); @@ -226,9 +226,10 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, afs_PutDCache(new_dc); ObtainWriteLock(&tvc->lock, 731); - afs_DisconAddDirty(tvc, VDisconCreate, 1); /* Update length in the vcache. */ - tvc->m.Length = new_dc->f.chunkBytes; + tvc->f.m.Length = new_dc->f.chunkBytes; + + afs_DisconAddDirty(tvc, VDisconCreate, 1); ReleaseWriteLock(&tvc->lock); #endif /* #ifdef AFS_DISCON_ENV */ } else { @@ -299,7 +300,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) /** If the volume is read-only, return error without making an RPC to the * fileserver */ - if (adp->states & CRO) { + if (adp->f.states & CRO) { code = EROFS; goto done; } @@ -314,7 +315,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) ObtainWriteLock(&adp->lock, 154); if (tdc) ObtainSharedLock(&tdc->lock, 633); - if (tdc && (adp->states & CForeign)) { + if (tdc && (adp->f.states & CForeign)) { struct VenusFid unlinkFid; unlinkFid.Fid.Vnode = 0; @@ -322,8 +323,8 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) if (code == 0) { afs_int32 cached = 0; - unlinkFid.Cell = adp->fid.Cell; - unlinkFid.Fid.Volume = adp->fid.Fid.Volume; + unlinkFid.Cell = adp->f.fid.Cell; + unlinkFid.Fid.Volume = adp->f.fid.Fid.Volume; if (unlinkFid.Fid.Unique == 0) { tvc = afs_LookupVCache(&unlinkFid, &treq, &cached, adp, aname); @@ -338,13 +339,13 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) if (!AFS_IS_DISCON_RW) { /* Not disconnected, can connect to server. */ do { - tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEDIR); RX_AFS_GUNLOCK(); code = RXAFS_RemoveDir(tc->id, - (struct AFSFid *)&adp->fid.Fid, + (struct AFSFid *)&adp->f.fid.Fid, aname, &OutDirStatus, &tsync); @@ -353,7 +354,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) } else code = -1; } while (afs_Analyze - (tc, code, &adp->fid, &treq, AFS_STATS_FS_RPCIDX_REMOVEDIR, + (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_REMOVEDIR, SHARED_LOCK, NULL)); if (code) { @@ -365,7 +366,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) if (code < 0) { ObtainWriteLock(&afs_xcbhash, 491); afs_DequeueCallback(adp); - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); } @@ -374,7 +375,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) } /* here if rpc worked; update the in-core link count */ - adp->m.LinkCount = OutDirStatus.LinkCount; + adp->f.m.LinkCount = OutDirStatus.LinkCount; } else { #if defined(AFS_DISCON_ENV) @@ -391,8 +392,8 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) /* Find the vcache. */ struct VenusFid tfid; - tfid.Cell = adp->fid.Cell; - tfid.Fid.Volume = adp->fid.Fid.Volume; + tfid.Cell = adp->f.fid.Cell; + tfid.Fid.Volume = adp->f.fid.Fid.Volume; code = afs_dir_Lookup(tdc, aname, &tfid.Fid); ObtainSharedLock(&afs_xvcache, 764); @@ -409,7 +410,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) } } - if (tvc->m.LinkCount > 2) { + if (tvc->f.m.LinkCount > 2) { /* This dir contains more than . and .., thus it can't be * deleted. */ @@ -425,11 +426,11 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) * If we were created locally, then we don't need to have a shadow * directory (as there's no server state to remember) */ - if (!adp->shVnode && !(adp->ddirty_flags & VDisconCreate)) { + if (!adp->f.shadow.vnode && !(adp->f.ddirty_flags & VDisconCreate)) { afs_MakeShadowDir(adp, tdc); } - adp->m.LinkCount--; + adp->f.m.LinkCount--; #endif /* #ifdef AFS_DISCON_ENV */ } /* if (!AFS_IS_DISCON_RW) */ @@ -455,10 +456,10 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) if (tvc) { ObtainWriteLock(&tvc->lock, 155); - tvc->states &= ~CUnique; /* For the dfs xlator */ + tvc->f.states &= ~CUnique; /* For the dfs xlator */ #if AFS_DISCON_ENV if (AFS_IS_DISCON_RW) { - if (tvc->ddirty_flags & VDisconCreate) { + if (tvc->f.ddirty_flags & VDisconCreate) { /* If we we were created whilst disconnected, removal doesn't * need to get logged. Just go away gracefully */ afs_DisconRemoveDirty(tvc); diff --git a/src/afs/VNOPS/afs_vnop_fid.c b/src/afs/VNOPS/afs_vnop_fid.c index a558212..ad3d5a5 100644 --- a/src/afs/VNOPS/afs_vnop_fid.c +++ b/src/afs/VNOPS/afs_vnop_fid.c @@ -97,15 +97,15 @@ afs_fid(OSI_VC_DECL(avc), struct fid **fidpp) || USE_SMALLFID(credp) #endif ) { - tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); - Sfid.Volume = avc->fid.Fid.Volume; - Sfid.Vnode = avc->fid.Fid.Vnode; + tcell = afs_GetCell(avc->f.fid.Cell, READ_LOCK); + Sfid.Volume = avc->f.fid.Fid.Volume; + Sfid.Vnode = avc->f.fid.Fid.Vnode; Sfid.CellAndUnique = - ((tcell->cellIndex << 24) + (avc->fid.Fid.Unique & 0xffffff)); + ((tcell->cellIndex << 24) + (avc->f.fid.Fid.Unique & 0xffffff)); afs_PutCell(tcell, READ_LOCK); - if (avc->fid.Fid.Vnode > 0xffff) + if (avc->f.fid.Fid.Vnode > 0xffff) afs_fid_vnodeoverflow++; - if (avc->fid.Fid.Unique > 0xffffff) + if (avc->f.fid.Fid.Unique > 0xffffff) afs_fid_uniqueoverflow++; } else { #if defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR == 64)) diff --git a/src/afs/VNOPS/afs_vnop_flock.c b/src/afs/VNOPS/afs_vnop_flock.c index 051b1e5..d4e855f 100644 --- a/src/afs/VNOPS/afs_vnop_flock.c +++ b/src/afs/VNOPS/afs_vnop_flock.c @@ -300,18 +300,18 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq, if (avc->flockCount == 0) { if (!AFS_IS_DISCONNECTED) { do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RELEASELOCK); RX_AFS_GUNLOCK(); code = RXAFS_ReleaseLock(tc->id, (struct AFSFid *) - &avc->fid.Fid, &tsync); + &avc->f.fid.Fid, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_RELEASELOCK, SHARED_LOCK, NULL)); } else { /*printf("Network is dooooooowwwwwwwnnnnnnn\n");*/ @@ -358,7 +358,7 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq, if (!code && avc->flockCount == 0) { if (!AFS_IS_DISCONNECTED) { do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME (AFS_STATS_FS_RPCIDX_RELEASELOCK); @@ -366,13 +366,13 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq, code = RXAFS_ReleaseLock(tc->id, (struct AFSFid *)&avc-> - fid.Fid, &tsync); + f.fid.Fid, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_RELEASELOCK, SHARED_LOCK, NULL)); } @@ -393,19 +393,19 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq, lockType = ((acom & LOCK_EX) ? LockWrite : LockRead); if (!AFS_IS_DISCONNECTED) { do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETLOCK); RX_AFS_GUNLOCK(); code = RXAFS_SetLock(tc->id, (struct AFSFid *) - &avc->fid.Fid, lockType, + &avc->f.fid.Fid, lockType, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_SETLOCK, SHARED_LOCK, NULL)); } else @@ -843,19 +843,19 @@ GetFlockCount(struct vcache *avc, struct vrequest *areq) return 0; do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHSTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_FetchStatus(tc->id, (struct AFSFid *)&avc->fid.Fid, + RXAFS_FetchStatus(tc->id, (struct AFSFid *)&avc->f.fid.Fid, &OutStatus, &CallBack, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, SHARED_LOCK, NULL)); if (temp) diff --git a/src/afs/VNOPS/afs_vnop_link.c b/src/afs/VNOPS/afs_vnop_link.c index 8da47fd..824e3bd 100644 --- a/src/afs/VNOPS/afs_vnop_link.c +++ b/src/afs/VNOPS/afs_vnop_link.c @@ -70,8 +70,8 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, if (code) goto done; - if (avc->fid.Cell != adp->fid.Cell - || avc->fid.Fid.Volume != adp->fid.Fid.Volume) { + if (avc->f.fid.Cell != adp->f.fid.Cell + || avc->f.fid.Fid.Volume != adp->f.fid.Fid.Volume) { code = EXDEV; goto done; } @@ -86,7 +86,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, /** If the volume is read-only, return error without making an RPC to the * fileserver */ - if (adp->states & CRO) { + if (adp->f.states & CRO) { code = EROFS; goto done; } @@ -99,13 +99,13 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */ ObtainWriteLock(&adp->lock, 145); do { - tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_LINK); RX_AFS_GUNLOCK(); code = - RXAFS_Link(tc->id, (struct AFSFid *)&adp->fid.Fid, aname, - (struct AFSFid *)&avc->fid.Fid, &OutFidStatus, + RXAFS_Link(tc->id, (struct AFSFid *)&adp->f.fid.Fid, aname, + (struct AFSFid *)&avc->f.fid.Fid, &OutFidStatus, &OutDirStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; @@ -113,7 +113,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, } else code = -1; } while (afs_Analyze - (tc, code, &adp->fid, &treq, AFS_STATS_FS_RPCIDX_LINK, + (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_LINK, SHARED_LOCK, NULL)); if (code) { @@ -122,7 +122,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, if (code < 0) { ObtainWriteLock(&afs_xcbhash, 492); afs_DequeueCallback(adp); - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); } @@ -134,7 +134,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) { /* we can do it locally */ ObtainWriteLock(&afs_xdcache, 290); - code = afs_dir_Create(tdc, aname, &avc->fid.Fid); + code = afs_dir_Create(tdc, aname, &avc->f.fid.Fid); ReleaseWriteLock(&afs_xdcache); if (code) { ZapDCE(tdc); /* surprise error -- invalid value */ @@ -157,9 +157,9 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, ObtainWriteLock(&afs_xcbhash, 493); afs_DequeueCallback(avc); - avc->states &= ~CStatd; /* don't really know new link count */ + avc->f.states &= ~CStatd; /* don't really know new link count */ ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); ReleaseWriteLock(&avc->lock); code = 0; diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index b7b30aa..4e03276 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -270,7 +270,7 @@ EvalMountPoint(register struct vcache *avc, struct vcache *advc, AFS_STATCNT(EvalMountPoint); #ifdef notdef - if (avc->mvid && (avc->states & CMValid)) + if (avc->mvid && (avc->f.states & CMValid)) return 0; /* done while racing */ #endif *avolpp = NULL; @@ -280,7 +280,7 @@ EvalMountPoint(register struct vcache *avc, struct vcache *advc, /* Determine which cell and volume the mointpoint goes to */ code = EvalMountData(avc->linkData[0], avc->linkData + 1, - avc->states, avc->fid.Cell, avolpp, areq, 0, 0, + avc->f.states, avc->f.fid.Cell, avolpp, areq, 0, 0, &avnoid); if (code) return code; @@ -294,7 +294,7 @@ EvalMountPoint(register struct vcache *avc, struct vcache *advc, avc->mvid->Fid.Volume = (*avolpp)->volume; avc->mvid->Fid.Vnode = avnoid; avc->mvid->Fid.Unique = 1; - avc->states |= CMValid; + avc->f.states |= CMValid; /* Used to: if the mount point is stored within a backup volume, * then we should only update the parent pointer information if @@ -303,7 +303,7 @@ EvalMountPoint(register struct vcache *avc, struct vcache *advc, * * Next two lines used to be under this if: * - * if (!(avc->states & CBackup) || tvp->dotdot.Fid.Volume == 0) + * if (!(avc->f.states & CBackup) || tvp->dotdot.Fid.Volume == 0) * * Now: update mount point back pointer on every call, so that we handle * multiple mount points better. This way, when du tries to go back @@ -311,9 +311,10 @@ EvalMountPoint(register struct vcache *avc, struct vcache *advc, * cd'ing via a new path to a volume will reset the ".." pointer * to the new path. */ - (*avolpp)->mtpoint = avc->fid; /* setup back pointer to mtpoint */ + (*avolpp)->mtpoint = avc->f.fid; /* setup back pointer to mtpoint */ + if (advc) - (*avolpp)->dotdot = advc->fid; + (*avolpp)->dotdot = advc->f.fid; return 0; } @@ -375,12 +376,12 @@ afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state, if (code) goto done; if (tvolp) { - tvolp->dotdot = tvc->fid; - tvolp->dotdot.Fid.Vnode = tvc->parentVnode; - tvolp->dotdot.Fid.Unique = tvc->parentUnique; + tvolp->dotdot = tvc->f.fid; + tvolp->dotdot.Fid.Vnode = tvc->f.parent.vnode; + tvolp->dotdot.Fid.Unique = tvc->f.parent.unique; } } - if (tvc->mvid && (tvc->states & CMValid)) { + if (tvc->mvid && (tvc->f.states & CMValid)) { if (!canblock) { afs_int32 retry; @@ -402,7 +403,7 @@ afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state, goto done; } #ifdef AFS_DARWIN80_ENV - root_vp->m.Type = VDIR; + root_vp->f.m.Type = VDIR; AFS_GUNLOCK(); code = afs_darwin_finalizevnode(root_vp, NULL, NULL, 0); AFS_GLOCK(); @@ -514,7 +515,7 @@ afs_getsysname(register struct vrequest *areq, register struct vcache *adp, if (!afs_nfsexporter) strcpy(bufp, (*sysnamelist)[0]); else { - au = afs_GetUser(areq->uid, adp->fid.Cell, 0); + au = afs_GetUser(areq->uid, adp->f.fid.Cell, 0); if (au->exporter) { error = EXP_SYSNAME(au->exporter, (char *)0, sysnamelist, num, 0); if (error) { @@ -590,7 +591,7 @@ Next_AtSys(register struct vcache *avc, struct vrequest *areq, *sysnamelist = afs_sysnamelist; if (afs_nfsexporter) { - au = afs_GetUser(areq->uid, avc->fid.Cell, 0); + au = afs_GetUser(areq->uid, avc->f.fid.Cell, 0); if (au->exporter) { error = EXP_SYSNAME(au->exporter, (char *)0, sysnamelist, &num, 0); @@ -728,9 +729,9 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * 1. The cache data is being fetched by another process. * 2. The cache data is no longer valid */ - while ((adp->states & CStatd) + while ((adp->f.states & CStatd) && (dcp->dflags & DFFetching) - && hsame(adp->m.DataVersion, dcp->f.versionNo)) { + && hsame(adp->f.m.DataVersion, dcp->f.versionNo)) { afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__, ICL_TYPE_POINTER, dcp, ICL_TYPE_INT32, dcp->dflags); @@ -740,8 +741,8 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) ObtainReadLock(&adp->lock); ObtainReadLock(&dcp->lock); } - if (!(adp->states & CStatd) - || !hsame(adp->m.DataVersion, dcp->f.versionNo)) { + if (!(adp->f.states & CStatd) + || !hsame(adp->f.m.DataVersion, dcp->f.versionNo)) { ReleaseReadLock(&dcp->lock); ReleaseReadLock(&adp->lock); afs_PutDCache(dcp); @@ -791,8 +792,8 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * also make us skip "." and probably "..", unless it has * disappeared from the cache since we did our namei call. */ - tfid.Cell = adp->fid.Cell; - tfid.Fid.Volume = adp->fid.Fid.Volume; + tfid.Cell = adp->f.fid.Cell; + tfid.Fid.Volume = adp->f.fid.Fid.Volume; tfid.Fid.Vnode = ntohl(dirEntryp->fid.vnode); tfid.Fid.Unique = ntohl(dirEntryp->fid.vunique); do { @@ -828,7 +829,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) } #ifdef AFS_DARWIN80_ENV - if (tvcp->states & CVInit) { + if (tvcp->f.states & CVInit) { /* XXX don't have status yet, so creating the vnode is not yet useful. we would get CDeadVnode set, and the upcoming PutVCache will cause the vcache to be flushed & @@ -842,12 +843,12 @@ 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->states & (CStatd | CBulkFetching)) + if (!(tvcp->f.states & (CStatd | CBulkFetching)) && (tvcp->execsOrWriters <= 0) && !afs_DirtyPages(tvcp) && !AFS_VN_MAPPED((vnode_t *) tvcp)) #else - if (!(tvcp->states & (CStatd | CBulkFetching)) + if (!(tvcp->f.states & (CStatd | CBulkFetching)) && (tvcp->execsOrWriters <= 0) && !afs_DirtyPages(tvcp)) #endif @@ -869,8 +870,8 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) */ memcpy((char *)(fidsp + fidIndex), (char *)&tfid.Fid, sizeof(*fidsp)); - tvcp->states |= CBulkFetching; - tvcp->m.Length = statSeqNo; + tvcp->f.states |= CBulkFetching; + tvcp->f.m.Length = statSeqNo; fidIndex++; } afs_PutVCache(tvcp); @@ -910,7 +911,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* start the timer; callback expirations are relative to this */ startTime = osi_Time(); - tcp = afs_Conn(&adp->fid, areqp, SHARED_LOCK); + tcp = afs_Conn(&adp->f.fid, areqp, SHARED_LOCK); if (tcp) { hostp = tcp->srvr->server; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_BULKSTATUS); @@ -939,7 +940,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) } else code = -1; } while (afs_Analyze - (tcp, code, &adp->fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, + (tcp, code, &adp->f.fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL)); /* now, if we didnt get the info, bail out. */ @@ -948,7 +949,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* we need vol flags to create the entries properly */ dotdot.Fid.Volume = 0; - volp = afs_GetVolume(&adp->fid, areqp, READ_LOCK); + volp = afs_GetVolume(&adp->f.fid, areqp, READ_LOCK); if (volp) { volStates = volp->states; if (volp->dotdot.Fid.Volume != 0) @@ -1010,8 +1011,8 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) for (i = 0; i < fidIndex; i++) { if ((&statsp[i])->errorCode) continue; - afid.Cell = adp->fid.Cell; - afid.Fid.Volume = adp->fid.Fid.Volume; + afid.Cell = adp->f.fid.Cell; + afid.Fid.Volume = adp->f.fid.Fid.Volume; afid.Fid.Vnode = fidsp[i].Vnode; afid.Fid.Unique = fidsp[i].Unique; do { @@ -1035,7 +1036,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * and we may not have the latest status information for this * file. Leave the entry alone. */ - if (!(tvcp->states & CBulkFetching) || (tvcp->m.Length != statSeqNo)) { + if (!(tvcp->f.states & CBulkFetching) || (tvcp->f.m.Length != statSeqNo)) { flagIndex++; ReleaseWriteLock(&tvcp->lock); afs_PutVCache(tvcp); @@ -1086,7 +1087,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* We need to check the flags again. We may have missed * something while we were waiting for a lock. */ - if (!(tvcp->states & CBulkFetching) || (tvcp->m.Length != statSeqNo)) { + if (!(tvcp->f.states & CBulkFetching) || (tvcp->f.m.Length != statSeqNo)) { flagIndex++; ReleaseWriteLock(&tvcp->lock); ReleaseWriteLock(&afs_xcbhash); @@ -1106,21 +1107,21 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * loaded, so we can tell if we use it before it gets * recycled. */ - tvcp->states |= CBulkStat; - tvcp->states &= ~CBulkFetching; + tvcp->f.states |= CBulkStat; + tvcp->f.states &= ~CBulkFetching; flagIndex++; afs_bulkStatsDone++; /* merge in vol info */ if (volStates & VRO) - tvcp->states |= CRO; + tvcp->f.states |= CRO; if (volStates & VBackup) - tvcp->states |= CBackup; + tvcp->f.states |= CBackup; if (volStates & VForeign) - tvcp->states |= CForeign; + tvcp->f.states |= CForeign; /* merge in the callback info */ - tvcp->states |= CTruth; + tvcp->f.states |= CTruth; /* get ptr to the callback we are interested in */ tcbp = cbsp + i; @@ -1128,19 +1129,19 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) if (tcbp->ExpirationTime != 0) { tvcp->cbExpires = tcbp->ExpirationTime + startTime; tvcp->callback = hostp; - tvcp->states |= CStatd; + tvcp->f.states |= CStatd; afs_QueueCallback(tvcp, CBHash(tcbp->ExpirationTime), volp); - } else if (tvcp->states & CRO) { + } else if (tvcp->f.states & CRO) { /* ordinary callback on a read-only volume -- AFS 3.2 style */ tvcp->cbExpires = 3600 + startTime; tvcp->callback = hostp; - tvcp->states |= CStatd; + tvcp->f.states |= CStatd; afs_QueueCallback(tvcp, CBHash(3600), volp); } else { tvcp->callback = 0; - tvcp->states &= ~(CStatd | CUnique); + tvcp->f.states &= ~(CStatd | CUnique); afs_DequeueCallback(tvcp); - if ((tvcp->states & CForeign) || (vType(tvcp) == VDIR)) + if ((tvcp->f.states & CForeign) || (vType(tvcp) == VDIR)) osi_dnlc_purgedp(tvcp); /* if it (could be) a directory */ } ReleaseWriteLock(&afs_xcbhash); @@ -1156,8 +1157,8 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) done: /* Be sure to turn off the CBulkFetching flags */ for (i = flagIndex; i < fidIndex; i++) { - afid.Cell = adp->fid.Cell; - afid.Fid.Volume = adp->fid.Fid.Volume; + afid.Cell = adp->f.fid.Cell; + afid.Fid.Volume = adp->f.fid.Fid.Volume; afid.Fid.Vnode = fidsp[i].Vnode; afid.Fid.Unique = fidsp[i].Unique; do { @@ -1166,9 +1167,9 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */ ); ReleaseReadLock(&afs_xvcache); } while (tvcp && retry); - if (tvcp != NULL && (tvcp->states & CBulkFetching) - && (tvcp->m.Length == statSeqNo)) { - tvcp->states &= ~CBulkFetching; + if (tvcp != NULL && (tvcp->f.states & CBulkFetching) + && (tvcp->f.m.Length == statSeqNo)) { + tvcp->f.states &= ~CBulkFetching; } if (tvcp != NULL) { afs_PutVCache(tvcp); @@ -1180,7 +1181,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* If we did the InlineBulk RPC pull out the return code */ if (inlinebulk) { if ((&statsp[0])->errorCode) { - afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->fid, areqp, + afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->f.fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL); code = (&statsp[0])->errorCode; } @@ -1278,7 +1279,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED *avcp = NULL; /* Since some callers don't initialize it */ bulkcode = 0; - if (!(adp->states & CStatd) && !afs_InReadDir(adp)) { + if (!(adp->f.states & CStatd) && !afs_InReadDir(adp)) { if ((code = afs_VerifyVCache2(adp, &treq))) { goto done; } @@ -1485,17 +1486,17 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED * use that. This eliminates several possible deadlocks. */ if (!afs_InReadDir(adp)) { - while ((adp->states & CStatd) + while ((adp->f.states & CStatd) && (tdc->dflags & DFFetching) - && hsame(adp->m.DataVersion, tdc->f.versionNo)) { + && hsame(adp->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&adp->lock); afs_osi_Sleep(&tdc->validPos); ObtainReadLock(&adp->lock); ObtainReadLock(&tdc->lock); } - if (!(adp->states & CStatd) - || !hsame(adp->m.DataVersion, tdc->f.versionNo)) { + if (!(adp->f.states & CStatd) + || !hsame(adp->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&adp->lock); afs_PutDCache(tdc); @@ -1551,8 +1552,8 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED } /* new fid has same cell and volume */ - tfid.Cell = adp->fid.Cell; - tfid.Fid.Volume = adp->fid.Fid.Volume; + tfid.Cell = adp->f.fid.Cell; + tfid.Fid.Volume = adp->f.fid.Fid.Volume; afs_Trace4(afs_iclSetp, CM_TRACE_LOOKUP, ICL_TYPE_POINTER, adp, ICL_TYPE_STRING, tname, ICL_TYPE_FID, &tfid, ICL_TYPE_INT32, code); @@ -1568,7 +1569,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED * dirCookie tells us where to start prefetching from. */ if (!AFS_IS_DISCONNECTED && - AFSDOBULK && adp->opens > 0 && !(adp->states & CForeign) + AFSDOBULK && adp->opens > 0 && !(adp->f.states & CForeign) && !afs_IsDynroot(adp) && !afs_InReadDir(adp)) { afs_int32 retry; /* if the entry is not in the cache, or is in the cache, @@ -1581,13 +1582,13 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED ReleaseReadLock(&afs_xvcache); } while (tvc && retry); - if (!tvc || !(tvc->states & CStatd)) + if (!tvc || !(tvc->f.states & CStatd)) bulkcode = afs_DoBulkStat(adp, dirCookie, &treq); else bulkcode = 0; /* if the vcache isn't usable, release it */ - if (tvc && !(tvc->states & CStatd)) { + if (tvc && !(tvc->f.states & CStatd)) { #ifndef AFS_FBSD80_ENV afs_PutVCache(tvc); #endif @@ -1607,7 +1608,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED */ if (!tvc) { afs_int32 cached = 0; - if (!tfid.Fid.Unique && (adp->states & CForeign)) { + if (!tfid.Fid.Unique && (adp->f.states & CForeign)) { tvc = afs_LookupVCache(&tfid, &treq, &cached, adp, tname); } if (!tvc && !bulkcode) { /* lookup failed or wasn't called */ @@ -1617,11 +1618,11 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED } /* sub-block just to reduce stack usage */ if (tvc) { - if (adp->states & CForeign) - tvc->states |= CForeign; - tvc->parentVnode = adp->fid.Fid.Vnode; - tvc->parentUnique = adp->fid.Fid.Unique; - tvc->states &= ~CBulkStat; + if (adp->f.states & CForeign) + tvc->f.states |= CForeign; + tvc->f.parent.vnode = adp->f.fid.Fid.Vnode; + tvc->f.parent.unique = adp->f.fid.Fid.Unique; + tvc->f.states &= ~CBulkStat; if (afs_fakestat_enable == 2 && tvc->mvstat == 1) { ObtainSharedLock(&tvc->lock, 680); @@ -1637,7 +1638,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED force_eval = 1; ReleaseReadLock(&tvc->lock); } - if (tvc->mvstat == 1 && (tvc->states & CMValid) && tvc->mvid != NULL) + if (tvc->mvstat == 1 && (tvc->f.states & CMValid) && tvc->mvid != NULL) force_eval = 1; /* This is now almost for free, get it correct */ #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) @@ -1662,12 +1663,12 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED } /* next, we want to continue using the target of the mt point */ - if (tvc->mvid && (tvc->states & CMValid)) { + if (tvc->mvid && (tvc->f.states & CMValid)) { struct vcache *uvc; /* now lookup target, to set .. pointer */ afs_Trace2(afs_iclSetp, CM_TRACE_LOOKUP1, ICL_TYPE_POINTER, tvc, ICL_TYPE_FID, - &tvc->fid); + &tvc->f.fid); uvc = tvc; /* remember for later */ if (tvolp && (tvolp->states & VForeign)) { @@ -1726,14 +1727,14 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED if (!AFS_IS_DISCONNECTED) { if (pass == 0) { struct volume *tv; - tv = afs_GetVolume(&adp->fid, &treq, READ_LOCK); + tv = afs_GetVolume(&adp->f.fid, &treq, READ_LOCK); if (tv) { if (tv->states & VRO) { pass = 1; /* try this *once* */ ObtainWriteLock(&afs_xcbhash, 495); afs_DequeueCallback(adp); /* re-stat to get later version */ - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); afs_PutVolume(tv, READ_LOCK); @@ -1757,7 +1758,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED #ifdef AFS_OSF_ENV /* Handle RENAME; only need to check rename "." */ if (opflag == RENAME && wantparent && *ndp->ni_next == 0) { - if (!FidCmp(&(tvc->fid), &(adp->fid))) { + if (!FidCmp(&(tvc->f.fid), &(adp->f.fid))) { afs_PutVCache(*avcp); *avcp = NULL; afs_PutFakeStat(&fakestate); diff --git a/src/afs/VNOPS/afs_vnop_open.c b/src/afs/VNOPS/afs_vnop_open.c index 82c2c64..b1f4266 100644 --- a/src/afs/VNOPS/afs_vnop_open.c +++ b/src/afs/VNOPS/afs_vnop_open.c @@ -93,7 +93,7 @@ afs_open(struct vcache **avcp, afs_int32 aflags, struct AFS_UCRED *acred) goto done; } else { if (!afs_AccessOK - (tvc, ((tvc->states & CForeign) ? PRSFS_READ : PRSFS_LOOKUP), + (tvc, ((tvc->f.states & CForeign) ? PRSFS_READ : PRSFS_LOOKUP), &treq, CHECK_MODE_BITS)) { code = EACCES; printf("afs_Open: no access for dir\n"); @@ -153,8 +153,8 @@ afs_open(struct vcache **avcp, afs_int32 aflags, struct AFS_UCRED *acred) if (aflags & FTRUNC) { /* this fixes touch */ ObtainWriteLock(&tvc->lock, 123); - tvc->m.Date = osi_Time(); - tvc->states |= CDirty; + tvc->f.m.Date = osi_Time(); + tvc->f.states |= CDirty; ReleaseWriteLock(&tvc->lock); } ObtainReadLock(&tvc->lock); diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index f7c2929..285acfa 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -102,14 +102,14 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, afs_Trace4(afs_iclSetp, CM_TRACE_READ, ICL_TYPE_POINTER, avc, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_INT32, totalLength, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); error = 0; transferLength = 0; if (!noLock) ObtainReadLock(&avc->lock); #if defined(AFS_TEXT_ENV) && !defined(AFS_VM_RDWR_ENV) if (avc->flushDV.high == AFS_MAXDV && avc->flushDV.low == AFS_MAXDV) { - hset(avc->flushDV, avc->m.DataVersion); + hset(avc->flushDV, avc->f.m.DataVersion); } #endif @@ -117,7 +117,7 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, * Locks held: * avc->lock(R) */ - if (filePos >= avc->m.Length) { + if (filePos >= avc->f.m.Length) { if (len > AFS_ZEROS) len = sizeof(afs_zeros); /* and in 0 buffer */ len = 0; @@ -132,9 +132,9 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, tuiop, code); } - while (avc->m.Length > 0 && totalLength > 0) { + while (avc->f.m.Length > 0 && totalLength > 0) { /* read all of the cached info */ - if (filePos >= avc->m.Length) + if (filePos >= avc->f.m.Length) break; /* all done */ if (noLock) { if (tdc) { @@ -189,7 +189,7 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, * 2 requests never return a null dcache entry, btw. */ if (!(tdc->dflags & DFFetching) - && !hsame(avc->m.DataVersion, tdc->f.versionNo)) { + && !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { /* have cache entry, it is not coming in now, * and we'll need new data */ tagain: @@ -268,14 +268,14 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, } else { /* no longer fetching, verify data version * (avoid new GetDCache call) */ - if (hsame(avc->m.DataVersion, tdc->f.versionNo) + if (hsame(avc->f.m.DataVersion, tdc->f.versionNo) && ((len = tdc->validPos - filePos) > 0)) { offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); } else { /* don't have current data, so get it below */ afs_Trace3(afs_iclSetp, CM_TRACE_VERSIONNO, ICL_TYPE_INT64, ICL_HANDLE_OFFSET(filePos), - ICL_TYPE_HYPER, &avc->m.DataVersion, + ICL_TYPE_HYPER, &avc->f.m.DataVersion, ICL_TYPE_HYPER, &tdc->f.versionNo); ReleaseReadLock(&tdc->lock); afs_PutDCache(tdc); @@ -318,7 +318,7 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, len = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset; /* bytes left in chunk addr space */ if (len > totalLength) len = totalLength; /* and still within xfr request */ - tlen = avc->m.Length - offset; /* and still within file */ + tlen = avc->f.m.Length - offset; /* and still within file */ if (len > tlen) len = tlen; if (len > AFS_ZEROS) @@ -433,7 +433,7 @@ afs_PrefetchChunk(struct vcache *avc, struct dcache *adc, offset = AFS_CHUNKTOBASE(offset); /* base of next chunk */ ObtainReadLock(&adc->lock); ObtainSharedLock(&adc->mflock, 662); - if (offset < avc->m.Length && !(adc->mflags & DFNextStarted) + if (offset < avc->f.m.Length && !(adc->mflags & DFNextStarted) && !afs_BBusy()) { struct brequest *bp; @@ -557,18 +557,18 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, afs_Trace4(afs_iclSetp, CM_TRACE_READ, ICL_TYPE_POINTER, avc, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_INT32, totalLength, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); error = 0; transferLength = 0; if (!noLock) ObtainReadLock(&avc->lock); #if defined(AFS_TEXT_ENV) && !defined(AFS_VM_RDWR_ENV) if (avc->flushDV.high == AFS_MAXDV && avc->flushDV.low == AFS_MAXDV) { - hset(avc->flushDV, avc->m.DataVersion); + hset(avc->flushDV, avc->f.m.DataVersion); } #endif - if (filePos >= avc->m.Length) { + if (filePos >= avc->f.m.Length) { if (len > AFS_ZEROS) len = sizeof(afs_zeros); /* and in 0 buffer */ len = 0; @@ -583,9 +583,9 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, tuiop, code); } - while (avc->m.Length > 0 && totalLength > 0) { + while (avc->f.m.Length > 0 && totalLength > 0) { /* read all of the cached info */ - if (filePos >= avc->m.Length) + if (filePos >= avc->f.m.Length) break; /* all done */ if (noLock) { if (tdc) { @@ -647,7 +647,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, * data already coming, we don't need to do this, obviously. Type * 2 requests never return a null dcache entry, btw. */ if (!(tdc->dflags & DFFetching) - && !hsame(avc->m.DataVersion, tdc->f.versionNo)) { + && !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { /* have cache entry, it is not coming in now, and we'll need new data */ tagain: if (trybusy && !afs_BBusy()) { @@ -724,14 +724,14 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, } else { /* no longer fetching, verify data version (avoid new * GetDCache call) */ - if (hsame(avc->m.DataVersion, tdc->f.versionNo) + if (hsame(avc->f.m.DataVersion, tdc->f.versionNo) && ((len = tdc->validPos - filePos) > 0)) { offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); } else { /* don't have current data, so get it below */ afs_Trace3(afs_iclSetp, CM_TRACE_VERSIONNO, ICL_TYPE_INT64, ICL_HANDLE_OFFSET(filePos), - ICL_TYPE_HYPER, &avc->m.DataVersion, + ICL_TYPE_HYPER, &avc->f.m.DataVersion, ICL_TYPE_HYPER, &tdc->f.versionNo); ReleaseReadLock(&tdc->lock); afs_PutDCache(tdc); @@ -772,7 +772,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, len = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset; /* bytes left in chunk addr space */ if (len > totalLength) len = totalLength; /* and still within xfr request */ - tlen = avc->m.Length - offset; /* and still within file */ + tlen = avc->f.m.Length - offset; /* and still within file */ if (len > tlen) len = tlen; if (len > AFS_ZEROS) diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 0b4299f..8d3c65f 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -234,11 +234,11 @@ afs_readdir_type(struct vcache *avc, struct DirEntry *ade) struct VenusFid tfid; struct vcache *tvc; int vtype; - tfid.Cell = avc->fid.Cell; - tfid.Fid.Volume = avc->fid.Fid.Volume; + tfid.Cell = avc->f.fid.Cell; + tfid.Fid.Volume = avc->f.fid.Fid.Volume; tfid.Fid.Vnode = ntohl(ade->fid.vnode); tfid.Fid.Unique = ntohl(ade->fid.vunique); - if ((avc->states & CForeign) == 0 && (ntohl(ade->fid.vnode) & 1)) { + if ((avc->f.states & CForeign) == 0 && (ntohl(ade->fid.vnode) & 1)) { return DT_DIR; } ObtainReadLock(&afs_xvcache); @@ -247,7 +247,7 @@ afs_readdir_type(struct vcache *avc, struct DirEntry *ade) if (tvc->mvstat) { afs_PutVCache(tvc); return DT_DIR; - } else if (((tvc->states) & (CStatd | CTruth))) { + } else if (((tvc->f.states) & (CStatd | CTruth))) { /* CTruth will be set if the object has *ever* been statd */ vtype = vType(tvc); @@ -289,7 +289,7 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, { int code = 0; struct volume *tvp; - afs_uint32 Volume = vc->fid.Fid.Volume; + afs_uint32 Volume = vc->f.fid.Fid.Volume; afs_uint32 Vnode = de->fid.vnode; #if defined(AFS_SUN56_ENV) struct dirent64 *direntp; @@ -310,11 +310,11 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, /* This is the '.' entry; if we are a volume root, we need to * ignore the directory and use the inum for the mount point. */ - if (!FidCmp(&afs_rootFid, &vc->fid)) { + if (!FidCmp(&afs_rootFid, &vc->f.fid)) { Volume = 0; Vnode = 2; } else if (vc->mvstat == 2) { - tvp = afs_GetVolume(&vc->fid, 0, READ_LOCK); + tvp = afs_GetVolume(&vc->f.fid, 0, READ_LOCK); if (tvp) { Volume = tvp->mtpoint.Fid.Volume; Vnode = tvp->mtpoint.Fid.Vnode; @@ -327,7 +327,7 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, * because we might be a volume root (so our parent is in a * different volume), or our parent might be a volume root * (so we actually want the mount point) or BOTH! */ - if (!FidCmp(&afs_rootFid, &vc->fid)) { + if (!FidCmp(&afs_rootFid, &vc->f.fid)) { /* We are the root of the AFS root, and thus our own parent */ Volume = 0; Vnode = 2; @@ -358,7 +358,7 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, } else if (de->fid.vnode == 1 && de->fid.vunique == 1) { /* XXX The above test is evil and probably breaks DFS */ /* Parent directory is a volume root; use the right inum */ - tvp = afs_GetVolume(&vc->fid, 0, READ_LOCK); + tvp = afs_GetVolume(&vc->f.fid, 0, READ_LOCK); if (tvp) { if (tvp->cell == afs_rootFid.Cell && tvp->volume == afs_rootFid.Fid.Volume) { @@ -659,9 +659,9 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred) * 1. The cache data is being fetched by another process. * 2. The cache data is no longer valid */ - while ((avc->states & CStatd) + while ((avc->f.states & CStatd) && (tdc->dflags & DFFetching) - && hsame(avc->m.DataVersion, tdc->f.versionNo)) { + && hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__, ICL_TYPE_POINTER, tdc, ICL_TYPE_INT32, tdc->dflags); @@ -671,8 +671,8 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred) ObtainReadLock(&avc->lock); ObtainReadLock(&tdc->lock); } - if (!(avc->states & CStatd) - || !hsame(avc->m.DataVersion, tdc->f.versionNo)) { + if (!(avc->f.states & CStatd) + || !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&avc->lock); afs_PutDCache(tdc); @@ -719,7 +719,7 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred) /* something to hand over. */ #ifdef AFS_HPUX_ENV sdirEntry->d_fileno = - (avc->fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); + (avc->f.fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); FIXUPSTUPIDINODE(sdirEntry->d_fileno); sdirEntry->d_reclen = rlen = AFS_UIO_RESID(auio); sdirEntry->d_namlen = o_slen; @@ -788,7 +788,7 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred) if (len) { #ifdef AFS_HPUX_ENV sdirEntry->d_fileno = - (avc->fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); + (avc->f.fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); FIXUPSTUPIDINODE(sdirEntry->d_fileno); sdirEntry->d_reclen = rlen = AFS_UIO_RESID(auio); sdirEntry->d_namlen = o_slen; @@ -843,7 +843,7 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, struct AFS_UCRED *acred) if (len) { #ifdef AFS_HPUX_ENV sdirEntry->d_fileno = - (avc->fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); + (avc->f.fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); FIXUPSTUPIDINODE(sdirEntry->d_fileno); sdirEntry->d_reclen = rlen = len; sdirEntry->d_namlen = o_slen; @@ -975,9 +975,9 @@ afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred) * 1. The cache data is being fetched by another process. * 2. The cache data is no longer valid */ - while ((avc->states & CStatd) + while ((avc->f.states & CStatd) && (tdc->dflags & DFFetching) - && hsame(avc->m.DataVersion, tdc->f.versionNo)) { + && hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__, ICL_TYPE_POINTER, tdc, ICL_TYPE_INT32, tdc->dflags); @@ -987,8 +987,8 @@ afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred) ObtainReadLock(&avc->lock); ObtainReadLock(&tdc->lock); } - if (!(avc->states & CStatd) - || !hsame(avc->m.DataVersion, tdc->f.versionNo)) { + if (!(avc->f.states & CStatd) + || !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { ReleaseReadLock(&tdc->lock); ReleaseReadLock(&avc->lock); afs_PutDCache(tdc); @@ -1011,7 +1011,7 @@ afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred) /* something to hand over. */ #if defined(AFS_HPUX_ENV) || defined(AFS_OSF_ENV) sdirEntry->d_fileno = - (avc->fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); + (avc->f.fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); FIXUPSTUPIDINODE(sdirEntry->d_fileno); sdirEntry->d_reclen = rlen = AFS_UIO_RESID(auio); sdirEntry->d_namlen = o_slen; @@ -1068,7 +1068,7 @@ afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred) if (len) { #if defined(AFS_HPUX_ENV) || defined(AFS_OSF_ENV) sdirEntry->d_fileno = - (avc->fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); + (avc->f.fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); FIXUPSTUPIDINODE(sdirEntry->d_fileno); sdirEntry->d_reclen = rlen = AFS_UIO_RESID(auio); sdirEntry->d_namlen = o_slen; @@ -1120,7 +1120,7 @@ afs1_readdir(struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred) if (len) { #if defined(AFS_HPUX_ENV) || defined(AFS_OSF_ENV) sdirEntry->d_fileno = - (avc->fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); + (avc->f.fid.Fid.Volume << 16) + ntohl(ode->fid.vnode); FIXUPSTUPIDINODE(sdirEntry->d_fileno); sdirEntry->d_reclen = rlen = len; sdirEntry->d_namlen = o_slen; diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index b1c89cd..fb86ece 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -54,15 +54,15 @@ FetchWholeEnchilada(register struct vcache *avc, struct vrequest *areq) afs_size_t pos, offset, len; AFS_STATCNT(FetchWholeEnchilada); - if ((avc->states & CStatd) == 0) + if ((avc->f.states & CStatd) == 0) return; /* don't know size */ for (nextChunk = 0; nextChunk < 1024; nextChunk++) { /* sanity check on N chunks */ pos = AFS_CHUNKTOBASE(nextChunk); #if defined(AFS_OSF_ENV) - if (pos >= avc->m.Length) + if (pos >= avc->f.m.Length) break; /* all done */ #else /* AFS_OSF_ENV */ - if (pos >= avc->m.Length) + if (pos >= avc->f.m.Length) return; /* all done */ #endif tdc = afs_GetDCache(avc, pos, areq, &offset, &len, 0); @@ -75,7 +75,7 @@ FetchWholeEnchilada(register struct vcache *avc, struct vrequest *areq) afs_PutDCache(tdc); } #if defined(AFS_OSF_ENV) - avc->states |= CWired; + avc->f.states |= CWired; #endif /* AFS_OSF_ENV */ } @@ -86,11 +86,11 @@ FetchWholeEnchilada(register struct vcache *avc, struct vrequest *areq) */ afs_IsWired(register struct vcache *avc) { - if (avc->states & CWired) { + if (avc->f.states & CWired) { if (osi_Active(avc)) { return 1; } - avc->states &= ~CWired; + avc->f.states &= ~CWired; } return 0; } @@ -108,19 +108,19 @@ afsremove(register struct vcache *adp, register struct dcache *tdc, XSTATS_DECLS; if (!AFS_IS_DISCONNECTED) { do { - tc = afs_Conn(&adp->fid, treqp, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, treqp, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEFILE); RX_AFS_GUNLOCK(); code = - RXAFS_RemoveFile(tc->id, (struct AFSFid *)&adp->fid.Fid, + RXAFS_RemoveFile(tc->id, (struct AFSFid *)&adp->f.fid.Fid, aname, &OutDirStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &adp->fid, treqp, AFS_STATS_FS_RPCIDX_REMOVEFILE, + (tc, code, &adp->f.fid, treqp, AFS_STATS_FS_RPCIDX_REMOVEFILE, SHARED_LOCK, NULL)); } @@ -138,7 +138,7 @@ afsremove(register struct vcache *adp, register struct dcache *tdc, if (code < 0) { ObtainWriteLock(&afs_xcbhash, 497); afs_DequeueCallback(adp); - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); } @@ -174,9 +174,9 @@ afsremove(register struct vcache *adp, register struct dcache *tdc, ObtainWriteLock(&tvc->lock, 141); /* note that callback will be broken on the deleted file if there are * still >0 links left to it, so we'll get the stat right */ - tvc->m.LinkCount--; - tvc->states &= ~CUnique; /* For the dfs xlator */ - if (tvc->m.LinkCount == 0 && !osi_Active(tvc)) { + tvc->f.m.LinkCount--; + tvc->f.states &= ~CUnique; /* For the dfs xlator */ + if (tvc->f.m.LinkCount == 0 && !osi_Active(tvc)) { if (!AFS_NFSXLATORREQ(acred)) afs_TryToSmush(tvc, acred, 0); } @@ -292,7 +292,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) /** If the volume is read-only, return error without making an RPC to the * fileserver */ - if (adp->states & CRO) { + if (adp->f.states & CRO) { #ifdef AFS_OSF_ENV afs_PutVCache(tvc); #endif @@ -320,8 +320,8 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) * Make sure that the data in the cache is current. We may have * received a callback while we were waiting for the write lock. */ - if (!(adp->states & CStatd) - || (tdc && !hsame(adp->m.DataVersion, tdc->f.versionNo))) { + if (!(adp->f.states & CStatd) + || (tdc && !hsame(adp->f.m.DataVersion, tdc->f.versionNo))) { ReleaseWriteLock(&adp->lock); if (tdc) { ReleaseSharedLock(&tdc->lock); @@ -343,8 +343,8 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) if (code == 0) { afs_int32 cached = 0; - unlinkFid.Cell = adp->fid.Cell; - unlinkFid.Fid.Volume = adp->fid.Fid.Volume; + unlinkFid.Cell = adp->f.fid.Cell; + unlinkFid.Fid.Volume = adp->f.fid.Fid.Volume; if (unlinkFid.Fid.Unique == 0) { tvc = afs_LookupVCache(&unlinkFid, &treq, &cached, adp, @@ -359,7 +359,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) #if defined(AFS_DISCON_ENV) if (AFS_IS_DISCON_RW) { - if (!adp->shVnode && !(adp->ddirty_flags & VDisconCreate)) { + if (!adp->f.shadow.vnode && !(adp->f.ddirty_flags & VDisconCreate)) { /* Make shadow copy of parent dir. */ afs_MakeShadowDir(adp, tdc); } @@ -374,13 +374,13 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) /* If we were locally created, then we don't need to do very * much beyond ensuring that we don't exist anymore */ - if (tvc->ddirty_flags & VDisconCreate) { + if (tvc->f.ddirty_flags & VDisconCreate) { afs_DisconRemoveDirty(tvc); } else { /* Add removed file vcache to dirty list. */ afs_DisconAddDirty(tvc, VDisconRemove, 1); } - adp->m.LinkCount--; + adp->f.m.LinkCount--; ReleaseWriteLock(&tvc->lock); if (tdc) ObtainSharedLock(&tdc->lock, 714); @@ -421,10 +421,10 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) #endif #ifdef AFS_AIX_ENV if (tvc && VREFCOUNT_GT(tvc, 2) && tvc->opens > 0 - && !(tvc->states & CUnlinked)) { + && !(tvc->f.states & CUnlinked)) { #else if (tvc && VREFCOUNT_GT(tvc, 1) && tvc->opens > 0 - && !(tvc->states & CUnlinked)) { + && !(tvc->f.states & CUnlinked)) { #endif char *unlname = afs_newname(); @@ -445,7 +445,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) crfree(tvc->uncred); } tvc->uncred = acred; - tvc->states |= CUnlinked; + tvc->f.states |= CUnlinked; } else { osi_FreeSmallSpace(unlname); } @@ -490,7 +490,7 @@ afs_remunlink(register struct vcache *avc, register int doit) } #endif - if (avc->mvid && (doit || (avc->states & CUnlinkedDel))) { + if (avc->mvid && (doit || (avc->f.states & CUnlinkedDel))) { if ((code = afs_InitReq(&treq, avc->uncred))) { ReleaseWriteLock(&avc->lock); } else { @@ -511,14 +511,14 @@ afs_remunlink(register struct vcache *avc, register int doit) /* We'll only try this once. If it fails, just release the vnode. * Clear after doing hold so that NewVCache doesn't find us yet. */ - avc->states &= ~(CUnlinked | CUnlinkedDel); + avc->f.states &= ~(CUnlinked | CUnlinkedDel); ReleaseWriteLock(&avc->lock); - dirFid.Cell = avc->fid.Cell; - dirFid.Fid.Volume = avc->fid.Fid.Volume; - dirFid.Fid.Vnode = avc->parentVnode; - dirFid.Fid.Unique = avc->parentUnique; + dirFid.Cell = avc->f.fid.Cell; + dirFid.Fid.Volume = avc->f.fid.Fid.Volume; + dirFid.Fid.Vnode = avc->f.parent.vnode; + dirFid.Fid.Unique = avc->f.parent.unique; adp = afs_GetVCache(&dirFid, &treq, NULL, NULL); if (adp) { diff --git a/src/afs/VNOPS/afs_vnop_rename.c b/src/afs/VNOPS/afs_vnop_rename.c index f36050f..1bd063f 100644 --- a/src/afs/VNOPS/afs_vnop_rename.c +++ b/src/afs/VNOPS/afs_vnop_rename.c @@ -67,14 +67,14 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, goto done; /* lock in appropriate order, after some checks */ - if (aodp->fid.Cell != andp->fid.Cell - || aodp->fid.Fid.Volume != andp->fid.Fid.Volume) { + if (aodp->f.fid.Cell != andp->f.fid.Cell + || aodp->f.fid.Fid.Volume != andp->f.fid.Fid.Volume) { code = EXDEV; goto done; } oneDir = 0; code = 0; - if (andp->fid.Fid.Vnode == aodp->fid.Fid.Vnode) { + if (andp->f.fid.Fid.Vnode == aodp->f.fid.Fid.Vnode) { if (!strcmp(aname1, aname2)) { /* Same directory and same name; this is a noop and just return success * to save cycles and follow posix standards */ @@ -97,10 +97,10 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, } tdc2 = tdc1; oneDir = 1; /* only one dude locked */ - } else if ((andp->states & CRO) || (aodp->states & CRO)) { + } else if ((andp->f.states & CRO) || (aodp->f.states & CRO)) { code = EROFS; goto done; - } else if (andp->fid.Fid.Vnode < aodp->fid.Fid.Vnode) { + } else if (andp->f.fid.Fid.Vnode < aodp->f.fid.Fid.Vnode) { ObtainWriteLock(&andp->lock, 148); /* lock smaller one first */ ObtainWriteLock(&aodp->lock, 149); tdc2 = afs_FindDCache(andp, (afs_size_t) 0); @@ -132,8 +132,8 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, * received a callback while we were waiting for the write lock. */ if (tdc1) { - if (!(aodp->states & CStatd) - || !hsame(aodp->m.DataVersion, tdc1->f.versionNo)) { + if (!(aodp->f.states & CStatd) + || !hsame(aodp->f.m.DataVersion, tdc1->f.versionNo)) { ReleaseWriteLock(&aodp->lock); if (!oneDir) { @@ -170,15 +170,15 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, if (!AFS_IS_DISCON_RW) { /* Connected. */ do { - tc = afs_Conn(&aodp->fid, areq, SHARED_LOCK); + tc = afs_Conn(&aodp->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RENAME); RX_AFS_GUNLOCK(); code = RXAFS_Rename(tc->id, - (struct AFSFid *)&aodp->fid.Fid, + (struct AFSFid *)&aodp->f.fid.Fid, aname1, - (struct AFSFid *)&andp->fid.Fid, + (struct AFSFid *)&andp->f.fid.Fid, aname2, &OutOldDirStatus, &OutNewDirStatus, @@ -189,7 +189,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, code = -1; } while (afs_Analyze - (tc, code, &andp->fid, areq, AFS_STATS_FS_RPCIDX_RENAME, + (tc, code, &andp->f.fid, areq, AFS_STATS_FS_RPCIDX_RENAME, SHARED_LOCK, NULL)); } else { @@ -197,8 +197,8 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, /* Disconnected. */ /* Seek moved file vcache. */ - fileFid.Cell = aodp->fid.Cell; - fileFid.Fid.Volume = aodp->fid.Fid.Volume; + fileFid.Cell = aodp->f.fid.Cell; + fileFid.Fid.Volume = aodp->f.fid.Fid.Volume; ObtainSharedLock(&afs_xvcache, 754); tvc = afs_FindVCache(&fileFid, 0 , 1); ReleaseSharedLock(&afs_xvcache); @@ -206,28 +206,28 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, if (tvc) { /* XXX - We're locking this vcache whilst holding dcaches. Ooops */ ObtainWriteLock(&tvc->lock, 750); - if (!(tvc->ddirty_flags & (VDisconRename|VDisconCreate))) { + if (!(tvc->f.ddirty_flags & (VDisconRename|VDisconCreate))) { /* If the vnode was created locally, then we don't care * about recording the rename - we'll do it automatically * on replay. If we've already renamed, we've already stored * the required information about where we came from. */ - if (!aodp->shVnode) { + if (!aodp->f.shadow.vnode) { /* Make shadow copy of parent dir only. */ afs_MakeShadowDir(aodp, tdc1); } + /* Save old parent dir fid so it will be searchable + * in the shadow dir. + */ + tvc->f.oldParent.vnode = aodp->f.fid.Fid.Vnode; + tvc->f.oldParent.unique = aodp->f.fid.Fid.Unique; + afs_DisconAddDirty(tvc, VDisconRename | (oneDir ? VDisconRenameSameDir:0), 1); - - /* Save old parent dir fid so it will be searchable - * in the shadow dir. - */ - tvc->oldVnode = aodp->fid.Fid.Vnode; - tvc->oldUnique = aodp->fid.Fid.Unique; } ReleaseWriteLock(&tvc->lock); @@ -305,14 +305,14 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, /* update dir link counts */ if (AFS_IS_DISCON_RW) { if (!oneDir) { - aodp->m.LinkCount--; - andp->m.LinkCount++; + aodp->f.m.LinkCount--; + andp->f.m.LinkCount++; } /* If we're in the same directory, link count doesn't change */ } else { - aodp->m.LinkCount = OutOldDirStatus.LinkCount; + aodp->f.m.LinkCount = OutOldDirStatus.LinkCount; if (!oneDir) - andp->m.LinkCount = OutNewDirStatus.LinkCount; + andp->f.m.LinkCount = OutNewDirStatus.LinkCount; } } else { /* operation failed (code != 0) */ @@ -322,8 +322,8 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, ObtainWriteLock(&afs_xcbhash, 498); afs_DequeueCallback(aodp); afs_DequeueCallback(andp); - andp->states &= ~CStatd; - aodp->states &= ~CStatd; + andp->f.states &= ~CStatd; + aodp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(andp); osi_dnlc_purgedp(aodp); @@ -342,8 +342,11 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, } ReleaseWriteLock(&aodp->lock); - if (!oneDir) + + if (!oneDir) { ReleaseWriteLock(&andp->lock); + } + if (returnCode) { code = returnCode; goto done; @@ -358,8 +361,8 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, * entry */ if (unlinkFid.Fid.Vnode) { - unlinkFid.Fid.Volume = aodp->fid.Fid.Volume; - unlinkFid.Cell = aodp->fid.Cell; + unlinkFid.Fid.Volume = aodp->f.fid.Fid.Volume; + unlinkFid.Cell = aodp->f.fid.Cell; tvc = NULL; if (!unlinkFid.Fid.Unique) { tvc = afs_LookupVCache(&unlinkFid, areq, NULL, aodp, aname1); @@ -372,9 +375,9 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, afs_BozonLock(&tvc->pvnLock, tvc); /* Since afs_TryToSmush will do a pvn_vptrunc */ #endif ObtainWriteLock(&tvc->lock, 151); - tvc->m.LinkCount--; - tvc->states &= ~CUnique; /* For the dfs xlator */ - if (tvc->m.LinkCount == 0 && !osi_Active(tvc)) { + tvc->f.m.LinkCount--; + tvc->f.states &= ~CUnique; /* For the dfs xlator */ + if (tvc->f.m.LinkCount == 0 && !osi_Active(tvc)) { /* if this was last guy (probably) discard from cache. * We have to be careful to not get rid of the stat * information, since otherwise operations will start @@ -396,8 +399,8 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, /* now handle ".." invalidation */ if (!oneDir) { - fileFid.Fid.Volume = aodp->fid.Fid.Volume; - fileFid.Cell = aodp->fid.Cell; + fileFid.Fid.Volume = aodp->f.fid.Fid.Volume; + fileFid.Cell = aodp->f.fid.Cell; if (!fileFid.Fid.Unique) tvc = afs_LookupVCache(&fileFid, areq, NULL, andp, aname2); else @@ -411,8 +414,8 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, /* If disconnected, we need to fix (not discard) the "..".*/ afs_dir_ChangeFid(tdc1, "..", - &aodp->fid.Fid.Vnode, - &andp->fid.Fid.Vnode); + &aodp->f.fid.Fid.Vnode, + &andp->f.fid.Fid.Vnode); #endif } else { ObtainWriteLock(&tdc1->lock, 648); @@ -426,8 +429,9 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, ReleaseWriteLock(&tvc->lock); afs_PutVCache(tvc); } else if (AFS_IS_DISCON_RW && tvc && (vType(tvc) == VREG)) { - tvc->parentVnode = andp->fid.Fid.Vnode; - tvc->parentUnique = andp->fid.Fid.Unique; + /* XXX - Should tvc not get locked here? */ + tvc->f.parent.vnode = andp->f.fid.Fid.Vnode; + tvc->f.parent.unique = andp->f.fid.Fid.Unique; } else if (tvc) { /* True we shouldn't come here since tvc SHOULD be a dir, but we * 'syntactically' need to unless we change the 'if' above... diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index 54cfc65..3f86012 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -122,7 +122,7 @@ int afs_ustrategy(register struct buf *abp) * to it, go ahead and write protect the page. This way we will detect * storing beyond EOF in the future */ - if (dbtob(abp->b_blkno) + abp->b_bcount > tvc->m.Length) { + if (dbtob(abp->b_blkno) + abp->b_bcount > tvc->f.m.Length) { if ((abp->b_flags & B_PFSTORE) == 0) { AFS_GUNLOCK(); vm_protectp(tvc->segid, dbtob(abp->b_blkno) / PAGESIZE, @@ -164,12 +164,12 @@ int afs_ustrategy(register struct buf *abp) * XXX It this really right? Ideally we should always write block size multiple * and not any arbitrary size, right? XXX */ - len = MIN(len, tvc->m.Length - dbtob(abp->b_blkno)); + len = MIN(len, tvc->f.m.Length - dbtob(abp->b_blkno)); #endif #ifdef AFS_OSF_ENV len = MIN(abp->b_bcount, - (VTOAFS(abp->b_vp))->m.Length - dbtob(abp->b_blkno)); + (VTOAFS(abp->b_vp))->f.m.Length - dbtob(abp->b_blkno)); #endif /* AFS_OSF_ENV */ tuio.afsio_resid = len; #if defined(AFS_XBSD_ENV) diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index 0e331bb..d1e635f 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -54,7 +54,7 @@ afs_DisconCreateSymlink(struct vcache *avc, char *aname, } len = strlen(aname); - avc->m.Length = len; + avc->f.m.Length = len; ObtainWriteLock(&tdc->lock, 720); afs_AdjustSize(tdc, len); @@ -129,7 +129,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, /** If the volume is read-only, return error without making an RPC to the * fileserver */ - if (adp->states & CRO) { + if (adp->f.states & CRO) { code = EROFS; goto done; } @@ -151,7 +151,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, alen++; /* add in the null */ } tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); - volp = afs_FindVolume(&adp->fid, READ_LOCK); /*parent is also in same vol */ + volp = afs_FindVolume(&adp->f.fid, READ_LOCK); /*parent is also in same vol */ ObtainWriteLock(&adp->lock, 156); if (tdc) ObtainWriteLock(&tdc->lock, 636); @@ -159,16 +159,16 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, /* XXX Pay attention to afs_xvcache around the whole thing!! XXX */ if (!AFS_IS_DISCON_RW) { do { - tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); if (tc) { hostp = tc->srvr->server; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SYMLINK); - if (adp->states & CForeign) { + if (adp->f.states & CForeign) { now = osi_Time(); RX_AFS_GUNLOCK(); code = RXAFS_DFSSymlink(tc->id, - (struct AFSFid *)&adp->fid.Fid, + (struct AFSFid *)&adp->f.fid.Fid, aname, atargetName, &InStatus, (struct AFSFid *)&newFid.Fid, &OutFidStatus, &OutDirStatus, @@ -177,7 +177,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else { RX_AFS_GUNLOCK(); code = - RXAFS_Symlink(tc->id, (struct AFSFid *)&adp->fid.Fid, + RXAFS_Symlink(tc->id, (struct AFSFid *)&adp->f.fid.Fid, aname, atargetName, &InStatus, (struct AFSFid *)&newFid.Fid, &OutFidStatus, &OutDirStatus, &tsync); @@ -187,12 +187,12 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else code = -1; } while (afs_Analyze - (tc, code, &adp->fid, &treq, AFS_STATS_FS_RPCIDX_SYMLINK, + (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_SYMLINK, SHARED_LOCK, NULL)); } else { #ifdef AFS_DISCON_ENV - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; afs_GenFakeFid(&newFid, VREG, 0); #endif } @@ -202,7 +202,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (code < 0) { ObtainWriteLock(&afs_xcbhash, 499); afs_DequeueCallback(adp); - adp->states &= ~CStatd; + adp->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); osi_dnlc_purgedp(adp); } @@ -229,8 +229,8 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, ReleaseWriteLock(&tdc->lock); afs_PutDCache(tdc); } - newFid.Cell = adp->fid.Cell; - newFid.Fid.Volume = adp->fid.Fid.Volume; + newFid.Cell = adp->f.fid.Cell; + newFid.Fid.Volume = adp->f.fid.Fid.Volume; ReleaseWriteLock(&adp->lock); /* now we're done with parent dir, create the link's entry. Note that @@ -245,11 +245,11 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } ObtainWriteLock(&tvc->lock, 157); ObtainWriteLock(&afs_xcbhash, 500); - tvc->states |= CStatd; /* have valid info */ - tvc->states &= ~CBulkFetching; + tvc->f.states |= CStatd; /* have valid info */ + tvc->f.states &= ~CBulkFetching; - if (adp->states & CForeign) { - tvc->states |= CForeign; + if (adp->f.states & CForeign) { + tvc->f.states |= CForeign; /* We don't have to worry about losing the callback since we're doing it * under the afs_xvcache lock actually, afs_NewVCache may drop the * afs_xvcache lock, if it calls afs_FlushVCache */ @@ -323,7 +323,7 @@ afs_MemHandleLink(register struct vcache *avc, struct vrequest *areq) afs_PutDCache(tdc); return EFAULT; } - if (avc->m.Mode & 0111) + if (avc->f.m.Mode & 0111) alen = len + 1; /* regular link */ else alen = len; /* mt point */ @@ -367,7 +367,7 @@ afs_UFSHandleLink(register struct vcache *avc, struct vrequest *areq) tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 0); afs_Trace3(afs_iclSetp, CM_TRACE_UFSLINK, ICL_TYPE_POINTER, avc, ICL_TYPE_POINTER, tdc, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); if (!tdc) { if (AFS_IS_DISCONNECTED) return ENETDOWN; @@ -379,7 +379,7 @@ afs_UFSHandleLink(register struct vcache *avc, struct vrequest *areq) afs_PutDCache(tdc); return EFAULT; } - if (avc->m.Mode & 0111) + if (avc->f.m.Mode & 0111) alen = len + 1; /* regular link */ else alen = len; /* mt point */ diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 27faba0..b9f650c 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -49,8 +49,8 @@ afs_StoreOnLastReference(register struct vcache *avc, * ourselves now. If we're called by the CCore clearer, the CCore * flag will already be clear, so we don't have to worry about * clearing it twice. */ - if (avc->states & CCore) { - avc->states &= ~CCore; + if (avc->f.states & CCore) { + avc->f.states &= ~CCore; #if defined(AFS_SGI_ENV) osi_Assert(avc->opens > 0 && avc->execsOrWriters > 0); #endif @@ -138,7 +138,7 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, afs_Trace4(afs_iclSetp, CM_TRACE_WRITE, ICL_TYPE_POINTER, avc, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(totalLength), ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); if (!noLock) { afs_MaybeWakeupTruncateDaemon(); ObtainWriteLock(&avc->lock, 126); @@ -152,8 +152,8 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, * Since we are called via strategy, we need to trim the write to * the actual size of the file */ - osi_Assert(filePos <= avc->m.Length); - diff = avc->m.Length - filePos; + osi_Assert(filePos <= avc->f.m.Length); + diff = avc->f.m.Length - filePos; AFS_UIO_SETRESID(auio, MIN(totalLength, diff)); totalLength = AFS_UIO_RESID(auio); } @@ -163,7 +163,7 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, #if defined(AFS_SUN56_ENV) auio->uio_loffset = 0; #endif - filePos = avc->m.Length; + filePos = avc->f.m.Length; AFS_UIO_SETOFFSET(auio, filePos); } #endif @@ -171,7 +171,7 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, * Note that we use startDate rather than calling osi_Time() here. * This is to avoid counting lock-waiting time in file date (for ranlib). */ - avc->m.Date = startDate; + avc->f.m.Date = startDate; #if defined(AFS_HPUX_ENV) #if defined(AFS_HPUX101_ENV) @@ -197,7 +197,7 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, #else afs_FakeOpen(avc); #endif - avc->states |= CDirty; + avc->f.states |= CDirty; #ifndef AFS_DARWIN80_ENV tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec)); #endif @@ -261,18 +261,18 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, filePos += len; #if defined(AFS_SGI_ENV) /* afs_xwrite handles setting m.Length */ - osi_Assert(filePos <= avc->m.Length); + osi_Assert(filePos <= avc->f.m.Length); #else - if (filePos > avc->m.Length) { + if (filePos > avc->f.m.Length) { #if AFS_DISCON_ENV if (AFS_IS_DISCON_RW) afs_PopulateDCache(avc, filePos, &treq); #endif afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, ICL_TYPE_STRING, __FILE__, ICL_TYPE_LONG, __LINE__, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length), ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos)); - avc->m.Length = filePos; + avc->f.m.Length = filePos; } #endif ReleaseWriteLock(&tdc->lock); @@ -355,7 +355,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, afs_Trace4(afs_iclSetp, CM_TRACE_WRITE, ICL_TYPE_POINTER, avc, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(totalLength), ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_HANDLE_OFFSET(avc->f.m.Length)); if (!noLock) { afs_MaybeWakeupTruncateDaemon(); ObtainWriteLock(&avc->lock, 556); @@ -369,8 +369,8 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, * Since we are called via strategy, we need to trim the write to * the actual size of the file */ - osi_Assert(filePos <= avc->m.Length); - diff = avc->m.Length - filePos; + osi_Assert(filePos <= avc->f.m.Length); + diff = avc->f.m.Length - filePos; AFS_UIO_SETRESID(auio, MIN(totalLength, diff)); totalLength = AFS_UIO_RESID(auio); } @@ -380,15 +380,15 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, #if defined(AFS_SUN56_ENV) auio->uio_loffset = 0; #endif - filePos = avc->m.Length; - AFS_UIO_SETOFFSET(auio, avc->m.Length); + filePos = avc->f.m.Length; + AFS_UIO_SETOFFSET(auio, avc->f.m.Length); } #endif /* * Note that we use startDate rather than calling osi_Time() here. * This is to avoid counting lock-waiting time in file date (for ranlib). */ - avc->m.Date = startDate; + avc->f.m.Date = startDate; #if defined(AFS_HPUX_ENV) #if defined(AFS_HPUX101_ENV) @@ -414,7 +414,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, #else afs_FakeOpen(avc); #endif - avc->states |= CDirty; + avc->f.states |= CDirty; #ifndef AFS_DARWIN80_ENV tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec)); #endif @@ -485,11 +485,11 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, ("\n\n\n*** Cache partition is full - decrease cachesize!!! ***\n\n\n"); #elif defined(AFS_SGI_ENV) AFS_GUNLOCK(); - avc->states |= CWritingUFS; + avc->f.states |= CWritingUFS; AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_WRITE); AFS_VOP_WRITE(tfile->vnode, &tuio, IO_ISLOCKED, afs_osi_credp, code); AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_WRITE); - avc->states &= ~CWritingUFS; + avc->f.states &= ~CWritingUFS; AFS_GLOCK(); #elif defined(AFS_OSF_ENV) { @@ -573,18 +573,18 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, filePos += len; #if defined(AFS_SGI_ENV) /* afs_xwrite handles setting m.Length */ - osi_Assert(filePos <= avc->m.Length); + osi_Assert(filePos <= avc->f.m.Length); #else - if (filePos > avc->m.Length) { + if (filePos > avc->f.m.Length) { # ifdef AFS_DISCON_ENV if (AFS_IS_DISCON_RW) afs_PopulateDCache(avc, filePos, &treq); # endif afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, ICL_TYPE_STRING, __FILE__, ICL_TYPE_LONG, __LINE__, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length), ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos)); - avc->m.Length = filePos; + avc->f.m.Length = filePos; } #endif osi_UFSClose(tfile); @@ -655,7 +655,7 @@ afs_DoPartialWrite(register struct vcache *avc, struct vrequest *areq) return 0; /* nothing to do */ /* otherwise, call afs_StoreDCache (later try to do this async, if possible) */ afs_Trace2(afs_iclSetp, CM_TRACE_PARTIALWRITE, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); #if defined(AFS_SUN5_ENV) code = afs_StoreAllSegments(avc, areq, AFS_ASYNC | AFS_VMSYNC_INVAL); @@ -801,7 +801,7 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, struct AFS_UCRED *acred) HandleFlock(avc, LOCK_UN, &treq, OSI_GET_CURRENT_PID(), 1 /*onlymine */ ); #endif /* AFS_SGI65_ENV */ /* afs_chkpgoob will drop and re-acquire the global lock. */ - afs_chkpgoob(&avc->v, btoc(avc->m.Length)); + afs_chkpgoob(&avc->v, btoc(avc->f.m.Length)); #elif defined(AFS_SUN5_ENV) if (count > 1) { /* The vfs layer may call this repeatedly with higher "count"; only on the last close (i.e. count = 1) we should actually proceed with the close. */ @@ -906,7 +906,7 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, struct AFS_UCRED *acred) ReleaseWriteLock(&avc->lock); } #ifdef AFS_OSF_ENV - if ((VREFCOUNT(avc) <= 2) && (avc->states & CUnlinked)) { + if ((VREFCOUNT(avc) <= 2) && (avc->f.states & CUnlinked)) { afs_remunlink(avc, 1); /* ignore any return code */ } #endif diff --git a/src/afs/afs.h b/src/afs/afs.h index b50b7e7..834f5e1 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -188,6 +188,7 @@ struct afs_q { struct afs_q *prev; }; +#define QZero(e) ((e)->prev = (e)->next = NULL) #define QInit(q) ((q)->prev = (q)->next = (q)) #define QAdd(q,e) ((e)->next = (q)->next, (e)->prev = (q), \ (q)->next->prev = (e), (q)->next = (e)) @@ -212,6 +213,14 @@ struct afs_q { #define QTOC(e) QEntry(e, struct cell, lruq) #define QTOVH(e) QEntry(e, struct vcache, vhashq) +/*! + * List of free slot numbers + */ +struct afs_slotlist { + afs_uint32 slot; + struct afs_slotlist *next; +}; + struct vrequest { afs_int32 uid; /* user id making the request */ afs_int32 busyCount; /* how many busies we've seen so far */ @@ -347,11 +356,11 @@ struct afs_conn { || (a)->Fid.Volume != (b)->Fid.Volume \ || (a)->Cell != (b)->Cell) -#define FidMatches(afid,tvc) ((tvc)->fid.Fid.Vnode == (afid)->Fid.Vnode && \ - (tvc)->fid.Fid.Volume == (afid)->Fid.Volume && \ - (tvc)->fid.Cell == (afid)->Cell && \ - ( (tvc)->fid.Fid.Unique == (afid)->Fid.Unique || \ - (!(afid)->Fid.Unique && ((tvc)->states & CUnique)))) +#define FidMatches(afid,tvc) ((tvc)->f.fid.Fid.Vnode == (afid)->Fid.Vnode && \ + (tvc)->f.fid.Fid.Volume == (afid)->Fid.Volume && \ + (tvc)->f.fid.Cell == (afid)->Cell && \ + ( (tvc)->f.fid.Fid.Unique == (afid)->Fid.Unique || \ + (!(afid)->Fid.Unique && ((tvc)->f.states & CUnique)))) #define SRVADDR_MH 1 @@ -579,6 +588,7 @@ struct SimpleLocks { #define CBulkFetching 0x04000000 /* stats are being fetched by bulk stat */ #define CExtendedFile 0x08000000 /* extended file via ftruncate call. */ #define CVInit 0x10000000 /* being initialized */ +#define CMetaDirty 0x20000000 /* vnode meta-data needs to be flushed */ /* vcache vstate bits */ #define VRevokeWait 0x1 @@ -670,6 +680,49 @@ extern afs_int32 vmPageHog; /* counter for # of vnodes which are page hogs. */ #define AFSTOV(V) (&(V)->v) #endif +struct afs_vnuniq { + afs_uint32 vnode; + afs_uint32 unique; +}; + +/* VCache elements which are kept on disk, and in the kernel */ +struct fvcache { + struct VenusFid fid; + struct mstat { + afs_size_t Length; + afs_hyper_t DataVersion; + afs_uint32 Date; + afs_uint32 Owner; + afs_uint32 Group; + afs_uint16 Mode; /* XXXX Should be afs_int32 XXXX */ + afs_uint16 LinkCount; +#ifdef AFS_DARWIN80_ENV + afs_uint16 Type; +#else + /* vnode type is in v.v_type */ +#endif + } m; + struct afs_vnuniq parent; + + /*! Truncate file to this position at the next store */ + afs_size_t truncPos; + + /*! System:AnyUser's access to this. */ + afs_int32 anyAccess; + + /*! state bits */ + afs_uint32 states; + +#if defined(AFS_DISCON_ENV) + /*! Disconnected flags for this vcache element. */ + afs_uint32 ddirty_flags; + /*! Shadow vnode + unique keep the shadow dir location. */ + struct afs_vnuniq shadow; + /*! The old parent FID for renamed vnodes */ + struct afs_vnuniq oldParent; +#endif +}; + /* INVARIANTs: (vlruq.next != NULL) == (vlruq.prev != NULL) * nextfree => !vlruq.next && ! vlruq.prev * !(avc->nextfree) && !avc->vlruq.next => (FreeVCList == avc->nextfree) @@ -691,31 +744,12 @@ struct vcache { struct afs_q dirtyq; /*! Queue of vcaches with shadow entries. Lock with afs_disconDirtyLock */ struct afs_q shadowq; - /*! Disconnected flags for this vcache element. */ - uint32_t ddirty_flags; - /*! Shadow vnode + unique keep the shadow dir location. */ - afs_uint32 shVnode; - afs_uint32 shUnique; - /*! The old parent FID for renamed vnodes. */ - afs_uint32 oldVnode; - afs_uint32 oldUnique; -#endif - - struct VenusFid fid; - struct mstat { - afs_size_t Length; - afs_hyper_t DataVersion; - afs_uint32 Date; - afs_uint32 Owner; - afs_uint32 Group; - afs_uint16 Mode; /* XXXX Should be afs_int32 XXXX */ - afs_uint16 LinkCount; -#ifdef AFS_DARWIN80_ENV - afs_uint16 Type; -#else - /* vnode type is in v.v_type */ + /*! Queue of vcaches with dirty metadata. Locked by afs_xvcdirty */ + struct afs_q metadirty; + /*! Vcaches slot number in the disk backup. Protected by tvc->lock */ + afs_uint32 diskSlot; #endif - } m; + struct fvcache f; afs_rwlock_t lock; /* The lock on the vcache contents. */ #if defined(AFS_SUN5_ENV) /* Lock used to protect the activeV, multipage, and vstates fields. @@ -750,18 +784,15 @@ struct vcache { #ifdef AFS_XBSD_ENV struct lock rwlock; #endif - afs_int32 parentVnode; /* Parent dir, if a file. */ - afs_int32 parentUnique; + struct VenusFid *mvid; /* Either parent dir (if root) or root (if mt pt) */ char *linkData; /* Link data if a symlink. */ afs_hyper_t flushDV; /* data version last flushed from text */ afs_hyper_t mapDV; /* data version last flushed from map */ - afs_size_t truncPos; /* truncate file to this position at next store */ struct server *callback; /* The callback host, if any */ afs_uint32 cbExpires; /* time the callback expires */ struct afs_q callsort; /* queue in expiry order, sort of */ struct axscache *Access; /* a list of cached access bits */ - afs_int32 anyAccess; /* System:AnyUser's access to this. */ afs_int32 last_looker; /* pag/uid from last lookup here */ #if defined(AFS_SUN5_ENV) afs_int32 activeV; @@ -781,9 +812,8 @@ struct vcache { #else off_t next_seq_blk_offset; /* accounted in blocks for Solaris & IRIX */ #endif -#endif +#endif - afs_uint32 states; /* state bits */ #if defined(AFS_SUN5_ENV) afs_uint32 vstates; /* vstate bits */ #endif /* defined(AFS_SUN5_ENV) */ @@ -1132,7 +1162,7 @@ struct memCacheEntry { #define afs_FakeClose(avc, acred) \ { if (avc->execsOrWriters == 1) { \ /* we're the last writer, just use CCore flag */ \ - avc->states |= CCore; /* causes close to be called later */ \ + avc->f.states |= CCore; /* causes close to be called later */ \ \ /* The cred and vnode holds will be released in afs_FlushActiveVcaches */ \ VN_HOLD(AFSTOV(avc)); /* So it won't disappear */ \ @@ -1147,10 +1177,10 @@ struct memCacheEntry { #define AFS_ZEROS 64 /* zero buffer */ -/*#define afs_DirtyPages(avc) (((avc)->states & CDirty) || osi_VMDirty_p((avc)))*/ -#define afs_DirtyPages(avc) ((avc)->states & CDirty) +/*#define afs_DirtyPages(avc) (((avc)->f.states & CDirty) || osi_VMDirty_p((avc)))*/ +#define afs_DirtyPages(avc) ((avc)->f.states & CDirty) -#define afs_InReadDir(avc) (((avc)->states & CReadDir) && (avc)->readdir_pid == MyPidxx) +#define afs_InReadDir(avc) (((avc)->f.states & CReadDir) && (avc)->readdir_pid == MyPidxx) /* The PFlush algorithm makes use of the fact that Fid.Unique is not used in below hash algorithms. Change it if need be so that flushing algorithm @@ -1198,11 +1228,11 @@ extern struct brequest afs_brs[NBRS]; /* request structures */ * expiration/breaking code */ #ifdef AFS_DARWIN_ENV #define afs_VerifyVCache(avc, areq) \ - (((avc)->states & CStatd) ? (osi_VM_Setup(avc, 0), 0) : \ + (((avc)->f.states & CStatd) ? (osi_VM_Setup(avc, 0), 0) : \ afs_VerifyVCache2((avc),areq)) #else #define afs_VerifyVCache(avc, areq) \ - (((avc)->states & CStatd) ? 0 : afs_VerifyVCache2((avc),areq)) + (((avc)->f.states & CStatd) ? 0 : afs_VerifyVCache2((avc),areq)) #endif #define DO_STATS 1 /* bits used by FindVCache */ diff --git a/src/afs/afs_bypasscache.c b/src/afs/afs_bypasscache.c index a0d1fd2..fa8ecc8 100644 --- a/src/afs/afs_bypasscache.c +++ b/src/afs/afs_bypasscache.c @@ -141,7 +141,7 @@ void afs_TransitionToBypass(register struct vcache *avc, register struct AFS_UCR if(!avc) return; - if(avc->states & FCSBypass) + if(avc->f.states & FCSBypass) osi_Panic("afs_TransitionToBypass: illegal transition to bypass--already FCSBypass\n"); if(aflags & TRANSChangeDesiredBit) @@ -158,7 +158,7 @@ void afs_TransitionToBypass(register struct vcache *avc, register struct AFS_UCR /* If we never cached this, just change state */ if(setDesire && (!avc->cachingStates & FCSBypass)) { - avc->states |= FCSBypass; + avc->f.states |= FCSBypass; goto done; } /* cg2v, try to store any chunks not written 20071204 */ @@ -173,11 +173,11 @@ void afs_TransitionToBypass(register struct vcache *avc, register struct AFS_UCR afs_DequeueCallback(avc); ReleaseWriteLock(&afs_xcbhash); #endif - avc->states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */ + avc->f.states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */ /* now find the disk cache entries */ afs_TryToSmush(avc, acred, 1); osi_dnlc_purgedp(avc); - if (avc->linkData && !(avc->states & CCore)) { + if (avc->linkData && !(avc->f.states & CCore)) { afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1); avc->linkData = NULL; } @@ -213,7 +213,7 @@ void afs_TransitionToCaching(register struct vcache *avc, register struct AFS_UC if(!avc) return; - if(!avc->states & FCSBypass) + if(!avc->f.states & FCSBypass) osi_Panic("afs_TransitionToCaching: illegal transition to caching--already caching\n"); if(aflags & TRANSChangeDesiredBit) @@ -231,12 +231,12 @@ void afs_TransitionToCaching(register struct vcache *avc, register struct AFS_UC /* Ok, we actually do need to flush */ ObtainWriteLock(&afs_xcbhash, 957); afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */ + avc->f.states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */ ReleaseWriteLock(&afs_xcbhash); /* now find the disk cache entries */ afs_TryToSmush(avc, acred, 1); osi_dnlc_purgedp(avc); - if (avc->linkData && !(avc->states & CCore)) { + if (avc->linkData && !(avc->f.states & CCore)) { afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1); avc->linkData = NULL; } @@ -339,7 +339,7 @@ afs_NoCacheFetchProc(register struct rx_call *acall, * We do not do this for AFS file servers because they sometimes * return large negative numbers as the transfer size. */ - if (avc->states & CForeign) { + if (avc->f.states & CForeign) { moredata = length & 0x80000000; length &= ~0x80000000; } else { @@ -549,7 +549,7 @@ afs_PrefetchNoCache(register struct vcache *avc, tcallspec = (struct tlocal1 *) osi_Alloc(sizeof(struct tlocal1)); do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK /* ignored */); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK /* ignored */); if (tc) { avc->callback = tc->srvr->server; i = osi_Time(); @@ -557,7 +557,7 @@ afs_PrefetchNoCache(register struct vcache *avc, #ifdef AFS_64BIT_CLIENT if(!afs_serverHasNo64Bit(tc)) { code = StartRXAFS_FetchData64(tcall, - (struct AFSFid *) &avc->fid.Fid, + (struct AFSFid *) &avc->f.fid.Fid, auio->uio_offset, bparms->length); if (code == 0) { @@ -585,7 +585,7 @@ afs_PrefetchNoCache(register struct vcache *avc, if (!tcall) tcall = rx_NewCall(tc->id); code = StartRXAFS_FetchData(tcall, - (struct AFSFid *) &avc->fid.Fid, + (struct AFSFid *) &avc->f.fid.Fid, pos, bparms->length); COND_RE_GLOCK(locked); } @@ -594,7 +594,7 @@ afs_PrefetchNoCache(register struct vcache *avc, } /* afs_serverHasNo64Bit */ #else code = StartRXAFS_FetchData(tcall, - (struct AFSFid *) &avc->fid.Fid, + (struct AFSFid *) &avc->f.fid.Fid, auio->uio_offset, bparms->length); #endif @@ -628,7 +628,7 @@ afs_PrefetchNoCache(register struct vcache *avc, #endif goto done; } - } while (afs_Analyze(tc, code, &avc->fid, areq, + } while (afs_Analyze(tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHDATA, SHARED_LOCK,0)); done: diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index ed222dc..d6deafc 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -69,6 +69,7 @@ static struct ltable { #ifdef AFS_DISCON_ENV { "afs_discon_lock", (char *)&afs_discon_lock}, { "afs_disconDirtyLock", (char *)&afs_disconDirtyLock}, + { "afs_discon_vc_dirty", (char *)&afs_xvcdirty}, #endif }; unsigned long lastCallBack_vnode; @@ -135,10 +136,10 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index, * Copy out the located entry. */ a_result->addr = afs_data_pointer_to_int32(tvc); - a_result->cell = tvc->fid.Cell; - a_result->netFid.Volume = tvc->fid.Fid.Volume; - a_result->netFid.Vnode = tvc->fid.Fid.Vnode; - a_result->netFid.Unique = tvc->fid.Fid.Unique; + a_result->cell = tvc->f.fid.Cell; + a_result->netFid.Volume = tvc->f.fid.Fid.Volume; + a_result->netFid.Vnode = tvc->f.fid.Fid.Vnode; + a_result->netFid.Unique = tvc->f.fid.Fid.Unique; a_result->lock.waitStates = tvc->lock.wait_states; a_result->lock.exclLocked = tvc->lock.excl_locked; a_result->lock.readersReading = tvc->lock.readers_reading; @@ -154,14 +155,14 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index, a_result->lock.src_indicator = 0; #endif /* AFS_OSF20_ENV */ #ifdef AFS_64BIT_CLIENT - a_result->Length = (afs_int32) tvc->m.Length & 0xffffffff; + a_result->Length = (afs_int32) tvc->f.m.Length & 0xffffffff; #else /* AFS_64BIT_CLIENT */ - a_result->Length = tvc->m.Length; + a_result->Length = tvc->f.m.Length; #endif /* AFS_64BIT_CLIENT */ - a_result->DataVersion = hgetlo(tvc->m.DataVersion); + a_result->DataVersion = hgetlo(tvc->f.m.DataVersion); a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */ a_result->cbExpires = tvc->cbExpires; - if (tvc->states & CVInit) { + if (tvc->f.states & CVInit) { a_result->refCount = 1; } else { #ifdef AFS_DARWIN80_ENV @@ -173,7 +174,7 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index, a_result->opens = tvc->opens; a_result->writers = tvc->execsOrWriters; a_result->mvstat = tvc->mvstat; - a_result->states = tvc->states; + a_result->states = tvc->f.states; code = 0; /* @@ -221,10 +222,10 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, * Copy out the located entry. */ a_result->addr = afs_data_pointer_to_int32(tvc); - a_result->cell = tvc->fid.Cell; - a_result->netFid.Volume = tvc->fid.Fid.Volume; - a_result->netFid.Vnode = tvc->fid.Fid.Vnode; - a_result->netFid.Unique = tvc->fid.Fid.Unique; + a_result->cell = tvc->f.fid.Cell; + a_result->netFid.Volume = tvc->f.fid.Fid.Volume; + a_result->netFid.Vnode = tvc->f.fid.Fid.Vnode; + a_result->netFid.Unique = tvc->f.fid.Fid.Unique; a_result->lock.waitStates = tvc->lock.wait_states; a_result->lock.exclLocked = tvc->lock.excl_locked; a_result->lock.readersReading = tvc->lock.readers_reading; @@ -241,14 +242,14 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, #endif /* AFS_OSF20_ENV */ #if !defined(AFS_64BIT_ENV) a_result->Length.high = 0; - a_result->Length.low = tvc->m.Length; + a_result->Length.low = tvc->f.m.Length; #else - a_result->Length = tvc->m.Length; + a_result->Length = tvc->f.m.Length; #endif - a_result->DataVersion = hgetlo(tvc->m.DataVersion); + a_result->DataVersion = hgetlo(tvc->f.m.DataVersion); a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */ a_result->cbExpires = tvc->cbExpires; - if (tvc->states & CVInit) { + if (tvc->f.states & CVInit) { a_result->refCount = 1; } else { #ifdef AFS_DARWIN80_ENV @@ -260,7 +261,7 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, a_result->opens = tvc->opens; a_result->writers = tvc->execsOrWriters; a_result->mvstat = tvc->mvstat; - a_result->states = tvc->states; + a_result->states = tvc->f.states; code = 0; /* @@ -448,20 +449,20 @@ loop1: for (tq = afs_vhashTV[i].prev; tq != &afs_vhashTV[i]; tq = uq) { uq = QPrev(tq); tvc = QTOVH(tq); - if (tvc->fid.Fid.Volume == a_fid->Volume) { + if (tvc->f.fid.Fid.Volume == a_fid->Volume) { tvc->callback = NULL; if (!localFid.Cell) - localFid.Cell = tvc->fid.Cell; + localFid.Cell = tvc->f.fid.Cell; tvc->dchint = NULL; /* invalidate hints */ - if (tvc->states & CVInit) { + if (tvc->f.states & CVInit) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop1; } #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop1; } #endif @@ -489,18 +490,18 @@ loop1: ReleaseReadLock(&afs_xvcache); ObtainWriteLock(&afs_xcbhash, 449); afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CUnique | CBulkFetching); + tvc->f.states &= ~(CStatd | CUnique | CBulkFetching); afs_allCBs++; - if (tvc->fid.Fid.Vnode & 1) + if (tvc->f.fid.Fid.Vnode & 1) afs_oddCBs++; else afs_evenCBs++; ReleaseWriteLock(&afs_xcbhash); - if ((tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) + if ((tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) osi_dnlc_purgedp(tvc); afs_Trace3(afs_iclSetp, CM_TRACE_CALLBACK, ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, - tvc->states, ICL_TYPE_INT32, + tvc->f.states, ICL_TYPE_INT32, a_fid->Volume); #ifdef AFS_DARWIN80_ENV vnode_put(AFSTOV(tvc)); @@ -508,9 +509,9 @@ loop1: ObtainReadLock(&afs_xvcache); uq = QPrev(tq); AFS_FAST_RELE(tvc); - } else if ((tvc->states & CMValid) + } else if ((tvc->f.states & CMValid) && (tvc->mvid->Fid.Volume == a_fid->Volume)) { - tvc->states &= ~CMValid; + tvc->f.states &= ~CMValid; if (!localFid.Cell) localFid.Cell = tvc->mvid->Cell; } @@ -542,20 +543,20 @@ loop2: i = VCHash(&localFid); for (tvc = afs_vhashT[i]; tvc; tvc = uvc) { uvc = tvc->hnext; - if (tvc->fid.Fid.Vnode == a_fid->Vnode - && tvc->fid.Fid.Volume == a_fid->Volume - && tvc->fid.Fid.Unique == a_fid->Unique) { + if (tvc->f.fid.Fid.Vnode == a_fid->Vnode + && tvc->f.fid.Fid.Volume == a_fid->Volume + && tvc->f.fid.Fid.Unique == a_fid->Unique) { tvc->callback = NULL; tvc->dchint = NULL; /* invalidate hints */ - if (tvc->states & CVInit) { + if (tvc->f.states & CVInit) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop2; } #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop2; } #endif @@ -583,13 +584,13 @@ loop2: ReleaseReadLock(&afs_xvcache); ObtainWriteLock(&afs_xcbhash, 450); afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CUnique | CBulkFetching); + tvc->f.states &= ~(CStatd | CUnique | CBulkFetching); ReleaseWriteLock(&afs_xcbhash); - if ((tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) + if ((tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) osi_dnlc_purgedp(tvc); afs_Trace3(afs_iclSetp, CM_TRACE_CALLBACK, ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, - tvc->states, ICL_TYPE_LONG, 0); + tvc->f.states, ICL_TYPE_LONG, 0); #ifdef CBDEBUG lastCallBack_vnode = afid->Vnode; lastCallBack_dv = tvc->mstat.DataVersion.low; @@ -768,7 +769,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *a_call) ObtainWriteLock(&afs_xcbhash, 451); afs_DequeueCallback(tvc); tvc->callback = NULL; - tvc->states &= ~(CStatd | CUnique | CBulkFetching); + tvc->f.states &= ~(CStatd | CUnique | CBulkFetching); ReleaseWriteLock(&afs_xcbhash); } } diff --git a/src/afs/afs_cbqueue.c b/src/afs/afs_cbqueue.c index 87cb5bc..e9628f2 100644 --- a/src/afs/afs_cbqueue.c +++ b/src/afs/afs_cbqueue.c @@ -208,8 +208,8 @@ afs_CheckCallbacks(unsigned int secs) /* Get the volume, and if its callback expiration time is more than secs * seconds into the future, update this vcache entry and requeue it below */ - if ((tvc->states & CRO) - && (tvp = afs_FindVolume(&(tvc->fid), READ_LOCK))) { + if ((tvc->f.states & CRO) + && (tvp = afs_FindVolume(&(tvc->f.fid), READ_LOCK))) { if (tvp->expireTime > now + secs) { tvc->cbExpires = tvp->expireTime; /* XXX race here */ } else { @@ -219,9 +219,9 @@ afs_CheckCallbacks(unsigned int secs) /* What about locking xvcache or vrefcount++ or * write locking tvc? */ QRemove(tq); - tvc->states &= ~(CStatd | CMValid | CUnique); - if (!(tvc->states & (CVInit|CVFlushed)) && - (tvc->fid.Fid.Vnode & 1 || + tvc->f.states &= ~(CStatd | CMValid | CUnique); + if (!(tvc->f.states & (CVInit|CVFlushed)) && + (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) osi_dnlc_purgedp(tvc); tvc->dchint = NULL; /*invalidate em */ @@ -236,9 +236,9 @@ afs_CheckCallbacks(unsigned int secs) * What about locking xvcache or vrefcount++ or write locking tvc? */ QRemove(tq); - tvc->states &= ~(CStatd | CMValid | CUnique); - if (!(tvc->states & (CVInit|CVFlushed)) && - (tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) + tvc->f.states &= ~(CStatd | CMValid | CUnique); + if (!(tvc->f.states & (CVInit|CVFlushed)) && + (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))) osi_dnlc_purgedp(tvc); } } @@ -307,11 +307,11 @@ afs_FlushCBs(void) for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { tvc->callback = 0; tvc->dchint = NULL; /* invalidate hints */ - tvc->states &= ~(CStatd); + tvc->f.states &= ~(CStatd); if (QPrev(&(tvc->callsort))) QRemove(&(tvc->callsort)); - if (!(tvc->states & (CVInit|CVFlushed)) && - ((tvc->fid.Fid.Vnode & 1) || (vType(tvc) == VDIR))) + if (!(tvc->f.states & (CVInit|CVFlushed)) && + ((tvc->f.fid.Fid.Vnode & 1) || (vType(tvc) == VDIR))) osi_dnlc_purgedp(tvc); } @@ -338,9 +338,9 @@ afs_FlushServerCBs(struct server *srvp) if (tvc->callback == srvp) { tvc->callback = 0; tvc->dchint = NULL; /* invalidate hints */ - tvc->states &= ~(CStatd); - if (!(tvc->states & (CVInit|CVFlushed)) && - ((tvc->fid.Fid.Vnode & 1) || (vType(tvc) == VDIR))) { + tvc->f.states &= ~(CStatd); + if (!(tvc->f.states & (CVInit|CVFlushed)) && + ((tvc->f.fid.Fid.Vnode & 1) || (vType(tvc) == VDIR))) { osi_dnlc_purgedp(tvc); } afs_DequeueCallback(tvc); diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 891f9a6..21483f5 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -874,13 +874,13 @@ afs_BioDaemon(afs_int32 nbiods) if (vcp->v.v_gnode->gn_mwrcnt) { afs_offs_t newlength = (afs_offs_t) dbtob(bp->b_blkno) + bp->b_bcount; - if (vcp->m.Length < newlength) { + if (vcp->f.m.Length < newlength) { afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, ICL_TYPE_STRING, __FILE__, ICL_TYPE_LONG, __LINE__, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(vcp->m.Length), + ICL_HANDLE_OFFSET(vcp->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(newlength)); - vcp->m.Length = newlength; + vcp->f.m.Length = newlength; } } ReleaseWriteLock(&vcp->lock); diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 8f11b9e..681d75f 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -167,9 +167,9 @@ afs_DCGetBucket(struct vcache *avc) return 1; /* This should be replaced with some sort of user configurable function */ - if (avc->states & CRO) { + if (avc->f.states & CRO) { return 2; - } else if (avc->states & CBackup) { + } else if (avc->f.states & CBackup) { return 1; } else { /* RW */ @@ -713,7 +713,7 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) if (((phase & 1) == 0) && osi_Active(tvc)) skip = 1; if (((phase & 1) == 1) && osi_Active(tvc) - && (tvc->states & CDCLock) + && (tvc->f.states & CDCLock) && (chunkFlags & IFAnyPages)) skip = 1; if (chunkFlags & IFDataMod) @@ -748,7 +748,7 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) MObtainWriteLock(&afs_xdcache, 333); chunkFlags = afs_indexFlags[tdc->index]; if (tdc->refCount > 1 || (chunkFlags & IFDataMod) - || (osi_Active(tvc) && (tvc->states & CDCLock) + || (osi_Active(tvc) && (tvc->f.states & CDCLock) && (chunkFlags & IFAnyPages))) { skip = 1; MReleaseWriteLock(&afs_xdcache); @@ -1298,7 +1298,7 @@ afs_TryToSmush(register struct vcache *avc, struct AFS_UCRED *acred, int sync) register int i; AFS_STATCNT(afs_TryToSmush); afs_Trace2(afs_iclSetp, CM_TRACE_TRYTOSMUSH, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); sync = 1; /* XX Temp testing XX */ #if defined(AFS_SUN5_ENV) @@ -1313,14 +1313,14 @@ afs_TryToSmush(register struct vcache *avc, struct AFS_UCRED *acred, int sync) /* * Get the hash chain containing all dce's for this fid */ - i = DVHash(&avc->fid); + i = DVHash(&avc->f.fid); MObtainWriteLock(&afs_xdcache, 277); for (index = afs_dvhashTbl[i]; index != NULLIDX; index = i) { i = afs_dvnextTbl[index]; /* next pointer this hash table */ - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { int releaseTlock = 1; tdc = afs_GetDSlot(index, NULL); - if (!FidCmp(&tdc->f.fid, &avc->fid)) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) { if (sync) { if ((afs_indexFlags[index] & IFDataMod) == 0 && tdc->refCount == 1) { @@ -1378,9 +1378,9 @@ afs_DCacheMissingChunks(struct vcache *avc) afs_uint32 totalChunks = 0; struct dcache *tdc; - totalLength = avc->m.Length; - if (avc->truncPos < totalLength) - totalLength = avc->truncPos; + totalLength = avc->f.m.Length; + if (avc->f.truncPos < totalLength) + totalLength = avc->f.truncPos; /* Length is 0, no chunk missing. */ if (totalLength == 0) @@ -1396,20 +1396,20 @@ afs_DCacheMissingChunks(struct vcache *avc) /* If we're a directory, we only ever have one chunk, regardless of * the size of the dir. */ - if (avc->fid.Fid.Vnode & 1 || vType(avc) == VDIR) + if (avc->f.fid.Fid.Vnode & 1 || vType(avc) == VDIR) totalChunks = 1; /* printf("Should have %d chunks for %u bytes\n", totalChunks, (totalLength + 1)); */ - i = DVHash(&avc->fid); + i = DVHash(&avc->f.fid); MObtainWriteLock(&afs_xdcache, 1001); for (index = afs_dvhashTbl[i]; index != NULLIDX; index = i) { i = afs_dvnextTbl[index]; - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, NULL); - if (!FidCmp(&tdc->f.fid, &avc->fid)) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) { totalChunks--; } ReleaseReadLock(&tdc->tlock); @@ -1457,13 +1457,13 @@ afs_FindDCache(register struct vcache *avc, afs_size_t abyte) * Hash on the [fid, chunk] and get the corresponding dcache index * after write-locking the dcache. */ - i = DCHash(&avc->fid, chunk); + i = DCHash(&avc->f.fid, chunk); MObtainWriteLock(&afs_xdcache, 278); for (index = afs_dchashTbl[i]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, NULL); ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid) && chunk == tdc->f.chunk) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid) && chunk == tdc->f.chunk) { break; /* leaving refCount high for caller */ } afs_PutDCache(tdc); @@ -1525,8 +1525,8 @@ afs_UFSCacheStoreProc(register struct rx_call *acall, struct osi_file *afile, #endif /* AFS_NOSTATS */ afs_Trace4(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc, - ICL_TYPE_FID, &(avc->fid), ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length), ICL_TYPE_INT32, alen); + ICL_TYPE_FID, &(avc->f.fid), ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_INT32, alen); tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ); while (alen > 0) { tlen = (alen > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : alen); @@ -1565,8 +1565,8 @@ afs_UFSCacheStoreProc(register struct rx_call *acall, struct osi_file *afile, } } afs_Trace4(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc, - ICL_TYPE_FID, &(avc->fid), ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length), ICL_TYPE_INT32, alen); + ICL_TYPE_FID, &(avc->f.fid), ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_INT32, alen); osi_FreeLargeSpace(tbuffer); return 0; @@ -1640,7 +1640,7 @@ afs_UFSCacheFetchProc(register struct rx_call *acall, struct osi_file *afile, * We do not do this for AFS file servers because they sometimes * return large negative numbers as the transfer size. */ - if (avc->states & CForeign) { + if (avc->f.states & CForeign) { moredata = length & 0x80000000; length &= ~0x80000000; } else { @@ -1772,10 +1772,10 @@ struct dcache *afs_AllocDCache(struct vcache *avc, tdc->f.fid = *ashFid; else /* Use normal vcache's fid otherwise. */ - tdc->f.fid = avc->fid; - if (avc->states & CRO) + tdc->f.fid = avc->f.fid; + if (avc->f.states & CRO) tdc->f.states = DRO; - else if (avc->states & CBackup) + else if (avc->f.states & CBackup) tdc->f.states = DBackup; else tdc->f.states = DRW; @@ -1836,7 +1836,7 @@ void updateV2DC(int lockVc, struct vcache *v, struct dcache *d, int src) { if (!lockVc || 0 == NBObtainWriteLock(&v->lock, src)) { - if (hsame(v->m.DataVersion, d->f.versionNo) && v->callback) + if (hsame(v->f.m.DataVersion, d->f.versionNo) && v->callback) v->dchint = d; if (lockVc) ReleaseWriteLock(&v->lock); @@ -1901,7 +1901,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * Determine the chunk number and offset within the chunk corresponding * to the desired byte. */ - if (avc->fid.Fid.Vnode & 1) { /* if (vType(avc) == VDIR) */ + if (avc->f.fid.Fid.Vnode & 1) { /* if (vType(avc) == VDIR) */ chunk = 0; } else { chunk = AFS_CHUNK(abyte); @@ -1942,7 +1942,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, dcLocked = (0 == NBObtainSharedLock(&tdc->lock, 601)); if (dcLocked && (tdc->index != NULLIDX) - && !FidCmp(&tdc->f.fid, &avc->fid) && chunk == tdc->f.chunk + && !FidCmp(&tdc->f.fid, &avc->f.fid) && chunk == tdc->f.chunk && !(afs_indexFlags[tdc->index] & (IFFree | IFDiscarded))) { /* got the right one. It might not be the right version, and it * might be fetching, but it's the right dcache entry. @@ -1957,7 +1957,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, MReleaseReadLock(&afs_xdcache); shortcut = 1; - if (hsame(tdc->f.versionNo, avc->m.DataVersion) + if (hsame(tdc->f.versionNo, avc->f.m.DataVersion) && !(tdc->dflags & DFFetching)) { afs_stats_cmperf.dcacheHits++; @@ -2001,14 +2001,14 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * avc->lock(W) if !setLocks || slowPass */ - i = DCHash(&avc->fid, chunk); + i = DCHash(&avc->f.fid, chunk); /* check to make sure our space is fine */ afs_MaybeWakeupTruncateDaemon(); MObtainWriteLock(&afs_xdcache, 280); us = NULLIDX; for (index = afs_dchashTbl[i]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, NULL); ReleaseReadLock(&tdc->tlock); /* @@ -2017,7 +2017,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * avc->lock(W) if !setLocks || slowPass * afs_xdcache(W) */ - if (!FidCmp(&tdc->f.fid, &avc->fid) && chunk == tdc->f.chunk) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid) && chunk == tdc->f.chunk) { /* Move it up in the beginning of the list */ if (afs_dchashTbl[i] != index) { afs_dcnextTbl[us] = afs_dcnextTbl[index]; @@ -2052,11 +2052,11 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, if (afs_discardDCList == NULLIDX && afs_freeDCList == NULLIDX) { while (1) { if (!setLocks) - avc->states |= CDCLock; + avc->f.states |= CDCLock; /* just need slots */ afs_GetDownD(5, (int *)0, afs_DCGetBucket(avc)); if (!setLocks) - avc->states &= ~CDCLock; + avc->f.states &= ~CDCLock; if (afs_discardDCList != NULLIDX || afs_freeDCList != NULLIDX) break; @@ -2086,7 +2086,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, */ afs_dcnextTbl[tdc->index] = afs_dchashTbl[i]; afs_dchashTbl[i] = tdc->index; - i = DVHash(&avc->fid); + i = DVHash(&avc->f.fid); afs_dvnextTbl[tdc->index] = afs_dvhashTbl[i]; afs_dvhashTbl[i] = tdc->index; tdc->dflags = DFEntryMod; @@ -2108,7 +2108,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, afs_Trace4(afs_iclSetp, CM_TRACE_GETDCACHE2, ICL_TYPE_POINTER, avc, ICL_TYPE_POINTER, tdc, ICL_TYPE_INT32, hgetlo(tdc->f.versionNo), ICL_TYPE_INT32, - hgetlo(avc->m.DataVersion)); + hgetlo(avc->f.m.DataVersion)); /* * Here we have the entry in tdc, with its refCount incremented. * Note: we don't use the S-lock on avc; it costs concurrency when @@ -2132,9 +2132,9 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, ICL_TYPE_INT32, aflags, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(abyte), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(Position)); - if ((aflags & 4) && (hiszero(avc->m.DataVersion))) + if ((aflags & 4) && (hiszero(avc->f.m.DataVersion))) doAdjustSize = 1; - if ((AFS_CHUNKTOBASE(chunk) >= avc->m.Length) || + if ((AFS_CHUNKTOBASE(chunk) >= avc->f.m.Length) || ((aflags & 4) && (abyte == Position) && (tlen >= size))) overWriteWholeChunk = 1; if (doAdjustSize || overWriteWholeChunk) { @@ -2151,15 +2151,15 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, if (doAdjustSize) adjustsize = 4096; #endif /* AFS_SGI_ENV */ - if (AFS_CHUNKTOBASE(chunk) + adjustsize >= avc->m.Length && + if (AFS_CHUNKTOBASE(chunk) + adjustsize >= avc->f.m.Length && #else /* defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV) */ #if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) - if ((doAdjustSize || (AFS_CHUNKTOBASE(chunk) >= avc->m.Length)) && + if ((doAdjustSize || (AFS_CHUNKTOBASE(chunk) >= avc->f.m.Length)) && #else - if (AFS_CHUNKTOBASE(chunk) >= avc->m.Length && + if (AFS_CHUNKTOBASE(chunk) >= avc->f.m.Length && #endif #endif /* defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV) */ - !hsame(avc->m.DataVersion, tdc->f.versionNo)) + !hsame(avc->f.m.DataVersion, tdc->f.versionNo)) doReallyAdjustSize = 1; if (doReallyAdjustSize || overWriteWholeChunk) { @@ -2174,7 +2174,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, afs_CFileTruncate(file, 0); afs_CFileClose(file); afs_AdjustSize(tdc, 0); - hset(tdc->f.versionNo, avc->m.DataVersion); + hset(tdc->f.versionNo, avc->f.m.DataVersion); tdc->dflags |= DFEntryMod; ConvertWToSLock(&tdc->lock); @@ -2227,7 +2227,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * avc->lock(W) if !setLocks || slowPass * tdc->lock(S) */ - if (!hsame(avc->m.DataVersion, tdc->f.versionNo) && !overWriteWholeChunk) { + if (!hsame(avc->f.m.DataVersion, tdc->f.versionNo) && !overWriteWholeChunk) { /* * Version number mismatch. */ @@ -2264,7 +2264,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * flush. Clearly, at least, we don't have to flush the file more * often than it changes */ - if (hcmp(avc->flushDV, avc->m.DataVersion) < 0) { + if (hcmp(avc->flushDV, avc->f.m.DataVersion) < 0) { /* * By here, the cache entry is always write-locked. We can * deadlock if we call osi_Flush with the cache entry locked... @@ -2297,7 +2297,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, */ /* Watch for standard race condition around osi_FlushText */ - if (hsame(avc->m.DataVersion, tdc->f.versionNo)) { + if (hsame(avc->f.m.DataVersion, tdc->f.versionNo)) { updateV2DC(setLocks, avc, tdc, 569); /* set hint */ afs_stats_cmperf.dcacheHits++; ConvertWToSLock(&tdc->lock); @@ -2326,12 +2326,12 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, } /* Do not fetch data beyond truncPos. */ - maxGoodLength = avc->m.Length; - if (avc->truncPos < maxGoodLength) - maxGoodLength = avc->truncPos; + maxGoodLength = avc->f.m.Length; + if (avc->f.truncPos < maxGoodLength) + maxGoodLength = avc->f.truncPos; Position = AFS_CHUNKBASE(abyte); if (vType(avc) == VDIR) { - size = avc->m.Length; + size = avc->f.m.Length; if (size > tdc->f.chunkBytes) { /* pre-reserve space for file */ afs_AdjustSize(tdc, size); @@ -2362,7 +2362,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, #else file = afs_CFileOpen(tdc->f.inode); #endif - afs_RemoveVCB(&avc->fid); + afs_RemoveVCB(&avc->f.fid); tdc->f.states |= DWriting; tdc->dflags |= DFFetching; tdc->validPos = Position; /* which is AFS_CHUNKBASE(abyte) */ @@ -2382,7 +2382,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * Remember if we are doing the reading from a replicated volume, * and how many times we've zipped around the fetch/analyze loop. */ - fromReplica = (avc->states & CRO) ? 1 : 0; + fromReplica = (avc->f.states & CRO) ? 1 : 0; numFetchLoops = 0; accP = &(afs_stats_cmfullperf.accessinf); if (fromReplica) @@ -2392,7 +2392,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, #endif /* AFS_NOSTATS */ /* this is a cache miss */ afs_Trace4(afs_iclSetp, CM_TRACE_FETCHPROC, ICL_TYPE_POINTER, avc, - ICL_TYPE_FID, &(avc->fid), ICL_TYPE_OFFSET, + ICL_TYPE_FID, &(avc->f.fid), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(Position), ICL_TYPE_INT32, size); if (size) @@ -2457,7 +2457,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, * tdc->lock(W) */ - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { afs_int32 length_hi, length, bytes; #ifndef AFS_NOSTATS @@ -2485,7 +2485,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, RX_AFS_GUNLOCK(); code = StartRXAFS_FetchData64(tcall, - (struct AFSFid *)&avc->fid. + (struct AFSFid *)&avc->f.fid. Fid, Position, tsize); if (code != 0) { RX_AFS_GLOCK(); @@ -2520,7 +2520,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, tcall = rx_NewCall(tc->id); code = StartRXAFS_FetchData(tcall, (struct AFSFid *) - &avc->fid.Fid, pos, + &avc->f.fid.Fid, pos, size); RX_AFS_GLOCK(); } @@ -2547,7 +2547,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, RX_AFS_GUNLOCK(); code = StartRXAFS_FetchData(tcall, - (struct AFSFid *)&avc->fid.Fid, + (struct AFSFid *)&avc->f.fid.Fid, Position, size); RX_AFS_GLOCK(); if (code == 0) { @@ -2681,10 +2681,10 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, if (!setLocks || slowPass) { ObtainWriteLock(&afs_xcbhash, 453); afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CUnique); + avc->f.states &= ~(CStatd | CUnique); avc->callback = NULL; ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); } else { /* Something lost. Forget about performance, and go @@ -2705,7 +2705,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, } } while (afs_Analyze - (tc, code, &avc->fid, areq, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHDATA, SHARED_LOCK, NULL)); /* @@ -2755,9 +2755,9 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, if (!afs_IsDynroot(avc)) { ObtainWriteLock(&afs_xcbhash, 454); afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CUnique); + avc->f.states &= ~(CStatd | CUnique); ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); /* * Locks held: @@ -2808,7 +2808,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, /* * See if this was a reference to a file in the local cell. */ - if (afs_IsPrimaryCellNum(avc->fid.Cell)) + if (afs_IsPrimaryCellNum(avc->f.fid.Cell)) afs_stats_cmperf.dlocalAccesses++; else afs_stats_cmperf.dremoteAccesses++; @@ -2852,7 +2852,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, */ afs_hyper_t currentDV, statusDV; - hset(currentDV, avc->m.DataVersion); + hset(currentDV, avc->f.m.DataVersion); if (setNewCallback && avc->callback != newCallback) doVcacheUpdate = 1; @@ -2861,7 +2861,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, hset64(statusDV, tsmall->OutStatus.dataVersionHigh, tsmall->OutStatus.DataVersion); - if (setVcacheStatus && avc->m.Length != tsmall->OutStatus.Length) + if (setVcacheStatus && avc->f.m.Length != tsmall->OutStatus.Length) doVcacheUpdate = 1; if (setVcacheStatus && !hsame(currentDV, statusDV)) doVcacheUpdate = 1; @@ -2871,7 +2871,7 @@ afs_GetDCache(register struct vcache *avc, afs_size_t abyte, if (doVcacheUpdate) { ObtainWriteLock(&avc->lock, 615); - if (!hsame(avc->m.DataVersion, currentDV)) { + if (!hsame(avc->f.m.DataVersion, currentDV)) { /* We lose. Someone will beat us to it. */ doVcacheUpdate = 0; ReleaseWriteLock(&avc->lock); @@ -3288,7 +3288,7 @@ afs_wakeup(register struct vcache *avc) * I think this is redundant now because this sort of thing * is already being handled by the higher-level code. */ - if ((avc->states & CSafeStore) == 0) { + if ((avc->f.states & CSafeStore) == 0) { tb->code = 0; tb->flags |= BUVALID; if (tb->flags & BUWAIT) { @@ -3687,7 +3687,7 @@ afs_ObtainDCacheForWriting(struct vcache *avc, afs_size_t filePos, tdc = afs_FindDCache(avc, filePos); if (tdc) { ObtainWriteLock(&tdc->lock, 658); - if (!hsame(tdc->f.versionNo, avc->m.DataVersion) + if (!hsame(tdc->f.versionNo, avc->f.m.DataVersion) || (tdc->dflags & DFFetching)) { ReleaseWriteLock(&tdc->lock); afs_PutDCache(tdc); @@ -3708,7 +3708,7 @@ afs_ObtainDCacheForWriting(struct vcache *avc, afs_size_t filePos, afs_MaybeWakeupTruncateDaemon(); ObtainWriteLock(&avc->lock, 509); } - avc->states |= CDirty; + avc->f.states |= CDirty; tdc = afs_GetDCache(avc, filePos, areq, &offset, &len, 4); if (tdc) ObtainWriteLock(&tdc->lock, 659); @@ -3761,12 +3761,12 @@ int afs_MakeShadowDir(struct vcache *avc, struct dcache *adc) if (vType(avc) != VDIR) return ENOTDIR; - if (avc->shVnode || avc->shUnique) + if (avc->f.shadow.vnode || avc->f.shadow.unique) return EEXIST; /* Generate a fid for the shadow dir. */ - shadow_fid.Cell = avc->fid.Cell; - shadow_fid.Fid.Volume = avc->fid.Fid.Volume; + shadow_fid.Cell = avc->f.fid.Cell; + shadow_fid.Fid.Volume = avc->f.fid.Fid.Volume; afs_GenShadowFid(&shadow_fid); ObtainWriteLock(&afs_xdcache, 716); @@ -3853,8 +3853,8 @@ int afs_MakeShadowDir(struct vcache *avc, struct dcache *adc) ReleaseWriteLock(&afs_disconDirtyLock); ReleaseWriteLock(&afs_xvcache); - avc->shVnode = shadow_fid.Fid.Vnode; - avc->shUnique = shadow_fid.Fid.Unique; + avc->f.shadow.vnode = shadow_fid.Fid.Vnode; + avc->f.shadow.unique = shadow_fid.Fid.Unique; } done: @@ -3873,10 +3873,10 @@ void afs_DeleteShadowDir(struct vcache *avc) struct dcache *tdc; struct VenusFid shadow_fid; - shadow_fid.Cell = avc->fid.Cell; - shadow_fid.Fid.Volume = avc->fid.Fid.Volume; - shadow_fid.Fid.Vnode = avc->shVnode; - shadow_fid.Fid.Unique = avc->shUnique; + shadow_fid.Cell = avc->f.fid.Cell; + shadow_fid.Fid.Volume = avc->f.fid.Fid.Volume; + shadow_fid.Fid.Vnode = avc->f.shadow.vnode; + shadow_fid.Fid.Unique = avc->f.shadow.unique; tdc = afs_FindDCacheByFid(&shadow_fid); if (tdc) { @@ -3884,7 +3884,7 @@ void afs_DeleteShadowDir(struct vcache *avc) afs_DiscardDCache(tdc); afs_PutDCache(tdc); } - avc->shVnode = avc->shUnique = 0; + avc->f.shadow.vnode = avc->f.shadow.unique = 0; ObtainWriteLock(&afs_disconDirtyLock, 708); QRemove(&avc->shadowq); ReleaseWriteLock(&afs_disconDirtyLock); @@ -3912,13 +3912,13 @@ void afs_PopulateDCache(struct vcache *avc, afs_size_t apos, struct vrequest *ar * length we GetDCache for that chunk. */ - if (AFS_CHUNK(apos) == 0 || apos <= avc->m.Length) + if (AFS_CHUNK(apos) == 0 || apos <= avc->f.m.Length) return; - if (avc->m.Length == 0) + if (avc->f.m.Length == 0) start = 0; else - start = AFS_CHUNK(avc->m.Length)+1; + start = AFS_CHUNK(avc->f.m.Length)+1; end = AFS_CHUNK(apos); diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index 72a0080..46554e4 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -18,8 +18,8 @@ RCSID("$Header$"); #ifdef AFS_DISCON_ENV #define dv_match(vc, fstat) \ - ((vc->m.DataVersion.low == fstat.DataVersion) && \ - (vc->m.DataVersion.high == fstat.dataVersionHigh)) + ((vc->f.m.DataVersion.low == fstat.DataVersion) && \ + (vc->f.m.DataVersion.high == fstat.dataVersionHigh)) /*! Circular queue of dirty vcaches */ struct afs_q afs_disconDirty; @@ -103,21 +103,21 @@ struct dcache *afs_FindDCacheByFid(struct VenusFid *afid) */ int afs_GenStoreStatus(struct vcache *avc, struct AFSStoreStatus *astat) { - if (!avc || !astat || !avc->ddirty_flags) + if (!avc || !astat || !avc->f.ddirty_flags) return 0; /* Clean up store stat. */ memset(astat, 0, sizeof(struct AFSStoreStatus)); - if (avc->ddirty_flags & VDisconSetTime) { + if (avc->f.ddirty_flags & VDisconSetTime) { /* Update timestamp. */ - astat->ClientModTime = avc->m.Date; + astat->ClientModTime = avc->f.m.Date; astat->Mask |= AFS_SETMODTIME; } - if (avc->ddirty_flags & VDisconSetMode) { + if (avc->f.ddirty_flags & VDisconSetMode) { /* Copy the mode bits. */ - astat->UnixModeBits = avc->m.Mode; + astat->UnixModeBits = avc->f.m.Mode; astat->Mask |= AFS_SETMODE; } @@ -160,19 +160,19 @@ int afs_GetParentDirFid(struct vcache *avc, struct VenusFid *afid) { struct dcache *tdc; - afid->Cell = avc->fid.Cell; - afid->Fid.Volume = avc->fid.Fid.Volume; + afid->Cell = avc->f.fid.Cell; + afid->Fid.Volume = avc->f.fid.Fid.Volume; switch (vType(avc)) { case VREG: case VLNK: /* Normal files have the dir fid embedded in the vcache. */ - afid->Fid.Vnode = avc->parentVnode; - afid->Fid.Unique = avc->parentUnique; + afid->Fid.Vnode = avc->f.parent.vnode; + afid->Fid.Unique = avc->f.parent.unique; break; case VDIR: /* If dir or parent dir created locally*/ - tdc = afs_FindDCacheByFid(&avc->fid); + tdc = afs_FindDCacheByFid(&avc->f.fid); if (tdc) { afid->Fid.Unique = 0; /* Lookup each entry for the fid. It should be the first. */ @@ -251,12 +251,12 @@ int afs_GetVnodeName(struct vcache *avc, /* For deleted files, get the shadow dir's tdc: */ /* Get the parent dir's vcache that contains the shadow fid. */ - parent_fid.Cell = avc->fid.Cell; - parent_fid.Fid.Volume = avc->fid.Fid.Volume; - if (avc->ddirty_flags & VDisconRename) { + parent_fid.Cell = avc->f.fid.Cell; + parent_fid.Fid.Volume = avc->f.fid.Fid.Volume; + if (avc->f.ddirty_flags & VDisconRename) { /* For renames the old dir fid is needed. */ - parent_fid.Fid.Vnode = avc->oldVnode; - parent_fid.Fid.Unique = avc->oldUnique; + parent_fid.Fid.Vnode = avc->f.oldParent.vnode; + parent_fid.Fid.Unique = avc->f.oldParent.unique; } else { parent_fid.Fid.Vnode = afid->Fid.Vnode; parent_fid.Fid.Unique = afid->Fid.Unique; @@ -270,10 +270,10 @@ int afs_GetVnodeName(struct vcache *avc, return ENOENT; } - shadow_fid.Cell = parent_vc->fid.Cell; - shadow_fid.Fid.Volume = parent_vc->fid.Fid.Volume; - shadow_fid.Fid.Vnode = parent_vc->shVnode; - shadow_fid.Fid.Unique = parent_vc->shUnique; + shadow_fid.Cell = parent_vc->f.fid.Cell; + shadow_fid.Fid.Volume = parent_vc->f.fid.Fid.Volume; + shadow_fid.Fid.Vnode = parent_vc->f.shadow.vnode; + shadow_fid.Fid.Unique = parent_vc->f.shadow.unique; afs_PutVCache(parent_vc); @@ -287,7 +287,7 @@ int afs_GetVnodeName(struct vcache *avc, } /* if (deleted) */ if (tdc) { - tnf.fid = &avc->fid; + tnf.fid = &avc->f.fid; tnf.name_len = -1; tnf.name = aname; afs_dir_EnumerateDir(tdc, &get_vnode_name_hook, &tnf); @@ -330,8 +330,8 @@ int chk_del_children_hook(void *hdata, return 0; /* Get this file's vcache. */ - tfid.Cell = v->vc->fid.Cell; - tfid.Fid.Volume = v->vc->fid.Fid.Volume; + tfid.Cell = v->vc->f.fid.Cell; + tfid.Fid.Volume = v->vc->f.fid.Fid.Volume; tfid.Fid.Vnode = vnode; tfid.Fid.Unique = unique; @@ -342,7 +342,7 @@ int chk_del_children_hook(void *hdata, /* Count unfinished dirty children. */ if (tvc) { ObtainReadLock(&tvc->lock); - if (tvc->ddirty_flags || tvc->shVnode) + if (tvc->f.ddirty_flags || tvc->f.shadow.vnode) v->count++; ReleaseReadLock(&tvc->lock); @@ -366,14 +366,14 @@ int afs_CheckDeletedChildren(struct vcache *avc) struct DirtyChildrenCount dcc; struct VenusFid shadow_fid; - if (!avc->shVnode) + if (!avc->f.shadow.vnode) /* Empty dir. */ return 0; - shadow_fid.Cell = avc->fid.Cell; - shadow_fid.Fid.Volume = avc->fid.Fid.Volume; - shadow_fid.Fid.Vnode = avc->shVnode; - shadow_fid.Fid.Unique = avc->shUnique; + shadow_fid.Cell = avc->f.fid.Cell; + shadow_fid.Fid.Volume = avc->f.fid.Fid.Volume; + shadow_fid.Fid.Vnode = avc->f.shadow.vnode; + shadow_fid.Fid.Unique = avc->f.shadow.unique; dcc.count = 0; @@ -422,8 +422,8 @@ int fix_children_fids_hook(void *hdata, /* Change the fields. */ if (tvc) { - tvc->parentVnode = afid->Fid.Vnode; - tvc->parentUnique = afid->Fid.Unique; + tvc->f.parent.vnode = afid->Fid.Vnode; + tvc->f.parent.unique = afid->Fid.Unique; afs_PutVCache(tvc); } @@ -526,7 +526,7 @@ afs_GetParentVCache(struct vcache *avc, int deleted, struct VenusFid *afid, goto end; } - if ((*adp)->ddirty_flags & VDisconCreate) { + if ((*adp)->f.ddirty_flags & VDisconCreate) { printf("afs_GetParentVCache: deferring until parent exists\n"); code = EAGAIN; goto end; @@ -556,10 +556,10 @@ int afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) XSTATS_DECLS; /* Get old dir vcache. */ - old_pdir_fid.Cell = avc->fid.Cell; - old_pdir_fid.Fid.Volume = avc->fid.Fid.Volume; - old_pdir_fid.Fid.Vnode = avc->oldVnode; - old_pdir_fid.Fid.Unique = avc->oldUnique; + old_pdir_fid.Cell = avc->f.fid.Cell; + old_pdir_fid.Fid.Volume = avc->f.fid.Fid.Volume; + old_pdir_fid.Fid.Vnode = avc->f.oldParent.vnode; + old_pdir_fid.Fid.Unique = avc->f.oldParent.unique; /* Get old name. */ old_name = (char *) afs_osi_Alloc(AFSNAMEMAX); @@ -581,7 +581,7 @@ int afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) goto done; } - if (avc->ddirty_flags & VDisconRenameSameDir) { + if (avc->f.ddirty_flags & VDisconRenameSameDir) { /* If we're in the same dir, don't do the lookups all over again, * just copy fid and vcache from the old dir. */ @@ -710,14 +710,14 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, /* Set status. */ InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP; - InStatus.ClientModTime = avc->m.Date; - InStatus.Owner = avc->m.Owner; + InStatus.ClientModTime = avc->f.m.Date; + InStatus.Owner = avc->f.m.Owner; InStatus.Group = (afs_int32) acred->cr_gid; /* Only care about protection bits. */ - InStatus.UnixModeBits = avc->m.Mode & 0xffff; + InStatus.UnixModeBits = avc->f.m.Mode & 0xffff; do { - tc = afs_Conn(&tdp->fid, areq, SHARED_LOCK); + tc = afs_Conn(&tdp->f.fid, areq, SHARED_LOCK); if (tc) { switch (vType(avc)) { case VREG: @@ -726,7 +726,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, XSTATS_START_TIME(op); RX_AFS_GUNLOCK(); code = RXAFS_CreateFile(tc->id, - (struct AFSFid *)&tdp->fid.Fid, + (struct AFSFid *)&tdp->f.fid.Fid, tname, &InStatus, (struct AFSFid *) &newFid.Fid, &OutFidStatus, &OutDirStatus, @@ -739,7 +739,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, op = AFS_STATS_FS_RPCIDX_MAKEDIR; XSTATS_START_TIME(op); RX_AFS_GUNLOCK(); - code = RXAFS_MakeDir(tc->id, (struct AFSFid *) &tdp->fid.Fid, + code = RXAFS_MakeDir(tc->id, (struct AFSFid *) &tdp->f.fid.Fid, tname, &InStatus, (struct AFSFid *) &newFid.Fid, &OutFidStatus, &OutDirStatus, @@ -753,7 +753,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, XSTATS_START_TIME(op); RX_AFS_GUNLOCK(); code = RXAFS_Symlink(tc->id, - (struct AFSFid *) &tdp->fid.Fid, + (struct AFSFid *) &tdp->f.fid.Fid, tname, ttargetName, &InStatus, (struct AFSFid *) &newFid.Fid, &OutFidStatus, &OutDirStatus, &tsync); @@ -767,7 +767,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, } } else code = -1; - } while (afs_Analyze(tc, code, &tdp->fid, areq, op, SHARED_LOCK, NULL)); + } while (afs_Analyze(tc, code, &tdp->f.fid, areq, op, SHARED_LOCK, NULL)); /* TODO: Handle errors. */ if (code) { @@ -776,17 +776,17 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, } /* The rpc doesn't set the cell number. */ - newFid.Cell = avc->fid.Cell; + newFid.Cell = avc->f.fid.Cell; /* * Change the fid in the dir entry. */ /* Seek the dir's dcache. */ - tdc = afs_FindDCacheByFid(&tdp->fid); + tdc = afs_FindDCacheByFid(&tdp->f.fid); if (tdc) { /* And now change the fid in the parent dir entry. */ - afs_dir_ChangeFid(tdc, tname, &avc->fid.Fid.Vnode, &newFid.Fid.Vnode); + afs_dir_ChangeFid(tdc, tname, &avc->f.fid.Fid.Vnode, &newFid.Fid.Vnode); afs_PutDCache(tdc); } @@ -794,15 +794,16 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, /* Change fid in the dir for the "." entry. ".." has alredy been * handled by afs_FixChildrenFids when processing the parent dir. */ - tdc = afs_FindDCacheByFid(&avc->fid); + tdc = afs_FindDCacheByFid(&avc->f.fid); if (tdc) { - afs_dir_ChangeFid(tdc, ".", &avc->fid.Fid.Vnode, &newFid.Fid.Vnode); + afs_dir_ChangeFid(tdc, ".", &avc->f.fid.Fid.Vnode, + &newFid.Fid.Vnode); - if (avc->m.LinkCount >= 2) - /* For non empty dirs, fix children's parentVnode and parentUnique - * reference. + if (avc->f.m.LinkCount >= 2) + /* For non empty dirs, fix children's parentVnode and + * parentUnique reference. */ - afs_FixChildrenFids(&avc->fid, &newFid); + afs_FixChildrenFids(&avc->f.fid, &newFid); afs_PutDCache(tdc); } @@ -816,7 +817,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, ObtainWriteLock(&afs_xvcache, 735); /* Old fid hash. */ - hash = VCHash(&avc->fid); + hash = VCHash(&avc->f.fid); /* New fid hash. */ new_hash = VCHash(&newFid); @@ -846,14 +847,14 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, ReleaseWriteLock(&afs_xvcache); /* Do the same thing for all dcaches. */ - hash = DVHash(&avc->fid); + hash = DVHash(&avc->f.fid); ObtainWriteLock(&afs_xdcache, 743); for (index = afs_dvhashTbl[hash]; index != NULLIDX; index = hash) { hash = afs_dvnextTbl[index]; tdc = afs_GetDSlot(index, NULL); ReleaseReadLock(&tdc->tlock); - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { - if (!FidCmp(&tdc->f.fid, &avc->fid)) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) { /* Safer but slower. */ afs_HashOutDCache(tdc, 0); @@ -877,7 +878,7 @@ int afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, ReleaseWriteLock(&afs_xdcache); /* Now we can set the new fid. */ - memcpy(&avc->fid, &newFid, sizeof(struct VenusFid)); + memcpy(&avc->f.fid, &newFid, sizeof(struct VenusFid)); end: if (tdp) @@ -1011,18 +1012,18 @@ int afs_SendChanges(struct vcache *avc, struct vrequest *areq) XSTATS_DECLS; /* Start multiplexing dirty operations from ddirty_flags field: */ - if (avc->ddirty_flags & VDisconSetAttrMask) { + if (avc->f.ddirty_flags & VDisconSetAttrMask) { /* Setattr OPS: */ /* Turn dirty vc data into a new store status... */ if (afs_GenStoreStatus(avc, &sstat) > 0) { do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { /* ... and send it. */ XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STORESTATUS); RX_AFS_GUNLOCK(); code = RXAFS_StoreStatus(tc->id, - (struct AFSFid *) &avc->fid.Fid, + (struct AFSFid *) &avc->f.fid.Fid, &sstat, &fstat, &tsync); @@ -1034,7 +1035,7 @@ int afs_SendChanges(struct vcache *avc, struct vrequest *areq) } while (afs_Analyze(tc, code, - &avc->fid, + &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STORESTATUS, SHARED_LOCK, @@ -1046,7 +1047,7 @@ int afs_SendChanges(struct vcache *avc, struct vrequest *areq) if (code) return code; - if (avc->ddirty_flags & + if (avc->f.ddirty_flags & (VDisconTrunc | VDisconWriteClose | VDisconWriteFlush @@ -1054,14 +1055,14 @@ int afs_SendChanges(struct vcache *avc, struct vrequest *areq) /* Truncate OP: */ do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { /* Set storing flags. XXX: A tad inefficient ... */ - if (avc->ddirty_flags & VDisconWriteClose) + if (avc->f.ddirty_flags & VDisconWriteClose) flags |= AFS_LASTSTORE; - if (avc->ddirty_flags & VDisconWriteOsiFlush) + if (avc->f.ddirty_flags & VDisconWriteOsiFlush) flags |= (AFS_SYNC | AFS_LASTSTORE); - if (avc->ddirty_flags & VDisconWriteFlush) + if (avc->f.ddirty_flags & VDisconWriteFlush) flags |= AFS_SYNC; /* Try to send store to server. */ @@ -1072,7 +1073,7 @@ int afs_SendChanges(struct vcache *avc, struct vrequest *areq) } while (afs_Analyze(tc, code, - &avc->fid, + &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK, @@ -1120,7 +1121,7 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) /* Get local write lock. */ ObtainWriteLock(&tvc->lock, 705); - if (tvc->ddirty_flags & VDisconRemove) { + if (tvc->f.ddirty_flags & VDisconRemove) { /* Delete the file on the server and just move on * to the next file. After all, it has been deleted * we can't replay any other operation it. @@ -1128,24 +1129,24 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) code = afs_ProcessOpRemove(tvc, areq); goto next_file; - } else if (tvc->ddirty_flags & VDisconCreate) { + } else if (tvc->f.ddirty_flags & VDisconCreate) { /* For newly created files, we don't need a server lock. */ code = afs_ProcessOpCreate(tvc, areq, acred); if (code) goto next_file; - tvc->ddirty_flags &= ~VDisconCreate; - tvc->ddirty_flags |= VDisconCreated; + tvc->f.ddirty_flags &= ~VDisconCreate; + tvc->f.ddirty_flags |= VDisconCreated; } /* Get server write lock. */ do { - tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETLOCK); RX_AFS_GUNLOCK(); code = RXAFS_SetLock(tc->id, - (struct AFSFid *)&tvc->fid.Fid, + (struct AFSFid *)&tvc->f.fid.Fid, LockWrite, &tsync); RX_AFS_GLOCK(); @@ -1155,7 +1156,7 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) } while (afs_Analyze(tc, code, - &tvc->fid, + &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_SETLOCK, SHARED_LOCK, @@ -1164,7 +1165,7 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) if (code) goto next_file; - if (tvc->ddirty_flags & VDisconRename) { + if (tvc->f.ddirty_flags & VDisconRename) { /* If we're renaming the file, do so now */ code = afs_ProcessOpRename(tvc, areq); if (code) @@ -1173,14 +1174,14 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) /* Issue a FetchStatus to get info about DV and callbacks. */ do { - tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); if (tc) { tvc->callback = tc->srvr->server; start = osi_Time(); XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHSTATUS); RX_AFS_GUNLOCK(); code = RXAFS_FetchStatus(tc->id, - (struct AFSFid *)&tvc->fid.Fid, + (struct AFSFid *)&tvc->f.fid.Fid, &fstat, &callback, &tsync); @@ -1191,7 +1192,7 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) } while (afs_Analyze(tc, code, - &tvc->fid, + &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, SHARED_LOCK, @@ -1201,9 +1202,9 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) goto unlock_srv_file; } - if ((dv_match(tvc, fstat) && (tvc->m.Date == fstat.ServerModTime)) || + if ((dv_match(tvc, fstat) && (tvc->f.m.Date == fstat.ServerModTime)) || (afs_ConflictPolicy == CLIENT_WINS) || - (tvc->ddirty_flags & VDisconCreated)) { + (tvc->f.ddirty_flags & VDisconCreated)) { /* * Send changes to the server if there's data version match, or * client wins policy has been selected or file has been created @@ -1213,14 +1214,14 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) * XXX: Checking server attr changes by timestamp might not the * most elegant solution, but it's the most viable one that we could find. */ - afs_UpdateStatus(tvc, &tvc->fid, areq, &fstat, &callback, start); + afs_UpdateStatus(tvc, &tvc->f.fid, areq, &fstat, &callback, start); code = afs_SendChanges(tvc, areq); } else if (afs_ConflictPolicy == SERVER_WINS) { /* DV mismatch, apply collision resolution policy. */ /* Discard this files chunks and remove from current dir. */ afs_ResetVCache(tvc, acred); - tvc->truncPos = AFS_NOTRUNC; + tvc->f.truncPos = AFS_NOTRUNC; } else { printf("afs_ResyncDisconFiles: no resolution policy selected.\n"); } /* if DV match or client wins policy */ @@ -1228,12 +1229,12 @@ int afs_ResyncDisconFiles(struct vrequest *areq, struct AFS_UCRED *acred) unlock_srv_file: /* Release server write lock. */ do { - tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RELEASELOCK); RX_AFS_GUNLOCK(); ucode = RXAFS_ReleaseLock(tc->id, - (struct AFSFid *) &tvc->fid.Fid, + (struct AFSFid *) &tvc->f.fid.Fid, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; @@ -1241,7 +1242,7 @@ unlock_srv_file: ucode = -1; } while (afs_Analyze(tc, ucode, - &tvc->fid, + &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_RELEASELOCK, SHARED_LOCK, @@ -1252,7 +1253,7 @@ next_file: if (code == 0) { /* Replayed successfully - pull the vcache from the * disconnected list */ - tvc->ddirty_flags = 0; + tvc->f.ddirty_flags = 0; QRemove(&tvc->dirtyq); afs_PutVCache(tvc); } else { @@ -1263,7 +1264,8 @@ next_file: QAdd(&afs_disconDirty, &tvc->dirtyq); } else { /* Failed - keep state as is, and let the user know we died */ - ReleaseWriteLock(&tvc->lock); + + ReleaseWriteLock(&tvc->lock); break; } } @@ -1308,8 +1310,8 @@ afs_DisconDiscardAllShadows(int squash, struct AFS_UCRED *acred) { ObtainWriteLock(&tvc->lock, 706); afs_DeleteShadowDir(tvc); - tvc->shVnode = 0; - tvc->shUnique = 0; + tvc->f.shadow.vnode = 0; + tvc->f.shadow.unique = 0; if (squash) afs_ResetVCache(tvc, acred); @@ -1340,7 +1342,7 @@ afs_DisconDiscardAll(struct AFS_UCRED *acred) { ObtainWriteLock(&tvc->lock, 718); afs_ResetVCache(tvc, acred); - tvc->truncPos = AFS_NOTRUNC; + tvc->f.truncPos = AFS_NOTRUNC; ReleaseWriteLock(&tvc->lock); afs_PutVCache(tvc); ObtainWriteLock(&afs_disconDirtyLock, 719); @@ -1369,10 +1371,10 @@ void afs_DbgDisconFiles() tvc = QEntry(q, struct vcache, dirtyq); printf("Cell=%u Volume=%u VNode=%u Unique=%u\n", - tvc->fid.Cell, - tvc->fid.Fid.Volume, - tvc->fid.Fid.Vnode, - tvc->fid.Fid.Unique); + tvc->f.fid.Cell, + tvc->f.fid.Fid.Volume, + tvc->f.fid.Fid.Vnode, + tvc->f.fid.Fid.Unique); i++; if (i >= 30) @@ -1398,6 +1400,7 @@ void afs_GenShadowFid(struct VenusFid *afid) /* Try generating a fid that isn't used in the vhash. */ do { + /* Shadow Fids are always directories */ afid->Fid.Vnode = afs_DisconVnode + 1; i = DVHash(afid); @@ -1455,8 +1458,8 @@ void afs_GenFakeFid(struct VenusFid *afid, afs_uint32 avtype, int lock) ObtainWriteLock(&afs_xvcache, 736); i = VCHash(afid); for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { - if (tvc->fid.Fid.Unique > max_unique) - max_unique = tvc->fid.Fid.Unique; + if (tvc->f.fid.Fid.Unique > max_unique) + max_unique = tvc->f.fid.Fid.Unique; } if (lock) ReleaseWriteLock(&afs_xvcache); @@ -1483,48 +1486,48 @@ void afs_GenDisconStatus(struct vcache *adp, struct vcache *avc, struct VenusFid *afid, struct vattr *attrs, struct vrequest *areq, int file_type) { - memcpy(&avc->fid, afid, sizeof(struct VenusFid)); - avc->m.Mode = attrs->va_mode; + memcpy(&avc->f.fid, afid, sizeof(struct VenusFid)); + avc->f.m.Mode = attrs->va_mode; /* Used to do this: - * avc->m.Owner = attrs->va_uid; + * avc->f.m.Owner = attrs->va_uid; * But now we use the parent dir's ownership, * there's no other way to get a server owner id. * XXX: Does it really matter? */ - avc->m.Group = adp->m.Group; - avc->m.Owner = adp->m.Owner; - hset64(avc->m.DataVersion, 0, 0); - avc->m.Length = attrs->va_size; - avc->m.Date = osi_Time(); + avc->f.m.Group = adp->f.m.Group; + avc->f.m.Owner = adp->f.m.Owner; + hset64(avc->f.m.DataVersion, 0, 0); + avc->f.m.Length = attrs->va_size; + avc->f.m.Date = osi_Time(); switch(file_type) { case VREG: vSetType(avc, VREG); - avc->m.Mode |= S_IFREG; - avc->m.LinkCount = 1; - avc->parentVnode = adp->fid.Fid.Vnode; - avc->parentUnique = adp->fid.Fid.Unique; + avc->f.m.Mode |= S_IFREG; + avc->f.m.LinkCount = 1; + avc->f.parent.vnode = adp->f.fid.Fid.Vnode; + avc->f.parent.unique = adp->f.fid.Fid.Unique; break; case VDIR: vSetType(avc, VDIR); - avc->m.Mode |= S_IFDIR; - avc->m.LinkCount = 2; + avc->f.m.Mode |= S_IFDIR; + avc->f.m.LinkCount = 2; break; case VLNK: vSetType(avc, VLNK); - avc->m.Mode |= S_IFLNK; - if ((avc->m.Mode & 0111) == 0) + avc->f.m.Mode |= S_IFLNK; + if ((avc->f.m.Mode & 0111) == 0) avc->mvstat = 1; - avc->parentVnode = adp->fid.Fid.Vnode; - avc->parentUnique = adp->fid.Fid.Unique; + avc->f.parent.vnode = adp->f.fid.Fid.Vnode; + avc->f.parent.unique = adp->f.fid.Fid.Unique; break; default: break; } - avc->anyAccess = adp->anyAccess; + avc->f.anyAccess = adp->f.anyAccess; afs_AddAxs(avc->Access, areq->uid, adp->Access->axess); avc->callback = NULL; - avc->states |= CStatd; - avc->states &= ~CBulkFetching; + avc->f.states |= CStatd; + avc->f.states &= ~CBulkFetching; } #endif diff --git a/src/afs/afs_dynroot.c b/src/afs/afs_dynroot.c index 9c846aa..98b82af 100644 --- a/src/afs/afs_dynroot.c +++ b/src/afs/afs_dynroot.c @@ -168,19 +168,19 @@ afs_GetDynrootMountFid(struct VenusFid *fid) int afs_IsDynroot(struct vcache *avc) { - return afs_IsDynrootFid(&avc->fid); + return afs_IsDynrootFid(&avc->f.fid); } int afs_IsDynrootMount(struct vcache *avc) { - return afs_IsDynrootMountFid(&avc->fid); + return afs_IsDynrootMountFid(&avc->f.fid); } int afs_IsDynrootAny(struct vcache *avc) { - return afs_IsDynrootAnyFid(&avc->fid); + return afs_IsDynrootAnyFid(&avc->f.fid); } /* @@ -295,7 +295,7 @@ afs_DynrootInvalidate(void) ReleaseReadLock(&afs_xvcache); } while (retry); if (tvc) { - tvc->states &= ~(CStatd | CUnique); + tvc->f.states &= ~(CStatd | CUnique); osi_dnlc_purgedp(tvc); afs_PutVCache(tvc); } @@ -598,7 +598,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) { char *bp, tbuf[CVBS]; - if (_afs_IsDynrootFid(&avc->fid)) { + if (_afs_IsDynrootFid(&avc->f.fid)) { if (!afs_dynrootEnable) return 0; afs_GetDynroot(0, 0, status); @@ -615,8 +615,8 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) /* * Check if this is an entry under /afs, e.g. /afs/cellname. */ - if (avc->fid.Cell == afs_dynrootCell - && avc->fid.Fid.Volume == AFS_DYNROOT_VOLUME) { + if (avc->f.fid.Cell == afs_dynrootCell + && avc->f.fid.Fid.Volume == AFS_DYNROOT_VOLUME) { struct cell *c; struct cell_alias *ca; @@ -632,9 +632,9 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) status->ParentVnode = 1; status->ParentUnique = 1; - if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) == VN_TYPE_SYMLINK) { + if (VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode) == VN_TYPE_SYMLINK) { struct afs_dynSymlink *ts; - int index = VNUM_TO_VNID(avc->fid.Fid.Vnode); + int index = VNUM_TO_VNID(avc->f.fid.Fid.Vnode); ObtainReadLock(&afs_dynSymlinkLock); ts = afs_dynSymlinkBase; @@ -657,18 +657,18 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) return ts ? 1 : 0; } - if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_CELL - && VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_ALIAS - && VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_MOUNT) { + if (VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode) != VN_TYPE_CELL + && VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode) != VN_TYPE_ALIAS + && VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode) != VN_TYPE_MOUNT) { afs_warn("dynroot vnode inconsistency, unknown VNTYPE %d\n", - VNUM_TO_VNTYPE(avc->fid.Fid.Vnode)); + VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode)); return 0; } - cellidx = VNUM_TO_CIDX(avc->fid.Fid.Vnode); - rw = VNUM_TO_RW(avc->fid.Fid.Vnode); + cellidx = VNUM_TO_CIDX(avc->f.fid.Fid.Vnode); + rw = VNUM_TO_RW(avc->f.fid.Fid.Vnode); - if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) == VN_TYPE_ALIAS) { + if (VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode) == VN_TYPE_ALIAS) { char *realName; ca = afs_GetCellAlias(cellidx); @@ -699,7 +699,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) status->UnixModeBits = 0755; afs_PutCellAlias(ca); - } else if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) == VN_TYPE_MOUNT) { + } else if (VNUM_TO_VNTYPE(avc->f.fid.Fid.Vnode) == VN_TYPE_MOUNT) { c = afs_GetCellByIndex(cellidx, READ_LOCK); if (!c) { afs_warn("dynroot vnode inconsistency, can't find cell %d\n", @@ -711,7 +711,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) * linkData needs to contain "%cell:volumeid" */ namelen = strlen(c->cellName); - bp = afs_cv2string(&tbuf[CVBS], avc->fid.Fid.Unique); + bp = afs_cv2string(&tbuf[CVBS], avc->f.fid.Fid.Unique); linklen = 2 + namelen + strlen(bp); avc->linkData = afs_osi_Alloc(linklen + 1); strcpy(avc->linkData, "%"); diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index d1fa23b..9ea744a 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -389,7 +389,7 @@ afs_MemCacheStoreProc(register struct rx_call *acall, /* for now, only do 'continue from close' code if file fits in one * chunk. Could clearly do better: if only one modified chunk * then can still do this. can do this on *last* modified chunk */ - tlen = avc->m.Length - 1; /* byte position of last byte we'll store */ + tlen = avc->f.m.Length - 1; /* byte position of last byte we'll store */ if (shouldWake) { if (AFS_CHUNK(tlen) != 0) *shouldWake = 0; @@ -494,7 +494,7 @@ afs_MemCacheFetchProc(register struct rx_call *acall, * We do not do this for AFS file servers because they sometimes * return large negative numbers as the transfer size. */ - if (avc->states & CForeign) { + if (avc->f.states & CForeign) { moredata = length & 0x80000000; length &= ~0x80000000; } else { diff --git a/src/afs/afs_nfsdisp.c b/src/afs/afs_nfsdisp.c index 2b45437..59e441e 100644 --- a/src/afs/afs_nfsdisp.c +++ b/src/afs/afs_nfsdisp.c @@ -333,12 +333,12 @@ afs_nfs2_smallfidder(struct nfsdiropres *dr) struct cell *tcell; /* Make up and copy out a SmallFid */ - tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK); - Sfid.Volume = vcp->fid.Fid.Volume; + tcell = afs_GetCell(vcp->f.fid.Cell, READ_LOCK); + Sfid.Volume = vcp->f.fid.Fid.Volume; Sfid.CellAndUnique = - ((tcell->cellIndex << 24) | (vcp->fid.Fid.Unique & 0xffffff)); + ((tcell->cellIndex << 24) | (vcp->f.fid.Fid.Unique & 0xffffff)); afs_PutCell(tcell, READ_LOCK); - Sfid.Vnode = (u_short) (vcp->fid.Fid.Vnode & 0xffff); + Sfid.Vnode = (u_short) (vcp->f.fid.Fid.Vnode & 0xffff); fhp->fh_len = SIZEOF_SMALLFID; memcpy(dr->dr_fhandle.fh_data, (char *)&Sfid, fhp->fh_len); @@ -1115,12 +1115,12 @@ afs_nfs3_smallfidder(struct nfs_fh3 *fhp, int status) struct cell *tcell; /* Make up and copy out a SmallFid */ - tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK); - Sfid.Volume = vcp->fid.Fid.Volume; + tcell = afs_GetCell(vcp->f.fid.Cell, READ_LOCK); + Sfid.Volume = vcp->f.fid.Fid.Volume; Sfid.CellAndUnique = - ((tcell->cellIndex << 24) | (vcp->fid.Fid.Unique & 0xffffff)); + ((tcell->cellIndex << 24) | (vcp->f.fid.Fid.Unique & 0xffffff)); afs_PutCell(tcell, READ_LOCK); - Sfid.Vnode = (u_short) (vcp->fid.Fid.Vnode & 0xffff); + Sfid.Vnode = (u_short) (vcp->f.fid.Fid.Vnode & 0xffff); fhp->fh3_len = SIZEOF_SMALLFID; memcpy(fhp->fh3_data, (char *)&Sfid, fhp->fh3_len); diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 2b41f7d..378f6d4 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -100,7 +100,7 @@ struct afs_osi_WaitHandle { #define osi_GetFileRock(x) ((x)->rock) #ifdef AFS_TEXT_ENV -#define osi_FlushText(vp) if (hcmp((vp)->m.DataVersion, (vp)->flushDV) > 0) \ +#define osi_FlushText(vp) if (hcmp((vp)->f.m.DataVersion, (vp)->flushDV) > 0) \ osi_FlushText_really(vp) #else #define osi_FlushText(vp) @@ -127,7 +127,7 @@ struct afs_osi_WaitHandle { #if defined(AFS_DARWIN80_ENV) #define vType(vc) vnode_vtype(AFSTOV(vc)) #define vSetVfsp(vc, vfsp) -#define vSetType(vc, type) (vc)->m.Type = (type) +#define vSetType(vc, type) (vc)->f.m.Type = (type) extern int afs_vfs_typenum; #define SetAfsVnode(vn) /* nothing; done in getnewvnode() */ #define IsAfsVnode(v) (vfs_typenum(vnode_mount((v))) == afs_vfs_typenum) diff --git a/src/afs/afs_osi_vm.c b/src/afs/afs_osi_vm.c index ccd4efd..37e72e3 100644 --- a/src/afs/afs_osi_vm.c +++ b/src/afs/afs_osi_vm.c @@ -25,7 +25,7 @@ osi_Active(register struct vcache *avc) { AFS_STATCNT(osi_Active); #if defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - if ((avc->opens > 0) || (avc->states & CMAPPED)) + if ((avc->opens > 0) || (avc->f.states & CMAPPED)) return 1; /* XXX: Warning, verify this XXX */ #elif defined(AFS_SGI_ENV) if ((avc->opens > 0) || AFS_VN_MAPPED(AFSTOV(avc))) @@ -65,7 +65,7 @@ osi_FlushPages(register struct vcache *avc, struct AFS_UCRED *credp) /* If we've already purged this version, or if we're the ones * writing this version, don't flush it (could lose the * data we're writing). */ - if ((hcmp((avc->m.DataVersion), (avc->mapDV)) <= 0) + if ((hcmp((avc->f.m.DataVersion), (avc->mapDV)) <= 0) || ((avc->execsOrWriters > 0) && afs_DirtyPages(avc))) { ReleaseReadLock(&avc->lock); return; @@ -73,21 +73,21 @@ osi_FlushPages(register struct vcache *avc, struct AFS_UCRED *credp) ReleaseReadLock(&avc->lock); ObtainWriteLock(&avc->lock, 10); /* Check again */ - if ((hcmp((avc->m.DataVersion), (avc->mapDV)) <= 0) + if ((hcmp((avc->f.m.DataVersion), (avc->mapDV)) <= 0) || ((avc->execsOrWriters > 0) && afs_DirtyPages(avc))) { ReleaseWriteLock(&avc->lock); return; } if (hiszero(avc->mapDV)) { - hset(avc->mapDV, avc->m.DataVersion); + hset(avc->mapDV, avc->f.m.DataVersion); ReleaseWriteLock(&avc->lock); return; } AFS_STATCNT(osi_FlushPages); - hset(origDV, avc->m.DataVersion); + hset(origDV, avc->f.m.DataVersion); afs_Trace3(afs_iclSetp, CM_TRACE_FLUSHPAGES, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, origDV.low, ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_INT32, origDV.low, ICL_TYPE_INT32, avc->f.m.Length); ReleaseWriteLock(&avc->lock); #ifdef AFS_FBSD70_ENV @@ -127,11 +127,11 @@ osi_FlushText_really(register struct vcache *vp) AFS_STATCNT(osi_FlushText); /* see if we've already flushed this data version */ - if (hcmp(vp->m.DataVersion, vp->flushDV) <= 0) + if (hcmp(vp->f.m.DataVersion, vp->flushDV) <= 0) return; MObtainWriteLock(&afs_ftf, 317); - hset(fdv, vp->m.DataVersion); + hset(fdv, vp->f.m.DataVersion); /* why this disgusting code below? * xuntext, called by xrele, doesn't notice when it is called @@ -232,7 +232,7 @@ osi_VMDirty_p(struct vcache *avc) #endif /* AFS_AIX32_ENV */ #if defined (AFS_SUN5_ENV) - if (avc->states & CMAPPED) { + if (avc->f.states & CMAPPED) { struct page *pg; for (pg = avc->v.v_s.v_Pages; pg; pg = pg->p_vpnext) { if (pg->p_mod) { diff --git a/src/afs/afs_osidnlc.c b/src/afs/afs_osidnlc.c index 9a2fa26..26763ad 100644 --- a/src/afs/afs_osidnlc.c +++ b/src/afs/afs_osidnlc.c @@ -153,7 +153,7 @@ osi_dnlc_enter(struct vcache *adp, char *aname, struct vcache *avc, ObtainWriteLock(&afs_xdnlc, 222); /* Only cache entries from the latest version of the directory */ - if (!(adp->states & CStatd) || !hsame(*avno, adp->m.DataVersion)) { + if (!(adp->f.states & CStatd) || !hsame(*avno, adp->f.m.DataVersion)) { ReleaseWriteLock(&afs_xdnlc); return 0; } @@ -256,9 +256,9 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) ReleaseReadLock(&afs_xvcache); dnlcstats.misses++; } else { - if ((tvc->states & CVInit) + if ((tvc->f.states & CVInit) #ifdef AFS_DARWIN80_ENV - ||(tvc->states & CDeadVnode) + ||(tvc->f.states & CDeadVnode) #endif ) { @@ -428,7 +428,7 @@ osi_dnlc_purgedp(struct vcache *adp) int writelocked; #ifdef AFS_DARWIN_ENV - if (!(adp->states & (CVInit | CVFlushed + if (!(adp->f.states & (CVInit | CVFlushed #ifdef AFS_DARWIN80_ENV | CDeadVnode #endif @@ -472,7 +472,7 @@ osi_dnlc_purgevp(struct vcache *avc) int writelocked; #ifdef AFS_DARWIN_ENV - if (!(avc->states & (CVInit | CVFlushed + if (!(avc->f.states & (CVInit | CVFlushed #ifdef AFS_DARWIN80_ENV | CDeadVnode #endif diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 23fd946..0ded19c 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -263,8 +263,9 @@ HandleIoctl(register struct vcache *avc, register afs_int32 acom, switch (acom & 0xff) { case 1: - avc->states |= CSafeStore; + avc->f.states |= CSafeStore; avc->asynchrony = 0; + /* SXW - Should we force a MetaData flush for this flag setting */ break; /* case 2 used to be abort store, but this is no longer provided, @@ -276,7 +277,7 @@ HandleIoctl(register struct vcache *avc, register afs_int32 acom, register struct cell *tcell; register afs_int32 i; - tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); + tcell = afs_GetCell(avc->f.fid.Cell, READ_LOCK); if (tcell) { i = strlen(tcell->cellName) + 1; /* bytes to copy out */ @@ -1141,7 +1142,7 @@ DECL_PIOCTL(PGetFID) AFS_STATCNT(PGetFID); if (!avc) return EINVAL; - memcpy(aout, (char *)&avc->fid, sizeof(struct VenusFid)); + memcpy(aout, (char *)&avc->f.fid, sizeof(struct VenusFid)); *aoutSize = sizeof(struct VenusFid); return 0; } @@ -1180,29 +1181,31 @@ DECL_PIOCTL(PSetAcl) acl.AFSOpaque_val = ain; do { - tconn = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tconn = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tconn) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREACL); RX_AFS_GUNLOCK(); code = - RXAFS_StoreACL(tconn->id, (struct AFSFid *)&avc->fid.Fid, + RXAFS_StoreACL(tconn->id, (struct AFSFid *)&avc->f.fid.Fid, &acl, &OutStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tconn, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_STOREACL, + (tconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREACL, SHARED_LOCK, NULL)); /* now we've forgotten all of the access info */ ObtainWriteLock(&afs_xcbhash, 455); avc->callback = 0; afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CUnique); + avc->f.states &= ~(CStatd | CUnique); ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); + + /* SXW - Should we flush metadata here? */ return code; } @@ -1302,10 +1305,10 @@ DECL_PIOCTL(PGetAcl) AFS_STATCNT(PGetAcl); if (!avc) return EINVAL; - Fid.Volume = avc->fid.Fid.Volume; - Fid.Vnode = avc->fid.Fid.Vnode; - Fid.Unique = avc->fid.Fid.Unique; - if (avc->states & CForeign) { + Fid.Volume = avc->f.fid.Fid.Volume; + Fid.Vnode = avc->f.fid.Fid.Vnode; + Fid.Unique = avc->f.fid.Fid.Unique; + if (avc->f.states & CForeign) { /* * For a dfs xlator acl we have a special hack so that the * xlator will distinguish which type of acl will return. So @@ -1319,7 +1322,7 @@ DECL_PIOCTL(PGetAcl) } acl.AFSOpaque_val = aout; do { - tconn = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tconn = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tconn) { *aout = 0; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHACL); @@ -1330,7 +1333,7 @@ DECL_PIOCTL(PGetAcl) } else code = -1; } while (afs_Analyze - (tconn, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_FETCHACL, + (tconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHACL, SHARED_LOCK, NULL)); if (code == 0) { @@ -1387,7 +1390,7 @@ DECL_PIOCTL(PGetFileCell) AFS_STATCNT(PGetFileCell); if (!avc) return EINVAL; - tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); + tcell = afs_GetCell(avc->f.fid.Cell, READ_LOCK); if (!tcell) return ESRCH; strcpy(aout, tcell->cellName); @@ -1638,19 +1641,19 @@ DECL_PIOCTL(PGetVolumeStatus) OfflineMsg = offLineMsg; MOTD = motd; do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_GetVolumeStatus(tc->id, avc->fid.Fid.Volume, &volstat, + RXAFS_GetVolumeStatus(tc->id, avc->f.fid.Fid.Volume, &volstat, &Name, &OfflineMsg, &MOTD); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS, SHARED_LOCK, NULL)); if (code) @@ -1706,7 +1709,7 @@ DECL_PIOCTL(PSetVolumeStatus) goto out; } - tvp = afs_GetVolume(&avc->fid, areq, READ_LOCK); + tvp = afs_GetVolume(&avc->f.fid, areq, READ_LOCK); if (tvp) { if (tvp->states & (VRO | VBackup)) { afs_PutVolume(tvp, READ_LOCK); @@ -1749,19 +1752,19 @@ DECL_PIOCTL(PSetVolumeStatus) storeStat.Mask |= AFS_SETMAXQUOTA; } do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_SetVolumeStatus(tc->id, avc->fid.Fid.Volume, &storeStat, + RXAFS_SetVolumeStatus(tc->id, avc->f.fid.Fid.Volume, &storeStat, volName, offLineMsg, motd); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS, SHARED_LOCK, NULL)); if (code) @@ -1860,9 +1863,9 @@ DECL_PIOCTL(PNewStatMount) if (code) { goto out; } - tfid.Cell = avc->fid.Cell; - tfid.Fid.Volume = avc->fid.Fid.Volume; - if (!tfid.Fid.Unique && (avc->states & CForeign)) { + tfid.Cell = avc->f.fid.Cell; + tfid.Fid.Volume = avc->f.fid.Fid.Volume; + if (!tfid.Fid.Unique && (avc->f.states & CForeign)) { tvc = afs_LookupVCache(&tfid, areq, NULL, avc, bufp); } else { tvc = afs_GetVCache(&tfid, areq, NULL, NULL); @@ -2324,7 +2327,7 @@ DECL_PIOCTL(PFindVolume) AFS_STATCNT(PFindVolume); if (!avc) return EINVAL; - tvp = afs_GetVolume(&avc->fid, areq, READ_LOCK); + tvp = afs_GetVolume(&avc->f.fid, areq, READ_LOCK); if (tvp) { cp = aout; for (i = 0; i < MAXHOSTS; i++) { @@ -2525,17 +2528,17 @@ DECL_PIOCTL(PRemoveCallBack) AFS_STATCNT(PRemoveCallBack); if (!avc) return EINVAL; - if (avc->states & CRO) + if (avc->f.states & CRO) return 0; /* read-only-ness can't change */ ObtainWriteLock(&avc->lock, 229); theFids.AFSCBFids_len = 1; theCBs.AFSCBs_len = 1; - theFids.AFSCBFids_val = (struct AFSFid *)&avc->fid.Fid; + theFids.AFSCBFids_val = (struct AFSFid *)&avc->f.fid.Fid; theCBs.AFSCBs_val = CallBacks_Array; CallBacks_Array[0].CallBackType = CB_DROPPED; if (avc->callback) { do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS); RX_AFS_GUNLOCK(); @@ -2545,15 +2548,15 @@ DECL_PIOCTL(PRemoveCallBack) } /* don't set code on failure since we wouldn't use it */ } while (afs_Analyze - (tc, code, &avc->fid, areq, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS, SHARED_LOCK, NULL)); ObtainWriteLock(&afs_xcbhash, 457); afs_DequeueCallback(avc); avc->callback = 0; - avc->states &= ~(CStatd | CUnique); + avc->f.states &= ~(CStatd | CUnique); ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); } ReleaseWriteLock(&avc->lock); @@ -2783,9 +2786,9 @@ DECL_PIOCTL(PRemoveMount) afs_PutDCache(tdc); goto out; } - tfid.Cell = avc->fid.Cell; - tfid.Fid.Volume = avc->fid.Fid.Volume; - if (!tfid.Fid.Unique && (avc->states & CForeign)) { + tfid.Cell = avc->f.fid.Cell; + tfid.Fid.Volume = avc->f.fid.Fid.Volume; + if (!tfid.Fid.Unique && (avc->f.states & CForeign)) { tvc = afs_LookupVCache(&tfid, areq, NULL, avc, bufp); } else { tvc = afs_GetVCache(&tfid, areq, NULL, NULL); @@ -2820,19 +2823,19 @@ DECL_PIOCTL(PRemoveMount) ObtainWriteLock(&avc->lock, 231); osi_dnlc_remove(avc, bufp, tvc); do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEFILE); RX_AFS_GUNLOCK(); code = - RXAFS_RemoveFile(tc->id, (struct AFSFid *)&avc->fid.Fid, bufp, + RXAFS_RemoveFile(tc->id, (struct AFSFid *)&avc->f.fid.Fid, bufp, &OutDirStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_REMOVEFILE, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_REMOVEFILE, SHARED_LOCK, NULL)); if (code) { @@ -2855,7 +2858,7 @@ DECL_PIOCTL(PRemoveMount) ReleaseWriteLock(&tdc->lock); afs_PutDCache(tdc); /* drop ref count */ } - avc->states &= ~CUnique; /* For the dfs xlator */ + avc->f.states &= ~CUnique; /* For the dfs xlator */ ReleaseWriteLock(&avc->lock); code = 0; out: @@ -2978,8 +2981,8 @@ DECL_PIOCTL(PFlushVolumeData) if (!afs_resourceinit_flag) /* afs daemons haven't started yet */ return EIO; /* Inappropriate ioctl for device */ - volume = avc->fid.Fid.Volume; /* who to zap */ - cell = avc->fid.Cell; + volume = avc->f.fid.Fid.Volume; /* who to zap */ + cell = avc->f.fid.Cell; /* * Clear stat'd flag from all vnodes from this volume; this will invalidate all @@ -2987,20 +2990,20 @@ DECL_PIOCTL(PFlushVolumeData) */ loop: ObtainReadLock(&afs_xvcache); - i = VCHashV(&avc->fid); + i = VCHashV(&avc->f.fid); for (tq = afs_vhashTV[i].prev; tq != &afs_vhashTV[i]; tq = uq) { uq = QPrev(tq); tvc = QTOVH(tq); - if (tvc->fid.Fid.Volume == volume && tvc->fid.Cell == cell) { - if (tvc->states & CVInit) { + if (tvc->f.fid.Fid.Volume == volume && tvc->f.fid.Cell == cell) { + if (tvc->f.states & CVInit) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop; } #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop; } #endif @@ -3033,9 +3036,9 @@ DECL_PIOCTL(PFlushVolumeData) ObtainWriteLock(&afs_xcbhash, 458); afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CDirty); + tvc->f.states &= ~(CStatd | CDirty); ReleaseWriteLock(&afs_xcbhash); - if (tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)) + if (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)) osi_dnlc_purgedp(tvc); afs_TryToSmush(tvc, *acred, 1); ReleaseWriteLock(&tvc->lock); @@ -3131,14 +3134,14 @@ DECL_PIOCTL(PGetVnodeXStatus) return EACCES; memset(&stat, 0, sizeof(struct vcxstat)); - stat.fid = avc->fid; - hset32(stat.DataVersion, hgetlo(avc->m.DataVersion)); + stat.fid = avc->f.fid; + hset32(stat.DataVersion, hgetlo(avc->f.m.DataVersion)); stat.lock = avc->lock; - stat.parentVnode = avc->parentVnode; - stat.parentUnique = avc->parentUnique; + stat.parentVnode = avc->f.parent.vnode; + stat.parentUnique = avc->f.parent.unique; hset(stat.flushDV, avc->flushDV); hset(stat.mapDV, avc->mapDV); - stat.truncPos = avc->truncPos; + stat.truncPos = avc->f.truncPos; { /* just grab the first two - won't break anything... */ struct axscache *ac; @@ -3149,12 +3152,12 @@ DECL_PIOCTL(PGetVnodeXStatus) } stat.callback = afs_data_pointer_to_int32(avc->callback); stat.cbExpires = avc->cbExpires; - stat.anyAccess = avc->anyAccess; + stat.anyAccess = avc->f.anyAccess; stat.opens = avc->opens; stat.execsOrWriters = avc->execsOrWriters; stat.flockCount = avc->flockCount; stat.mvstat = avc->mvstat; - stat.states = avc->states; + stat.states = avc->f.states; memcpy(aout, (char *)&stat, sizeof(struct vcxstat)); *aoutSize = sizeof(struct vcxstat); return 0; @@ -3182,7 +3185,7 @@ DECL_PIOCTL(PGetVnodeXStatus2) memset(&stat, 0, sizeof(struct vcxstat2)); stat.cbExpires = avc->cbExpires; - stat.anyAccess = avc->anyAccess; + stat.anyAccess = avc->f.anyAccess; stat.mvstat = avc->mvstat; stat.callerAccess = afs_GetAccessBits(avc, ~0, areq); @@ -4221,9 +4224,9 @@ DECL_PIOCTL(PFlushMount) if (code) { goto out; } - tfid.Cell = avc->fid.Cell; - tfid.Fid.Volume = avc->fid.Fid.Volume; - if (!tfid.Fid.Unique && (avc->states & CForeign)) { + tfid.Cell = avc->f.fid.Cell; + tfid.Fid.Volume = avc->f.fid.Fid.Volume; + if (!tfid.Fid.Unique && (avc->f.states & CForeign)) { tvc = afs_LookupVCache(&tfid, areq, NULL, avc, bufp); } else { tvc = afs_GetVCache(&tfid, areq, NULL, NULL); @@ -4243,12 +4246,12 @@ DECL_PIOCTL(PFlushMount) ObtainWriteLock(&tvc->lock, 649); ObtainWriteLock(&afs_xcbhash, 650); afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */ + tvc->f.states &= ~(CStatd | CDirty); /* next reference will re-stat cache entry */ ReleaseWriteLock(&afs_xcbhash); /* now find the disk cache entries */ afs_TryToSmush(tvc, *acred, 1); osi_dnlc_purgedp(tvc); - if (tvc->linkData && !(tvc->states & CCore)) { + if (tvc->linkData && !(tvc->f.states & CCore)) { afs_osi_Free(tvc->linkData, strlen(tvc->linkData) + 1); tvc->linkData = NULL; } @@ -4374,8 +4377,8 @@ DECL_PIOCTL(PPrefetchFromTape) if (ain && (ainSize == 3 * sizeof(afs_int32))) Fid = (struct AFSFid *)ain; else - Fid = &avc->fid.Fid; - tfid.Cell = avc->fid.Cell; + Fid = &avc->f.fid.Fid; + tfid.Cell = avc->f.fid.Cell; tfid.Fid.Volume = Fid->Volume; tfid.Fid.Vnode = Fid->Vnode; tfid.Fid.Unique = Fid->Unique; @@ -4383,20 +4386,20 @@ DECL_PIOCTL(PPrefetchFromTape) tvc = afs_GetVCache(&tfid, areq, NULL, NULL); if (!tvc) { afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD, ICL_TYPE_POINTER, tvc, - ICL_TYPE_FID, &tfid, ICL_TYPE_FID, &avc->fid); + ICL_TYPE_FID, &tfid, ICL_TYPE_FID, &avc->f.fid); return ENOENT; } afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD, ICL_TYPE_POINTER, tvc, - ICL_TYPE_FID, &tfid, ICL_TYPE_FID, &tvc->fid); + ICL_TYPE_FID, &tfid, ICL_TYPE_FID, &tvc->f.fid); do { - tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); if (tc) { RX_AFS_GUNLOCK(); tcall = rx_NewCall(tc->id); code = - StartRXAFS_FetchData(tcall, (struct AFSFid *)&tvc->fid.Fid, 0, + StartRXAFS_FetchData(tcall, (struct AFSFid *)&tvc->f.fid.Fid, 0, 0); if (!code) { bytes = rx_Read(tcall, (char *)aout, sizeof(afs_int32)); @@ -4408,7 +4411,7 @@ DECL_PIOCTL(PPrefetchFromTape) } else code = -1; } while (afs_Analyze - (tc, code, &tvc->fid, areq, AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, + (tc, code, &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, NULL)); /* This call is done only to have the callback things handled correctly */ afs_FetchStatus(tvc, &tfid, areq, &OutStatus); @@ -4439,9 +4442,9 @@ DECL_PIOCTL(PResidencyCmd) Fid = &Inputs->fid; if (!Fid->Volume) - Fid = &avc->fid.Fid; + Fid = &avc->f.fid.Fid; - tfid.Cell = avc->fid.Cell; + tfid.Cell = avc->f.fid.Cell; tfid.Fid.Volume = Fid->Volume; tfid.Fid.Vnode = Fid->Vnode; tfid.Fid.Unique = Fid->Unique; @@ -4454,7 +4457,7 @@ DECL_PIOCTL(PResidencyCmd) if (Inputs->command) { do { - tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); if (tc) { RX_AFS_GUNLOCK(); code = @@ -4464,7 +4467,7 @@ DECL_PIOCTL(PResidencyCmd) } else code = -1; } while (afs_Analyze - (tc, code, &tvc->fid, areq, + (tc, code, &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, NULL)); /* This call is done to have the callback things handled correctly */ afs_FetchStatus(tvc, &tfid, areq, &Outputs->status); diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index d333962..5a17632 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -946,6 +946,7 @@ extern afs_int32 afs_vcount; extern int afsvnumbers; extern afs_rwlock_t afs_xvreclaim; extern afs_rwlock_t afs_xvcache; +extern afs_rwlock_t afs_xvcdirty; extern afs_lock_t afs_xvcb; extern struct afs_q VLRU; extern afs_int32 vcachegen; @@ -954,6 +955,8 @@ extern struct afs_q afs_vhashTV[VCSIZE]; extern afs_int32 afs_bulkStatsLost; extern int afs_norefpanic; extern struct vcache *ReclaimedVCList; +extern ino_t vcacheMetaInode; +extern struct osi_file *afs_vcacheMetaInodep; extern void afs_FlushReclaimedVcaches(void); void afs_vcacheInit(int astatSize); diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 6d107bc..5df9743 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -50,15 +50,15 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) XSTATS_DECLS; AFS_STATCNT(afs_StoreMini); afs_Trace2(afs_iclSetp, CM_TRACE_STOREMINI, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); - tlen = avc->m.Length; - if (avc->truncPos < tlen) - tlen = avc->truncPos; - avc->truncPos = AFS_NOTRUNC; - avc->states &= ~CExtendedFile; + ICL_TYPE_INT32, avc->f.m.Length); + tlen = avc->f.m.Length; + if (avc->f.truncPos < tlen) + tlen = avc->f.truncPos; + avc->f.truncPos = AFS_NOTRUNC; + avc->f.states &= ~CExtendedFile; do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { retry: RX_AFS_GUNLOCK(); @@ -73,11 +73,11 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) * the proper store-data or store-status calls. */ InStatus.Mask = AFS_SETMODTIME; - InStatus.ClientModTime = avc->m.Date; + InStatus.ClientModTime = avc->f.m.Date; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREDATA); afs_Trace4(afs_iclSetp, CM_TRACE_STOREDATA64, ICL_TYPE_FID, - &avc->fid.Fid, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(avc->m.Length), ICL_TYPE_OFFSET, + &avc->f.fid.Fid, ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(xlen), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tlen)); RX_AFS_GUNLOCK(); @@ -85,26 +85,26 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) if (!afs_serverHasNo64Bit(tc)) { code = StartRXAFS_StoreData64(tcall, - (struct AFSFid *)&avc->fid.Fid, - &InStatus, avc->m.Length, + (struct AFSFid *)&avc->f.fid.Fid, + &InStatus, avc->f.m.Length, (afs_size_t) 0, tlen); } else { afs_int32 l1, l2; - l1 = avc->m.Length; + l1 = avc->f.m.Length; l2 = tlen; - if ((avc->m.Length > 0x7fffffff) || + if ((avc->f.m.Length > 0x7fffffff) || (tlen > 0x7fffffff) || - ((0x7fffffff - tlen) < avc->m.Length)) + ((0x7fffffff - tlen) < avc->f.m.Length)) return EFBIG; code = StartRXAFS_StoreData(tcall, - (struct AFSFid *)&avc->fid.Fid, + (struct AFSFid *)&avc->f.fid.Fid, &InStatus, l1, 0, l2); } #else /* AFS_64BIT_CLIENT */ code = - StartRXAFS_StoreData(tcall, (struct AFSFid *)&avc->fid.Fid, - &InStatus, avc->m.Length, 0, tlen); + StartRXAFS_StoreData(tcall, (struct AFSFid *)&avc->f.fid.Fid, + &InStatus, avc->f.m.Length, 0, tlen); #endif /* AFS_64BIT_CLIENT */ if (code == 0) { code = EndRXAFS_StoreData(tcall, &OutStatus, &tsync); @@ -121,7 +121,7 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK, NULL)); if (code == 0) { @@ -183,13 +183,13 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, AFS_STATCNT(afs_StoreAllSegments); - hset(oldDV, avc->m.DataVersion); - hset(newDV, avc->m.DataVersion); - hash = DVHash(&avc->fid); - foreign = (avc->states & CForeign); + hset(oldDV, avc->f.m.DataVersion); + hset(newDV, avc->f.m.DataVersion); + hash = DVHash(&avc->f.fid); + foreign = (avc->f.states & CForeign); dcList = (struct dcache **)osi_AllocLargeSpace(AFS_LRALLOCSIZ); afs_Trace2(afs_iclSetp, CM_TRACE_STOREALL, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); #if !defined(AFS_AIX32_ENV) && !defined(AFS_SGI65_ENV) /* In the aix vm implementation we need to do the vm_writep even * on the memcache case since that's we adjust the file's size @@ -244,7 +244,7 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, origCBs = afs_allCBs; maxStoredLength = 0; - tlen = avc->m.Length; + tlen = avc->f.m.Length; minj = 0; do { @@ -259,10 +259,10 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, for (j = 0; index != NULLIDX;) { if ((afs_indexFlags[index] & IFDataMod) - && (afs_indexUnique[index] == avc->fid.Fid.Unique)) { + && (afs_indexUnique[index] == avc->f.fid.Fid.Unique)) { tdc = afs_GetDSlot(index, 0); /* refcount+1. */ ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid) && tdc->f.chunk >= minj) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid) && tdc->f.chunk >= minj) { off = tdc->f.chunk - minj; if (off < NCHUNKSATONCE) { if (dcList[off]) @@ -347,21 +347,21 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, dclist = &dcList[first]; nchunks = 1 + j - first; nomore = !(moredata || (j != high)); - InStatus.ClientModTime = avc->m.Date; + InStatus.ClientModTime = avc->f.m.Date; InStatus.Mask = AFS_SETMODTIME; if (sync & AFS_SYNC) { InStatus.Mask |= AFS_FSYNC; } - tlen = lmin(avc->m.Length, avc->truncPos); + tlen = lmin(avc->f.m.Length, avc->f.truncPos); afs_Trace4(afs_iclSetp, CM_TRACE_STOREDATA64, - ICL_TYPE_FID, &avc->fid.Fid, ICL_TYPE_OFFSET, + ICL_TYPE_FID, &avc->f.fid.Fid, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(base), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(bytes), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tlen)); do { stored = 0; - tc = afs_Conn(&avc->fid, areq, 0); + tc = afs_Conn(&avc->f.fid, areq, 0); if (tc) { restart: RX_AFS_GUNLOCK(); @@ -371,7 +371,7 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, code = StartRXAFS_StoreData64(tcall, (struct AFSFid *) - &avc->fid.Fid, + &avc->f.fid.Fid, &InStatus, base, bytes, tlen); } else { @@ -385,7 +385,7 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, code = StartRXAFS_StoreData(tcall, (struct AFSFid *) - &avc->fid.Fid, + &avc->f.fid.Fid, &InStatus, t1, t2, t3); } @@ -394,7 +394,7 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, code = StartRXAFS_StoreData(tcall, (struct AFSFid *)&avc-> - fid.Fid, &InStatus, base, + f.fid.Fid, &InStatus, base, bytes, tlen); #endif /* AFS_64BIT_CLIENT */ RX_AFS_GLOCK(); @@ -404,7 +404,7 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, } if (!code) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREDATA); - avc->truncPos = AFS_NOTRUNC; + avc->f.truncPos = AFS_NOTRUNC; } for (i = 0; i < nchunks && !code; i++) { tdc = dclist[i]; @@ -579,7 +579,7 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, } #endif /* AFS_64BIT_CLIENT */ } while (afs_Analyze - (tc, code, &avc->fid, areq, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK, NULL)); @@ -669,14 +669,14 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, * Call StoreMini if we haven't written enough data to extend the * file at the fileserver to the client's notion of the file length. */ - if ((avc->truncPos != AFS_NOTRUNC) || ((avc->states & CExtendedFile) - && (maxStoredLength < - avc->m.Length))) { + if ((avc->f.truncPos != AFS_NOTRUNC) + || ((avc->f.states & CExtendedFile) + && (maxStoredLength < avc->f.m.Length))) { code = afs_StoreMini(avc, areq); if (code == 0) hadd32(newDV, 1); /* just bumped here, too */ } - avc->states &= ~CExtendedFile; + avc->f.states &= ~CExtendedFile; } /* @@ -701,11 +701,11 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, for (j = 0, safety = 0, index = afs_dvhashTbl[hash]; index != NULLIDX && safety < afs_cacheFiles + 2;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, 0); ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid) + if (!FidCmp(&tdc->f.fid, &avc->f.fid) && tdc->f.chunk >= minj) { off = tdc->f.chunk - minj; if (off < NCHUNKSATONCE) { @@ -749,13 +749,13 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, && hcmp(tdc->f.versionNo, oldDV) >= 0) { if ((!(afs_dvhack || foreign) - && hsame(avc->m.DataVersion, newDV)) + && hsame(avc->f.m.DataVersion, newDV)) || ((afs_dvhack || foreign) && (origCBs == afs_allCBs))) { /* no error, this is the DV */ UpgradeSToWLock(&tdc->lock, 678); - hset(tdc->f.versionNo, avc->m.DataVersion); + hset(tdc->f.versionNo, avc->f.m.DataVersion); tdc->dflags |= DFEntryMod; ConvertWToSLock(&tdc->lock); } @@ -777,12 +777,12 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, * invalidated. Also discard data if it's a permanent error from the * fileserver. */ - if (areq->permWriteError || (avc->states & (CCore1 | CCore))) { + if (areq->permWriteError || (avc->f.states & (CCore1 | CCore))) { afs_InvalidateAllSegments(avc); } } afs_Trace3(afs_iclSetp, CM_TRACE_STOREALLDONE, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length, ICL_TYPE_INT32, code); + ICL_TYPE_INT32, avc->f.m.Length, ICL_TYPE_INT32, code); /* would like a Trace5, but it doesn't exist... */ afs_Trace3(afs_iclSetp, CM_TRACE_AVCLOCKER, ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, avc->lock.wait_states, ICL_TYPE_INT32, @@ -800,10 +800,10 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, * Turn off CDirty bit because the stored data is now in sync with server. */ if (code == 0 && hcmp(avc->mapDV, oldDV) >= 0) { - if ((!(afs_dvhack || foreign) && hsame(avc->m.DataVersion, newDV)) + if ((!(afs_dvhack || foreign) && hsame(avc->f.m.DataVersion, newDV)) || ((afs_dvhack || foreign) && (origCBs == afs_allCBs))) { hset(avc->mapDV, newDV); - avc->states &= ~CDirty; + avc->f.states &= ~CDirty; } } osi_FreeLargeSpace(dcList); @@ -842,15 +842,15 @@ afs_InvalidateAllSegments(struct vcache *avc) AFS_STATCNT(afs_InvalidateAllSegments); afs_Trace2(afs_iclSetp, CM_TRACE_INVALL, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); - hash = DVHash(&avc->fid); - avc->truncPos = AFS_NOTRUNC; /* don't truncate later */ - avc->states &= ~CExtendedFile; /* not any more */ + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); + hash = DVHash(&avc->f.fid); + avc->f.truncPos = AFS_NOTRUNC; /* don't truncate later */ + avc->f.states &= ~CExtendedFile; /* not any more */ ObtainWriteLock(&afs_xcbhash, 459); afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CDirty); /* mark status information as bad, too */ + avc->f.states &= ~(CStatd | CDirty); /* mark status information as bad, too */ ReleaseWriteLock(&afs_xcbhash); - if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) + if (avc->f.fid.Fid.Vnode & 1 || (vType(avc) == VDIR)) osi_dnlc_purgedp(avc); /* Blow away pages; for now, only for Solaris */ #if (defined(AFS_SUN5_ENV)) @@ -865,10 +865,10 @@ afs_InvalidateAllSegments(struct vcache *avc) dcListMax = 0; for (index = afs_dvhashTbl[hash]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, 0); ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid)) + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) dcListMax++; afs_PutDCache(tdc); } @@ -879,10 +879,10 @@ afs_InvalidateAllSegments(struct vcache *avc) dcListCount = 0; for (index = afs_dvhashTbl[hash]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, 0); ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid)) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) { /* same file? we'll zap it */ if (afs_indexFlags[index] & IFDataMod) { afs_stats_cmperf.cacheCurrDirtyChunks--; @@ -941,16 +941,16 @@ afs_ExtendSegments(struct vcache *avc, afs_size_t alen, struct vrequest *areq) { return ENOMEM; memset(zeros, 0, AFS_PAGESIZE); - while (avc->m.Length < alen) { - tdc = afs_ObtainDCacheForWriting(avc, avc->m.Length, alen - avc->m.Length, areq, 0); + while (avc->f.m.Length < alen) { + tdc = afs_ObtainDCacheForWriting(avc, avc->f.m.Length, alen - avc->f.m.Length, areq, 0); if (!tdc) { code = EIO; break; } - toAdd = alen - avc->m.Length; + toAdd = alen - avc->f.m.Length; - offset = avc->m.Length - AFS_CHUNKTOBASE(tdc->f.chunk); + offset = avc->f.m.Length - AFS_CHUNKTOBASE(tdc->f.chunk); if (offset + toAdd > AFS_CHUNKTOSIZE(tdc->f.chunk)) { toAdd = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset; } @@ -959,10 +959,10 @@ afs_ExtendSegments(struct vcache *avc, afs_size_t alen, struct vrequest *areq) { #else tfile = afs_CFileOpen(tdc->f.inode); #endif - while(tdc->validPos < avc->m.Length + toAdd) { + while(tdc->validPos < avc->f.m.Length + toAdd) { afs_size_t towrite; - towrite = (avc->m.Length + toAdd) - tdc->validPos; + towrite = (avc->f.m.Length + toAdd) - tdc->validPos; if (towrite > AFS_PAGESIZE) towrite = AFS_PAGESIZE; code = afs_CFileWrite(tfile, @@ -972,7 +972,7 @@ afs_ExtendSegments(struct vcache *avc, afs_size_t alen, struct vrequest *areq) { } afs_CFileClose(tfile); afs_AdjustSize(tdc, offset + toAdd ); - avc->m.Length += toAdd; + avc->f.m.Length += toAdd; ReleaseWriteLock(&tdc->lock); afs_PutDCache(tdc); } @@ -1009,11 +1009,11 @@ afs_TruncateAllSegments(register struct vcache *avc, afs_size_t alen, struct dcache **tdcArray; AFS_STATCNT(afs_TruncateAllSegments); - avc->m.Date = osi_Time(); + avc->f.m.Date = osi_Time(); afs_Trace3(afs_iclSetp, CM_TRACE_TRUNCALL, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(alen)); - if (alen >= avc->m.Length) { + if (alen >= avc->f.m.Length) { /* * Special speedup since Sun's vm extends the file this way; * we've never written to the file thus we can just set the new @@ -1023,8 +1023,8 @@ afs_TruncateAllSegments(register struct vcache *avc, afs_size_t alen, * should keep the ExtendedPos as well and clear this flag if we * truncate below that value before we store the file back. */ - avc->states |= CExtendedFile; - avc->m.Length = alen; + avc->f.states |= CExtendedFile; + avc->f.m.Length = alen; return 0; } #if (defined(AFS_SUN5_ENV)) @@ -1049,21 +1049,21 @@ afs_TruncateAllSegments(register struct vcache *avc, afs_size_t alen, AFS_GLOCK(); ObtainWriteLock(&avc->lock, 79); - avc->m.Length = alen; + avc->f.m.Length = alen; - if (alen < avc->truncPos) - avc->truncPos = alen; - code = DVHash(&avc->fid); + if (alen < avc->f.truncPos) + avc->f.truncPos = alen; + code = DVHash(&avc->f.fid); /* block out others from screwing with this table */ MObtainWriteLock(&afs_xdcache, 287); dcCount = 0; for (index = afs_dvhashTbl[code]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, 0); ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid)) + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) dcCount++; afs_PutDCache(tdc); } @@ -1078,10 +1078,10 @@ afs_TruncateAllSegments(register struct vcache *avc, afs_size_t alen, dcPos = 0; for (index = afs_dvhashTbl[code]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + if (afs_indexUnique[index] == avc->f.fid.Fid.Unique) { tdc = afs_GetDSlot(index, 0); ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid)) { + if (!FidCmp(&tdc->f.fid, &avc->f.fid)) { /* same file, and modified, we'll store it back */ if (dcPos < dcCount) { tdcArray[dcPos++] = tdc; @@ -1139,5 +1139,6 @@ afs_TruncateAllSegments(register struct vcache *avc, afs_size_t alen, } ReleaseWriteLock(&avc->vlock); #endif + return 0; } diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index 4638129..88bf43d 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -275,7 +275,7 @@ afs_HaveCallBacksFrom(struct server *aserver) * from the required host */ if (aserver == tvc->callback && tvc->cbExpires >= now - && ((tvc->states & CRO) == 0)) + && ((tvc->f.states & CRO) == 0)) return 1; } } diff --git a/src/afs/afs_util.c b/src/afs/afs_util.c index 82f8028..8f9d3ce 100644 --- a/src/afs/afs_util.c +++ b/src/afs/afs_util.c @@ -212,7 +212,7 @@ afs_CheckLocks(void) for (i = 0; i < VCSIZE; i++) { for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { - if (tvc->states & CVInit) continue; + if (tvc->f.states & CVInit) continue; #ifdef AFS_OSF_ENV if (VREFCOUNT(tvc) > 1) #else /* AFS_OSF_ENV */ diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index fef5668..6e53523 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -63,6 +63,9 @@ char *makesname(); #endif /* AFS_SGI64_ENV */ /* Exported variables */ +#ifdef AFS_DISCON_ENV +afs_rwlock_t afs_xvcdirty; /*Lock: discon vcache dirty list mgmt */ +#endif afs_rwlock_t afs_xvcache; /*Lock: alloc new stat cache entries */ afs_rwlock_t afs_xvreclaim; /*Lock: entries reclaimed, not on free list */ afs_lock_t afs_xvcb; /*Lock: fids on which there are callbacks */ @@ -80,6 +83,12 @@ static struct afs_cbr *afs_cbrHashT[CBRSIZE]; afs_int32 afs_bulkStatsLost; int afs_norefpanic = 0; + +/* Disk backed vcache definitions + * Both protected by xvcache */ +static int afs_nextVcacheSlot = 0; +static struct afs_slotlist *afs_freeSlotList = NULL; + /* Forward declarations */ static afs_int32 afs_QueueVCB(struct vcache *avc); @@ -139,7 +148,7 @@ afs_FlushVCache(struct vcache *avc, int *slept) *slept = 0; AFS_STATCNT(afs_FlushVCache); afs_Trace2(afs_iclSetp, CM_TRACE_FLUSHV, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->states); + ICL_TYPE_INT32, avc->f.states); #ifdef AFS_OSF_ENV AFS_GUNLOCK(); VN_LOCK(AFSTOV(avc)); @@ -150,7 +159,7 @@ afs_FlushVCache(struct vcache *avc, int *slept) if (code) goto bad; - if (avc->states & CVFlushed) { + if (avc->f.states & CVFlushed) { code = EBUSY; goto bad; } @@ -159,18 +168,18 @@ afs_FlushVCache(struct vcache *avc, int *slept) refpanic("LRU vs. Free inconsistency"); } #endif - avc->states |= CVFlushed; + avc->f.states |= CVFlushed; /* pull the entry out of the lruq and put it on the free list */ QRemove(&avc->vlruq); /* keep track of # of files that we bulk stat'd, but never used * before they got recycled. */ - if (avc->states & CBulkStat) + if (avc->f.states & CBulkStat) afs_bulkStatsLost++; vcachegen++; /* remove entry from the hash chain */ - i = VCHash(&avc->fid); + i = VCHash(&avc->f.fid); uvc = &afs_vhashT[i]; for (wvc = *uvc; wvc; uvc = &wvc->hnext, wvc = *uvc) { if (avc == wvc) { @@ -213,14 +222,14 @@ afs_FlushVCache(struct vcache *avc, int *slept) * server only tracks them on a per-volume basis, and we don't * know whether we still have some other files from the same * volume. */ - if ((avc->states & CRO) == 0 && avc->callback) { + if ((avc->f.states & CRO) == 0 && avc->callback) { afs_QueueVCB(avc); } ObtainWriteLock(&afs_xcbhash, 460); afs_DequeueCallback(avc); /* remove it from queued callbacks list */ - avc->states &= ~(CStatd | CUnique); + avc->f.states &= ~(CStatd | CUnique); ReleaseWriteLock(&afs_xcbhash); - if ((avc->states & CForeign) || (avc->fid.Fid.Vnode & 1)) + if ((avc->f.states & CForeign) || (avc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(avc); /* if it (could be) a directory */ else osi_dnlc_purgevp(avc); @@ -230,7 +239,7 @@ afs_FlushVCache(struct vcache *avc, int *slept) * optimistic synchronization algorithm */ afs_allZaps++; - if (avc->fid.Fid.Vnode & 1) + if (avc->f.fid.Fid.Vnode & 1) afs_oddZaps++; else afs_evenZaps++; @@ -242,7 +251,7 @@ afs_FlushVCache(struct vcache *avc, int *slept) if (avc->vlruq.prev || avc->vlruq.next) { refpanic("LRU vs. Free inconsistency"); } - avc->states |= CVFlushed; + avc->f.states |= CVFlushed; #else /* This should put it back on the vnode free list since usecount is 1 */ afs_vcount--; @@ -286,15 +295,15 @@ void afs_InactiveVCache(struct vcache *avc, struct AFS_UCRED *acred) { AFS_STATCNT(afs_inactive); - if (avc->states & CDirty) { + if (avc->f.states & CDirty) { /* we can't keep trying to push back dirty data forever. Give up. */ afs_InvalidateAllSegments(avc); /* turns off dirty bit */ } - avc->states &= ~CMAPPED; /* mainly used by SunOS 4.0.x */ - avc->states &= ~CDirty; /* Turn it off */ - if (avc->states & CUnlinked) { + avc->f.states &= ~CMAPPED; /* mainly used by SunOS 4.0.x */ + avc->f.states &= ~CDirty; /* Turn it off */ + if (avc->f.states & CUnlinked) { if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) { - avc->states |= CUnlinkedDel; + avc->f.states |= CUnlinkedDel; return; } afs_remunlink(avc, 1); /* ignore any return code */ @@ -513,7 +522,7 @@ afs_QueueVCB(struct vcache *avc) */ MObtainWriteLock(&afs_xvcb, 274); tcbp = afs_AllocCBR(); - tcbp->fid = avc->fid.Fid; + tcbp->fid = avc->f.fid.Fid; tcbp->next = tsp->cbrs; if (tsp->cbrs) @@ -592,17 +601,17 @@ afs_FlushReclaimedVcaches(void) tmpReclaimedVCList = tvc; printf("Reclaim list flush %lx failed: %d\n", (unsigned long) tvc, code); } - if (tvc->states & (CVInit + if (tvc->f.states & (CVInit #ifdef AFS_DARWIN80_ENV | CDeadVnode #endif )) { - tvc->states &= ~(CVInit + tvc->f.states &= ~(CVInit #ifdef AFS_DARWIN80_ENV | CDeadVnode #endif ); - afs_osi_Wakeup(&tvc->states); + afs_osi_Wakeup(&tvc->f.states); } } if (tmpReclaimedVCList) @@ -645,9 +654,9 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) afs_FlushReclaimedVcaches(); #if defined(AFS_OSF_ENV) || defined(AFS_LINUX22_ENV) -#if defined(AFS_OSF30_ENV) || defined(AFS_LINUX22_ENV) +# if defined(AFS_OSF30_ENV) || defined(AFS_LINUX22_ENV) if (afs_vcount >= afs_maxvcount) -#else +# else /* * If we are using > 33 % of the total system vnodes for AFS vcache * entries or we are using the maximum number of vcache entries, @@ -656,7 +665,7 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) * we _must_ free some -- no choice). */ if (((3 * afs_vcount) > nvnode) || (afs_vcount >= afs_maxvcount)) -#endif +# endif { int i; char *panicstr; @@ -665,7 +674,7 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) for (tq = VLRU.prev; tq != &VLRU && anumber > 0; tq = uq) { tvc = QTOV(tq); uq = QPrev(tq); - if (tvc->states & CVFlushed) { + if (tvc->f.states & CVFlushed) { refpanic("CVFlushed on VLRU"); } else if (i++ > afs_maxvcount) { refpanic("Exceeded pool of AFS vnodes(VLRU cycle?)"); @@ -675,14 +684,14 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) refpanic("refcnt 0 on VLRU"); } -#if defined(AFS_LINUX22_ENV) +# if defined(AFS_LINUX22_ENV) if (tvc != afs_globalVp && VREFCOUNT(tvc) > 1 && tvc->opens == 0) { struct dentry *dentry; struct list_head *cur, *head; AFS_GUNLOCK(); -#if defined(AFS_LINUX24_ENV) +# if defined(AFS_LINUX24_ENV) spin_lock(&dcache_lock); -#endif +# endif /* AFS_LINUX24_ENV */ head = &(AFSTOV(tvc))->i_dentry; restart: @@ -695,31 +704,31 @@ restart: dget_locked(dentry); -#if defined(AFS_LINUX24_ENV) +# if defined(AFS_LINUX24_ENV) spin_unlock(&dcache_lock); -#endif +# endif /* AFS_LINUX24_ENV */ if (d_invalidate(dentry) == -EBUSY) { dput(dentry); /* perhaps lock and try to continue? (use cur as head?) */ goto inuse; } dput(dentry); -#if defined(AFS_LINUX24_ENV) +# if defined(AFS_LINUX24_ENV) spin_lock(&dcache_lock); -#endif +# endif /* AFS_LINUX24_ENV */ goto restart; } -#if defined(AFS_LINUX24_ENV) +# if defined(AFS_LINUX24_ENV) spin_unlock(&dcache_lock); -#endif +# endif /* AFS_LINUX24_ENV */ inuse: AFS_GLOCK(); } -#endif +# endif /* AFS_LINUX22_ENV */ if (VREFCOUNT_GT(tvc,0) && !VREFCOUNT_GT(tvc,1) && tvc->opens == 0 - && (tvc->states & CUnlinkedDel) == 0) { + && (tvc->f.states & CUnlinkedDel) == 0) { code = afs_FlushVCache(tvc, &fv_slept); if (code == 0) { anumber--; @@ -753,15 +762,15 @@ restart: if (!ip) osi_Panic("afs_NewVCache: no more inodes"); AFS_GLOCK(); -#if defined(STRUCT_SUPER_HAS_ALLOC_INODE) +# if defined(STRUCT_SUPER_HAS_ALLOC_INODE) tvc = VTOAFS(ip); -#else +# else tvc = afs_osi_Alloc(sizeof(struct vcache)); ip->u.generic_ip = tvc; tvc->v = ip; -#endif +# endif } -#else +# else AFS_GUNLOCK(); if (getnewvnode(MOUNT_AFS, &Afs_vnodeops, &nvc)) { /* What should we do ???? */ @@ -771,9 +780,24 @@ restart: tvc = nvc; tvc->nextfree = NULL; -#endif +# endif afs_vcount++; -#else /* AFS_OSF_ENV */ + + /* If we create a new inode, we either give it a new slot number, + * or if one's available, use a slot number from the slot free list + */ + if (afs_freeSlotList != NULL) { + struct afs_slotlist *tmp; + + tvc->diskSlot = afs_freeSlotList->slot; + tmp = afs_freeSlotList; + afs_freeSlotList = tmp->next; + afs_osi_Free(tmp, sizeof(struct afs_slotlist)); + } else { + tvc->diskSlot = afs_nextVcacheSlot++; + } + +#else /* AFS_OSF_ENV || AFS_LINUX22_ENV */ /* pull out a free cache entry */ if (!freeVCList) { int loop = 0; @@ -782,24 +806,24 @@ restart: tvc = QTOV(tq); uq = QPrev(tq); - if (tvc->states & CVFlushed) { + if (tvc->f.states & CVFlushed) { refpanic("CVFlushed on VLRU"); } else if (i++ > 2 * afs_cacheStats) { /* even allowing for a few xallocs... */ refpanic("Increase -stat parameter of afsd(VLRU cycle?)"); } else if (QNext(uq) != tq) { refpanic("VLRU inconsistent"); - } else if (tvc->states & CVInit) { + } else if (tvc->f.states & CVInit) { continue; } if (!VREFCOUNT_GT(tvc,0) -#if defined(AFS_DARWIN_ENV) && !defined(UKERNEL) && !defined(AFS_DARWIN80_ENV) +# if defined(AFS_DARWIN_ENV) && !defined(UKERNEL) && !defined(AFS_DARWIN80_ENV) || ((VREFCOUNT(tvc) == 1) && (UBCINFOEXISTS(AFSTOV(tvc)))) -#endif - && tvc->opens == 0 && (tvc->states & CUnlinkedDel) == 0) { -#if defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) -#ifdef AFS_DARWIN80_ENV +# endif + && tvc->opens == 0 && (tvc->f.states & CUnlinkedDel) == 0) { +# if defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) +# ifdef AFS_DARWIN80_ENV vnode_t tvp = AFSTOV(tvc); /* VREFCOUNT_GT only sees usecounts, not iocounts */ /* so this may fail to actually recycle the vnode now */ @@ -827,7 +851,7 @@ restart: code = EBUSY; } else code = 0; -#else +# else /* AFS_DARWIN80_ENV */ /* * vgone() reclaims the vnode, which calls afs_FlushVCache(), * then it puts the vnode on the free list. @@ -840,10 +864,10 @@ restart: fv_slept = 0; code = 0; AFS_GLOCK(); -#endif -#else +# endif +# else /* AFS_DARWIN80_ENV || AFS_XBSD_ENV */ code = afs_FlushVCache(tvc, &fv_slept); -#endif +# endif /* AFS_DARWIN80_ENV || AFS_XBSD_ENV */ if (code == 0) { anumber--; } @@ -864,13 +888,29 @@ restart: /* none free, making one is better than a panic */ afs_stats_cmperf.vcacheXAllocs++; /* count in case we have a leak */ tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache)); -#if defined(AFS_DARWIN_ENV) && !defined(UKERNEL) +# if defined(AFS_DARWIN_ENV) && !defined(UKERNEL) tvc->v = NULL; /* important to clean this, or use memset 0 */ -#endif -#ifdef KERNEL_HAVE_PIN +# endif +# ifdef KERNEL_HAVE_PIN pin((char *)tvc, sizeof(struct vcache)); /* XXX */ +# endif + +#ifdef AFS_DISCON_ENV + /* If we create a new inode, we either give it a new slot number, + * or if one's available, use a slot number from the slot free list + */ + if (afs_freeSlotList != NULL) { + struct afs_slotlist *tmp; + + tvc->diskSlot = afs_freeSlotList->slot; + tmp = afs_freeSlotList; + afs_freeSlotList = tmp->next; + afs_osi_Free(tmp, sizeof(struct afs_slotlist)); + } else { + tvc->diskSlot = afs_nextVcacheSlot++; + } #endif -#if defined(AFS_SGI_ENV) +# if defined(AFS_SGI_ENV) { char name[METER_NAMSZ]; memset(tvc, 0, sizeof(struct vcache)); @@ -902,9 +942,23 @@ restart: #endif #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX22_ENV) + +# if AFS_DISCON_ENV + /* We need to preserve the slot that we're being stored into on + * disk */ + { + afs_uint32 slot; + slot = tvc->diskSlot; + memset((char *)tvc, 0, sizeof(struct vcache)); + tvc->diskSlot = slot; + } +# else memset((char *)tvc, 0, sizeof(struct vcache)); +# endif + #else tvc->uncred = 0; + memset(&(tvc->f), 0, sizeof(struct fvcache)); #endif AFS_RWLOCK_INIT(&tvc->lock, "vcache lock"); @@ -912,32 +966,28 @@ restart: AFS_RWLOCK_INIT(&tvc->vlock, "vcache vlock"); #endif /* defined(AFS_SUN5_ENV) */ - tvc->parentVnode = 0; tvc->mvid = NULL; tvc->linkData = NULL; tvc->cbExpires = 0; tvc->opens = 0; tvc->execsOrWriters = 0; tvc->flockCount = 0; - tvc->anyAccess = 0; - tvc->states = CVInit; + tvc->f.states = CVInit; tvc->last_looker = 0; - tvc->fid = *afid; + tvc->f.fid = *afid; tvc->asynchrony = -1; tvc->vc_error = 0; #ifdef AFS_TEXT_ENV tvc->flushDV.low = tvc->flushDV.high = AFS_MAXDV; #endif hzero(tvc->mapDV); - tvc->truncPos = AFS_NOTRUNC; /* don't truncate until we need to */ - hzero(tvc->m.DataVersion); /* in case we copy it into flushDV */ + tvc->f.truncPos = AFS_NOTRUNC; /* don't truncate until we need to */ + hzero(tvc->f.m.DataVersion); /* in case we copy it into flushDV */ tvc->Access = NULL; tvc->callback = serverp; /* to minimize chance that clear * request is lost */ #if defined(AFS_DISCON_ENV) - tvc->ddirty_flags = 0; - tvc->shVnode = 0; - tvc->shUnique = 0; + QZero(&tvc->metadirty); #endif i = VCHash(afid); @@ -1153,8 +1203,8 @@ restart: osi_dnlc_purgedp(tvc); /* this may be overkill */ memset((char *)&(tvc->callsort), 0, sizeof(struct afs_q)); tvc->slocks = NULL; - tvc->states &=~ CVInit; - afs_osi_Wakeup(&tvc->states); + tvc->f.states &=~ CVInit; + afs_osi_Wakeup(&tvc->f.states); return tvc; @@ -1184,10 +1234,10 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) ObtainReadLock(&afs_xvcache); for (i = 0; i < VCSIZE; i++) { for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { - if (tvc->states & CVInit) continue; + if (tvc->f.states & CVInit) continue; #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode && - (tvc->states & (CCore|CUnlinkedDel) || + if (tvc->f.states & CDeadVnode && + (tvc->f.states & (CCore|CUnlinkedDel) || tvc->flockCount)) panic("Dead vnode has core/unlinkedel/flock"); #endif if (doflocks && tvc->flockCount != 0) { @@ -1199,20 +1249,20 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) afs_InitReq(&treq, afs_osi_credp); treq.flags |= O_NONBLOCK; - tc = afs_Conn(&tvc->fid, &treq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, &treq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_EXTENDLOCK); RX_AFS_GUNLOCK(); code = RXAFS_ExtendLock(tc->id, - (struct AFSFid *)&tvc->fid.Fid, + (struct AFSFid *)&tvc->f.fid.Fid, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &tvc->fid, &treq, + (tc, code, &tvc->f.fid, &treq, AFS_STATS_FS_RPCIDX_EXTENDLOCK, SHARED_LOCK, NULL)); ReleaseWriteLock(&tvc->lock); @@ -1225,7 +1275,7 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) #endif } didCore = 0; - if ((tvc->states & CCore) || (tvc->states & CUnlinkedDel)) { + if ((tvc->f.states & CCore) || (tvc->f.states & CUnlinkedDel)) { /* * Don't let it evaporate in case someone else is in * this code. Also, drop the afs_xvcache lock while @@ -1244,8 +1294,8 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) AFS_RWLOCK((vnode_t *) tvc, VRWLOCK_WRITE); #endif ObtainWriteLock(&tvc->lock, 52); - if (tvc->states & CCore) { - tvc->states &= ~CCore; + if (tvc->f.states & CCore) { + tvc->f.states &= ~CCore; /* XXXX Find better place-holder for cred XXXX */ cred = (struct AFS_UCRED *)tvc->linkData; tvc->linkData = NULL; /* XXX */ @@ -1262,10 +1312,10 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) osi_FlushText(tvc); didCore = 1; if (code && code != VNOVNODE) { - afs_StoreWarn(code, tvc->fid.Fid.Volume, + afs_StoreWarn(code, tvc->f.fid.Fid.Volume, /* /dev/console */ 1); } - } else if (tvc->states & CUnlinkedDel) { + } else if (tvc->f.states & CUnlinkedDel) { /* * Ignore errors */ @@ -1363,12 +1413,12 @@ afs_VerifyVCache2(struct vcache *avc, struct vrequest *areq) /* otherwise we must fetch the status info */ ObtainWriteLock(&avc->lock, 53); - if (avc->states & CStatd) { + if (avc->f.states & CStatd) { ReleaseWriteLock(&avc->lock); return 0; } ObtainWriteLock(&afs_xcbhash, 461); - avc->states &= ~(CStatd | CUnique); + avc->f.states &= ~(CStatd | CUnique); avc->callback = NULL; afs_DequeueCallback(avc); ReleaseWriteLock(&afs_xcbhash); @@ -1378,13 +1428,13 @@ afs_VerifyVCache2(struct vcache *avc, struct vrequest *areq) * it's possible that the contents of this directory, or this * file's name have changed, thus invalidating the dnlc contents. */ - if ((avc->states & CForeign) || (avc->fid.Fid.Vnode & 1)) + if ((avc->f.states & CForeign) || (avc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(avc); else osi_dnlc_purgevp(avc); /* fetch the status info */ - tvc = afs_GetVCache(&avc->fid, areq, NULL, avc); + tvc = afs_GetVCache(&avc->f.fid, areq, NULL, avc); if (!tvc) return ENOENT; /* Put it back; caller has already incremented vrefCount */ @@ -1424,7 +1474,7 @@ afs_SimpleVStat(register struct vcache *avc, #if defined(AFS_SGI_ENV) osi_Assert((valusema(&avc->vc_rwlock) <= 0) && (OSI_GET_LOCKID() == avc->vc_rwlockid)); - if (length < avc->m.Length) { + if (length < avc->f.m.Length) { vnode_t *vp = (vnode_t *) avc; osi_Assert(WriteLocked(&avc->lock)); @@ -1437,26 +1487,26 @@ afs_SimpleVStat(register struct vcache *avc, #endif /* if writing the file, don't fetch over this value */ afs_Trace3(afs_iclSetp, CM_TRACE_SIMPLEVSTAT, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(length)); - avc->m.Length = length; - avc->m.Date = astat->ClientModTime; + avc->f.m.Length = length; + avc->f.m.Date = astat->ClientModTime; } - avc->m.Owner = astat->Owner; - avc->m.Group = astat->Group; - avc->m.Mode = astat->UnixModeBits; + avc->f.m.Owner = astat->Owner; + avc->f.m.Group = astat->Group; + avc->f.m.Mode = astat->UnixModeBits; if (vType(avc) == VREG) { - avc->m.Mode |= S_IFREG; + avc->f.m.Mode |= S_IFREG; } else if (vType(avc) == VDIR) { - avc->m.Mode |= S_IFDIR; + avc->f.m.Mode |= S_IFDIR; } else if (vType(avc) == VLNK) { - avc->m.Mode |= S_IFLNK; - if ((avc->m.Mode & 0111) == 0) + avc->f.m.Mode |= S_IFLNK; + if ((avc->f.m.Mode & 0111) == 0) avc->mvstat = 1; } - if (avc->states & CForeign) { + if (avc->f.states & CForeign) { struct axscache *ac; - avc->anyAccess = astat->AnonymousAccess; + avc->f.anyAccess = astat->AnonymousAccess; #ifdef badidea if ((astat->CallerAccess & ~astat->AnonymousAccess)) /* USED TO SAY : @@ -1480,7 +1530,6 @@ afs_SimpleVStat(register struct vcache *avc, afs_AddAxs(avc->Access, areq->uid, astat->CallerAccess); } - } /*afs_SimpleVStat */ @@ -1509,21 +1558,21 @@ afs_WriteVCache(register struct vcache *avc, XSTATS_DECLS; AFS_STATCNT(afs_WriteVCache); afs_Trace2(afs_iclSetp, CM_TRACE_WVCACHE, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); do { - tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STORESTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_StoreStatus(tc->id, (struct AFSFid *)&avc->fid.Fid, + RXAFS_StoreStatus(tc->id, (struct AFSFid *)&avc->f.fid.Fid, astatus, &OutStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_STORESTATUS, + (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STORESTATUS, SHARED_LOCK, NULL)); UpgradeSToWLock(&avc->lock, 20); @@ -1535,14 +1584,14 @@ afs_WriteVCache(register struct vcache *avc, * it thought we were doing this after fetching new status * over a file being written. */ - avc->m.Date = OutStatus.ClientModTime; + avc->f.m.Date = OutStatus.ClientModTime; } else { /* failure, set up to check with server next time */ ObtainWriteLock(&afs_xcbhash, 462); afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CUnique); /* turn off stat valid flag */ + avc->f.states &= ~(CStatd | CUnique); /* turn off stat valid flag */ ReleaseWriteLock(&afs_xcbhash); - if ((avc->states & CForeign) || (avc->fid.Fid.Vnode & 1)) + if ((avc->f.states & CForeign) || (avc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(avc); /* if it (could be) a directory */ } ConvertWToSLock(&avc->lock); @@ -1578,32 +1627,32 @@ int afs_WriteVCacheDiscon(register struct vcache *avc, /* Set attributes. */ if (astatus->Mask & AFS_SETMODTIME) { - avc->m.Date = astatus->ClientModTime; + avc->f.m.Date = astatus->ClientModTime; flags |= VDisconSetTime; } if (astatus->Mask & AFS_SETOWNER) { printf("Not allowed yet. \n"); - //avc->m.Owner = astatus->Owner; + //avc->f.m.Owner = astatus->Owner; } if (astatus->Mask & AFS_SETGROUP) { printf("Not allowed yet. \n"); - //avc->m.Group = astatus->Group; + //avc->f.m.Group = astatus->Group; } if (astatus->Mask & AFS_SETMODE) { - avc->m.Mode = astatus->UnixModeBits; + avc->f.m.Mode = astatus->UnixModeBits; #if 0 /* XXX: Leaving this out, so it doesn't mess up the file type flag.*/ if (vType(avc) == VREG) { - avc->m.Mode |= S_IFREG; + avc->f.m.Mode |= S_IFREG; } else if (vType(avc) == VDIR) { - avc->m.Mode |= S_IFDIR; + avc->f.m.Mode |= S_IFDIR; } else if (vType(avc) == VLNK) { - avc->m.Mode |= S_IFLNK; - if ((avc->m.Mode & 0111) == 0) + avc->f.m.Mode |= S_IFLNK; + if ((avc->f.m.Mode & 0111) == 0) avc->mvstat = 1; } #endif @@ -1671,35 +1720,35 @@ afs_ProcessFS(register struct vcache *avc, * values. */ afs_Trace3(afs_iclSetp, CM_TRACE_PROCESSFS, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(length)); - avc->m.Length = length; - avc->m.Date = astat->ClientModTime; - } - hset64(avc->m.DataVersion, astat->dataVersionHigh, astat->DataVersion); - avc->m.Owner = astat->Owner; - avc->m.Mode = astat->UnixModeBits; - avc->m.Group = astat->Group; - avc->m.LinkCount = astat->LinkCount; + avc->f.m.Length = length; + avc->f.m.Date = astat->ClientModTime; + } + hset64(avc->f.m.DataVersion, astat->dataVersionHigh, astat->DataVersion); + avc->f.m.Owner = astat->Owner; + avc->f.m.Mode = astat->UnixModeBits; + avc->f.m.Group = astat->Group; + avc->f.m.LinkCount = astat->LinkCount; if (astat->FileType == File) { vSetType(avc, VREG); - avc->m.Mode |= S_IFREG; + avc->f.m.Mode |= S_IFREG; } else if (astat->FileType == Directory) { vSetType(avc, VDIR); - avc->m.Mode |= S_IFDIR; + avc->f.m.Mode |= S_IFDIR; } else if (astat->FileType == SymbolicLink) { - if (afs_fakestat_enable && (avc->m.Mode & 0111) == 0) { + if (afs_fakestat_enable && (avc->f.m.Mode & 0111) == 0) { vSetType(avc, VDIR); - avc->m.Mode |= S_IFDIR; + avc->f.m.Mode |= S_IFDIR; } else { vSetType(avc, VLNK); - avc->m.Mode |= S_IFLNK; + avc->f.m.Mode |= S_IFLNK; } - if ((avc->m.Mode & 0111) == 0) { + if ((avc->f.m.Mode & 0111) == 0) { avc->mvstat = 1; } } - avc->anyAccess = astat->AnonymousAccess; + avc->f.anyAccess = astat->AnonymousAccess; #ifdef badidea if ((astat->CallerAccess & ~astat->AnonymousAccess)) /* USED TO SAY : @@ -1845,9 +1894,9 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, if (tvc) { if (cached) *cached = 1; - osi_Assert((tvc->states & CVInit) == 0); + osi_Assert((tvc->f.states & CVInit) == 0); /* If we are in readdir, return the vnode even if not statd */ - if ((tvc->states & CStatd) || afs_InReadDir(tvc)) { + if ((tvc->f.states & CStatd) || afs_InReadDir(tvc)) { ReleaseSharedLock(&afs_xvcache); return tvc; } @@ -1872,7 +1921,7 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, ObtainWriteLock(&tvc->lock, 54); - if (tvc->states & CStatd) { + if (tvc->f.states & CStatd) { ReleaseWriteLock(&tvc->lock); return tvc; } @@ -1964,7 +2013,7 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, #endif ObtainWriteLock(&afs_xcbhash, 464); - tvc->states &= ~CUnique; + tvc->f.states &= ~CUnique; tvc->callback = 0; afs_DequeueCallback(tvc); ReleaseWriteLock(&afs_xcbhash); @@ -1975,16 +2024,16 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, if (tvp) { if ((tvp->states & VForeign)) { if (newvcache) - tvc->states |= CForeign; + tvc->f.states |= CForeign; if (newvcache && (tvp->rootVnode == afid->Fid.Vnode) && (tvp->rootUnique == afid->Fid.Unique)) { tvc->mvstat = 2; } } if (tvp->states & VRO) - tvc->states |= CRO; + tvc->f.states |= CRO; if (tvp->states & VBackup) - tvc->states |= CBackup; + tvc->f.states |= CBackup; /* now copy ".." entry back out of volume structure, if necessary */ if (tvc->mvstat == 2 && tvp->dotdot.Fid.Volume != 0) { if (!tvc->mvid) @@ -2002,9 +2051,9 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, if (afs_DynrootNewVnode(tvc, &OutStatus)) { afs_ProcessFS(tvc, &OutStatus, areq); - tvc->states |= CStatd | CUnique; - tvc->parentVnode = OutStatus.ParentVnode; - tvc->parentUnique = OutStatus.ParentUnique; + tvc->f.states |= CStatd | CUnique; + tvc->f.parent.vnode = OutStatus.ParentVnode; + tvc->f.parent.unique = OutStatus.ParentUnique; code = 0; } else { @@ -2024,9 +2073,13 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, * its parent. */ if (!code && OutStatus.FileType != Directory && - !tvc->parentVnode) { - tvc->parentVnode = OutStatus.ParentVnode; - tvc->parentUnique = OutStatus.ParentUnique; + !tvc->f.parent.vnode) { + tvc->f.parent.vnode = OutStatus.ParentVnode; + tvc->f.parent.unique = OutStatus.ParentUnique; + /* XXX - SXW - It's conceivable we should mark ourselves + * as dirty again here, incase we've been raced + * out of the FetchStatus call. + */ } } } @@ -2094,14 +2147,14 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, } ObtainReadLock(&tvc->lock); - if (tvc->states & CStatd) { + if (tvc->f.states & CStatd) { if (cached) { *cached = 1; } ReleaseReadLock(&tvc->lock); return tvc; } - tvc->states &= ~CUnique; + tvc->f.states &= ~CUnique; ReleaseReadLock(&tvc->lock); afs_PutVCache(tvc); @@ -2120,7 +2173,7 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, code = ENETDOWN; } else code = - afs_RemoteLookup(&adp->fid, areq, aname, &nfid, &OutStatus, + afs_RemoteLookup(&adp->f.fid, areq, aname, &nfid, &OutStatus, &CallBack, &serverp, &tsync); #if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV) @@ -2159,15 +2212,15 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, if (tvp) { if ((tvp->states & VForeign)) { if (newvcache) - tvc->states |= CForeign; + tvc->f.states |= CForeign; if (newvcache && (tvp->rootVnode == afid->Fid.Vnode) && (tvp->rootUnique == afid->Fid.Unique)) tvc->mvstat = 2; } if (tvp->states & VRO) - tvc->states |= CRO; + tvc->f.states |= CRO; if (tvp->states & VBackup) - tvc->states |= CBackup; + tvc->f.states |= CBackup; /* now copy ".." entry back out of volume structure, if necessary */ if (tvc->mvstat == 2 && tvp->dotdot.Fid.Volume != 0) { if (!tvc->mvid) @@ -2180,9 +2233,9 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, if (code) { ObtainWriteLock(&afs_xcbhash, 465); afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CUnique); + tvc->f.states &= ~(CStatd | CUnique); ReleaseWriteLock(&afs_xcbhash); - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ if (tvp) afs_PutVolume(tvp, READ_LOCK); @@ -2196,28 +2249,28 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, if (CallBack.ExpirationTime) { tvc->callback = serverp; tvc->cbExpires = CallBack.ExpirationTime + now; - tvc->states |= CStatd | CUnique; - tvc->states &= ~CBulkFetching; + tvc->f.states |= CStatd | CUnique; + tvc->f.states &= ~CBulkFetching; afs_QueueCallback(tvc, CBHash(CallBack.ExpirationTime), tvp); - } else if (tvc->states & CRO) { + } else if (tvc->f.states & CRO) { /* adapt gives us an hour. */ tvc->cbExpires = 3600 + osi_Time(); - /*XXX*/ tvc->states |= CStatd | CUnique; - tvc->states &= ~CBulkFetching; + /*XXX*/ tvc->f.states |= CStatd | CUnique; + tvc->f.states &= ~CBulkFetching; afs_QueueCallback(tvc, CBHash(3600), tvp); } else { tvc->callback = NULL; afs_DequeueCallback(tvc); - tvc->states &= ~(CStatd | CUnique); - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + tvc->f.states &= ~(CStatd | CUnique); + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ } } else { afs_DequeueCallback(tvc); - tvc->states &= ~CStatd; - tvc->states &= ~CUnique; + tvc->f.states &= ~CStatd; + tvc->f.states &= ~CUnique; tvc->callback = NULL; - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ } ReleaseWriteLock(&afs_xcbhash); @@ -2282,10 +2335,10 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, ObtainSharedLock(&afs_xvcache, 7); i = VCHash(afid); for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { - if (!FidCmp(&(tvc->fid), afid)) { - if (tvc->states & CVInit) { + if (!FidCmp(&(tvc->f.fid), afid)) { + if (tvc->f.states & CVInit) { ReleaseSharedLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto rootvc_loop; } #ifdef AFS_OSF_ENV @@ -2300,9 +2353,9 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, continue; #endif /* AFS_OSF_ENV */ #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { ReleaseSharedLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto rootvc_loop; } tvp = AFSTOV(tvc); @@ -2320,7 +2373,7 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, } } - if (!haveStatus && (!tvc || !(tvc->states & CStatd))) { + if (!haveStatus && (!tvc || !(tvc->f.states & CStatd))) { /* Mount point no longer stat'd or unknown. FID may have changed. */ #ifdef AFS_OSF_ENV if (tvc) @@ -2386,12 +2439,12 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, ReleaseWriteLock(&afs_xvcache); - if (tvc->states & CStatd) { + if (tvc->f.states & CStatd) { return tvc; } else { ObtainReadLock(&tvc->lock); - tvc->states &= ~CUnique; + tvc->f.states &= ~CUnique; tvc->callback = NULL; /* redundant, perhaps */ ReleaseReadLock(&tvc->lock); } @@ -2402,11 +2455,11 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, afs_FreeAllAxs(&(tvc->Access)); if (newvcache) - tvc->states |= CForeign; + tvc->f.states |= CForeign; if (tvolp->states & VRO) - tvc->states |= CRO; + tvc->f.states |= CRO; if (tvolp->states & VBackup) - tvc->states |= CBackup; + tvc->f.states |= CBackup; /* now copy ".." entry back out of volume structure, if necessary */ if (newvcache && (tvolp->rootVnode == afid->Fid.Vnode) && (tvolp->rootUnique == afid->Fid.Unique)) { @@ -2437,9 +2490,9 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, ObtainWriteLock(&afs_xcbhash, 467); afs_DequeueCallback(tvc); tvc->callback = NULL; - tvc->states &= ~(CStatd | CUnique); + tvc->f.states &= ~(CStatd | CUnique); ReleaseWriteLock(&afs_xcbhash); - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ ReleaseWriteLock(&tvc->lock); afs_PutVCache(tvc); @@ -2448,25 +2501,25 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, ObtainWriteLock(&afs_xcbhash, 468); if (origCBs == afs_allCBs) { - tvc->states |= CTruth; + tvc->f.states |= CTruth; tvc->callback = serverp; if (CallBack.ExpirationTime != 0) { tvc->cbExpires = CallBack.ExpirationTime + start; - tvc->states |= CStatd; - tvc->states &= ~CBulkFetching; + tvc->f.states |= CStatd; + tvc->f.states &= ~CBulkFetching; afs_QueueCallback(tvc, CBHash(CallBack.ExpirationTime), tvolp); - } else if (tvc->states & CRO) { + } else if (tvc->f.states & CRO) { /* adapt gives us an hour. */ tvc->cbExpires = 3600 + osi_Time(); - /*XXX*/ tvc->states |= CStatd; - tvc->states &= ~CBulkFetching; + /*XXX*/ tvc->f.states |= CStatd; + tvc->f.states &= ~CBulkFetching; afs_QueueCallback(tvc, CBHash(3600), tvolp); } } else { afs_DequeueCallback(tvc); tvc->callback = NULL; - tvc->states &= ~(CStatd | CUnique); - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + tvc->f.states &= ~(CStatd | CUnique); + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ } ReleaseWriteLock(&afs_xcbhash); @@ -2506,37 +2559,36 @@ afs_UpdateStatus(struct vcache *avc, volp = afs_GetVolume(afid, areq, READ_LOCK); ObtainWriteLock(&afs_xcbhash, 469); - avc->states |= CTruth; + avc->f.states |= CTruth; if (avc->callback /* check for race */ ) { if (acb->ExpirationTime != 0) { avc->cbExpires = acb->ExpirationTime + start; - avc->states |= CStatd; - avc->states &= ~CBulkFetching; + avc->f.states |= CStatd; + avc->f.states &= ~CBulkFetching; afs_QueueCallback(avc, CBHash(acb->ExpirationTime), volp); - } else if (avc->states & CRO) { + } else if (avc->f.states & CRO) { /* ordinary callback on a read-only volume -- AFS 3.2 style */ avc->cbExpires = 3600 + start; - avc->states |= CStatd; - avc->states &= ~CBulkFetching; + avc->f.states |= CStatd; + avc->f.states &= ~CBulkFetching; afs_QueueCallback(avc, CBHash(3600), volp); } else { afs_DequeueCallback(avc); avc->callback = NULL; - avc->states &= ~(CStatd | CUnique); - if ((avc->states & CForeign) || (avc->fid.Fid.Vnode & 1)) + avc->f.states &= ~(CStatd | CUnique); + if ((avc->f.states & CForeign) || (avc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(avc); /* if it (could be) a directory */ } } else { afs_DequeueCallback(avc); avc->callback = NULL; - avc->states &= ~(CStatd | CUnique); - if ((avc->states & CForeign) || (avc->fid.Fid.Vnode & 1)) + avc->f.states &= ~(CStatd | CUnique); + if ((avc->f.states & CForeign) || (avc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(avc); /* if it (could be) a directory */ } ReleaseWriteLock(&afs_xcbhash); if (volp) afs_PutVolume(volp, READ_LOCK); - } /*! @@ -2658,8 +2710,8 @@ afs_StuffVcache(register struct VenusFid *afid, ReleaseSharedLock(&afs_xvcache); ObtainWriteLock(&tvc->lock, 58); - tvc->states &= ~CStatd; - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + tvc->f.states &= ~CStatd; + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ /* Is it always appropriate to throw away all the access rights? */ @@ -2669,11 +2721,11 @@ afs_StuffVcache(register struct VenusFid *afid, tvp = afs_GetVolume(afid, areq, READ_LOCK); if (tvp) { if (newvcache && (tvp->states & VForeign)) - tvc->states |= CForeign; + tvc->f.states |= CForeign; if (tvp->states & VRO) - tvc->states |= CRO; + tvc->f.states |= CRO; if (tvp->states & VBackup) - tvc->states |= CBackup; + tvc->f.states |= CBackup; /* * Now, copy ".." entry back out of volume structure, if * necessary @@ -2702,20 +2754,20 @@ afs_StuffVcache(register struct VenusFid *afid, ObtainWriteLock(&afs_xcbhash, 470); if (CallBack->ExpirationTime != 0) { tvc->cbExpires = CallBack->ExpirationTime + osi_Time() - 1; - tvc->states |= CStatd; - tvc->states &= ~CBulkFetching; + tvc->f.states |= CStatd; + tvc->f.states &= ~CBulkFetching; afs_QueueCallback(tvc, CBHash(CallBack->ExpirationTime), tvp); - } else if (tvc->states & CRO) { + } else if (tvc->f.states & CRO) { /* old-fashioned AFS 3.2 style */ tvc->cbExpires = 3600 + osi_Time(); - /*XXX*/ tvc->states |= CStatd; - tvc->states &= ~CBulkFetching; + /*XXX*/ tvc->f.states |= CStatd; + tvc->f.states &= ~CBulkFetching; afs_QueueCallback(tvc, CBHash(3600), tvp); } else { afs_DequeueCallback(tvc); tvc->callback = NULL; - tvc->states &= ~(CStatd | CUnique); - if ((tvc->states & CForeign) || (tvc->fid.Fid.Vnode & 1)) + tvc->f.states &= ~(CStatd | CUnique); + if ((tvc->f.states & CForeign) || (tvc->f.fid.Fid.Vnode & 1)) osi_dnlc_purgedp(tvc); /* if it (could be) a directory */ } ReleaseWriteLock(&afs_xcbhash); @@ -2777,12 +2829,12 @@ void afs_ResetVCache(struct vcache *avc, struct AFS_UCRED *acred) { ObtainWriteLock(&afs_xcbhash, 456); afs_DequeueCallback(avc); - avc->states &= ~(CStatd | CDirty); /* next reference will re-stat */ + avc->f.states &= ~(CStatd | CDirty); /* next reference will re-stat */ ReleaseWriteLock(&afs_xcbhash); /* now find the disk cache entries */ afs_TryToSmush(avc, acred, 1); osi_dnlc_purgedp(avc); - if (avc->linkData && !(avc->states & CCore)) { + if (avc->linkData && !(avc->f.states & CCore)) { afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1); avc->linkData = NULL; } @@ -2807,7 +2859,7 @@ static void findvc_sleep(struct vcache *avc, int flag) { ReleaseReadLock(&afs_xvcache); } } - afs_osi_Sleep(&avc->states); + afs_osi_Sleep(&avc->f.states); if (flag & IS_SLOCK) { ObtainSharedLock(&afs_xvcache, 341); } else { @@ -2851,7 +2903,7 @@ afs_FindVCache(struct VenusFid *afid, afs_int32 * retry, afs_int32 flag) i = VCHash(afid); for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { if (FidMatches(afid, tvc)) { - if (tvc->states & CVInit) { + if (tvc->f.states & CVInit) { findvc_sleep(tvc, flag); goto findloop; } @@ -2864,7 +2916,7 @@ afs_FindVCache(struct VenusFid *afid, afs_int32 * retry, afs_int32 flag) continue; #endif /* AFS_OSF_ENV */ #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { findvc_sleep(tvc, flag); goto findloop; } @@ -2893,14 +2945,14 @@ afs_FindVCache(struct VenusFid *afid, afs_int32 * retry, afs_int32 flag) return 0; #endif #if defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN80_ENV) - tvc->states |= CUBCinit; + tvc->f.states |= CUBCinit; AFS_GUNLOCK(); if (UBCINFOMISSING(AFSTOV(tvc)) || UBCINFORECLAIMED(AFSTOV(tvc))) { ubc_info_init(AFSTOV(tvc)); } AFS_GLOCK(); - tvc->states &= ~CUBCinit; + tvc->f.states &= ~CUBCinit; #endif /* * only move to front of vlru if we have proper vcache locking) @@ -2988,13 +3040,13 @@ afs_NFSFindVCache(struct vcache **avcp, struct VenusFid *afid) i = VCHash(afid); for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { /* Match only on what we have.... */ - if (((tvc->fid.Fid.Vnode & 0xffff) == afid->Fid.Vnode) - && (tvc->fid.Fid.Volume == afid->Fid.Volume) - && ((tvc->fid.Fid.Unique & 0xffffff) == afid->Fid.Unique) - && (tvc->fid.Cell == afid->Cell)) { - if (tvc->states & CVInit) { + if (((tvc->f.fid.Fid.Vnode & 0xffff) == afid->Fid.Vnode) + && (tvc->f.fid.Fid.Volume == afid->Fid.Volume) + && ((tvc->f.fid.Fid.Unique & 0xffffff) == afid->Fid.Unique) + && (tvc->f.fid.Cell == afid->Cell)) { + if (tvc->f.states & CVInit) { ReleaseSharedLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop; } #ifdef AFS_OSF_ENV @@ -3008,9 +3060,9 @@ afs_NFSFindVCache(struct vcache **avcp, struct VenusFid *afid) } #endif /* AFS_OSF_ENV */ #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { ReleaseSharedLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop; } tvp = AFSTOV(tvc); @@ -3292,7 +3344,7 @@ void afs_DisconGiveUpCallbacks() { /* Somehow, walk the set of vcaches, with each one coming out as tvc */ for (i = 0; i < VCSIZE; i++) { for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { - if ((tvc->states & CRO) == 0 && tvc->callback) { + if ((tvc->f.states & CRO) == 0 && tvc->callback) { afs_QueueVCB(tvc); tvc->callback = NULL; nq++; @@ -3322,9 +3374,8 @@ void afs_ClearAllStatdFlag() { for (i = 0; i < VCSIZE; i++) { for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { - tvc->states &= ~(CStatd|CUnique); + tvc->f.states &= ~(CStatd|CUnique); } } ReleaseWriteLock(&afs_xvcache); } - diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 6760a70..cff5801 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -331,25 +331,25 @@ loop: if ((flags & (AFS_VOLCHECK_FORCE | AFS_VOLCHECK_MTPTS)) || (tvc->mvid && inVolList(tvc->mvid, nvols, volumeID, cellID))) - tvc->states &= ~CMValid; + tvc->f.states &= ~CMValid; /* If the volume that this file belongs to was reset earlier, * then we should remove its callback. * Again, if forced, always do it. */ - if ((tvc->states & CRO) - && (inVolList(&tvc->fid, nvols, volumeID, cellID) + if ((tvc->f.states & CRO) + && (inVolList(&tvc->f.fid, nvols, volumeID, cellID) || (flags & AFS_VOLCHECK_FORCE))) { - if (tvc->states & CVInit) { + if (tvc->f.states & CVInit) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop; } #ifdef AFS_DARWIN80_ENV - if (tvc->states & CDeadVnode) { + if (tvc->f.states & CDeadVnode) { ReleaseReadLock(&afs_xvcache); - afs_osi_Sleep(&tvc->states); + afs_osi_Sleep(&tvc->f.states); goto loop; } tvp = AFSTOV(tvc); @@ -370,9 +370,9 @@ loop: ObtainWriteLock(&afs_xcbhash, 485); /* LOCKXXX: We aren't holding tvc write lock? */ afs_DequeueCallback(tvc); - tvc->states &= ~CStatd; + tvc->f.states &= ~CStatd; ReleaseWriteLock(&afs_xcbhash); - if (tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)) + if (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)) osi_dnlc_purgedp(tvc); #ifdef AFS_DARWIN80_ENV diff --git a/src/afs/discon.h b/src/afs/discon.h index b659eda..869fb90 100644 --- a/src/afs/discon.h +++ b/src/afs/discon.h @@ -62,7 +62,7 @@ extern void afs_DisconDiscardAll(struct AFS_UCRED *); /* Call with avc lock held */ static inline void afs_DisconAddDirty(struct vcache *avc, int operation, int lock) { - if (!avc->ddirty_flags) { + if (!avc->f.ddirty_flags) { if (lock) ObtainWriteLock(&afs_xvcache, 702); ObtainWriteLock(&afs_disconDirtyLock, 703); @@ -72,7 +72,7 @@ static inline void afs_DisconAddDirty(struct vcache *avc, int operation, int loc if (lock) ReleaseWriteLock(&afs_xvcache); } - avc->ddirty_flags |= operation; + avc->f.ddirty_flags |= operation; } /* Call with avc lock held */ @@ -80,9 +80,8 @@ static inline void afs_DisconRemoveDirty(struct vcache *avc) { ObtainWriteLock(&afs_disconDirtyLock, 704); QRemove(&avc->dirtyq); ReleaseWriteLock(&afs_disconDirtyLock); - avc->ddirty_flags = 0; + avc->f.ddirty_flags = 0; afs_PutVCache(avc); } - #endif /* AFS_DISCON_ENV */ #endif /* _DISCON_H */