*/
#include <afsconfig.h>
-#include "../afs/param.h"
+#include "afs/param.h"
-RCSID("$Header$");
-#include "../afs/sysincludes.h" /* Standard vendor system headers */
-#include "../afs/afsincludes.h" /* Afs-based standard headers */
-#include "../afs/afs_stats.h" /* statistics */
+#include "afs/sysincludes.h" /* Standard vendor system headers */
+#include "afsincludes.h" /* Afs-based standard headers */
+#include "afs/afs_stats.h" /* statistics */
#include "sys/flock.h" /* for IGN_PID */
extern struct vnodeops Afs_vnodeops;
* We also do some non-VM-related chores, such as releasing the cred pointer
* (for AIX and Solaris) and releasing the gnode (for AIX).
*
- * Locking: afs_xvcache lock is held. If it is dropped and re-acquired,
- * *slept should be set to warn the caller.
- *
- * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it
- * is not dropped and re-acquired for any platform. It may be that *slept is
- * therefore obsolescent.
+ * Locking: afs_xvcache lock is held. It must not be dropped.
*/
int
-osi_VM_FlushVCache(avc, slept)
- struct vcache *avc;
- int *slept;
+osi_VM_FlushVCache(struct vcache *avc)
{
int s, code;
vnode_t *vp = &avc->v;
* Note that although we checked vcount above, we didn't have the lock
*/
if (vp->v_count > 0 || (vp->v_flag & VINACT)) {
- VN_UNLOCK(vp, s);
+ VN_UNLOCK(vp, s);
return EBUSY;
}
VN_UNLOCK(vp, s);
* Note that we hold the xvcache lock the entire time.
*/
AFS_GUNLOCK();
- PTOSSVP(vp, (off_t)0, (off_t)MAXLONG);
+ PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG);
AFS_GLOCK();
/* afs_chkpgoob will drop and re-acquire the global lock. */
osi_Assert(!AFS_VN_MAPPED(vp));
osi_Assert(!AFS_VN_DIRTY(&avc->v));
-#if defined(AFS_SGI65_ENV)
if (vp->v_filocks)
cleanlocks(vp, IGN_PID, 0);
mutex_destroy(&vp->v_filocksem);
-#else /* AFS_SGI65_ENV */
- if (vp->v_filocksem) {
- if (vp->v_filocks)
-#ifdef AFS_SGI64_ENV
- cleanlocks(vp, &curprocp->p_flid);
-#else
- cleanlocks(vp, IGN_PID, 0);
-#endif
- osi_Assert(vp->v_filocks == NULL);
- mutex_destroy(vp->v_filocksem);
- kmem_free(vp->v_filocksem, sizeof *vp->v_filocksem);
- vp->v_filocksem = NULL;
- }
-#endif /* AFS_SGI65_ENV */
- if (avc->vrefCount) osi_Panic("flushVcache: vm race");
-#ifdef AFS_SGI64_ENV
+ if (avc->vrefCount)
+ osi_Panic("flushVcache: vm race");
AFS_GUNLOCK();
- vnode_pcache_reclaim(vp); /* this can sleep */
+ vnode_pcache_reclaim(vp); /* this can sleep */
vnode_pcache_free(vp);
if (vp->v_op != &Afs_vnodeops) {
VOP_RECLAIM(vp, FSYNC_WAIT, code);
}
AFS_GLOCK();
-#ifdef AFS_SGI65_ENV
#ifdef VNODE_TRACING
ktrace_free(vp->v_trace);
#endif /* VNODE_TRACING */
vn_bhv_head_destroy(&(vp->v_bh));
destroy_bitlock(&vp->v_pcacheflag);
mutex_destroy(&vp->v_buf_lock);
-#else
- bhv_remove(VN_BHV_HEAD(vp), &(avc->vc_bhv_desc));
- bhv_head_destroy(&(vp->v_bh));
-#endif
- vp->v_flag = 0; /* debug */
+ vp->v_flag = 0; /* debug */
#if defined(DEBUG) && defined(VNODE_INIT_BITLOCK)
destroy_bitlock(&vp->v_flag);
#endif
#ifdef INTR_KTHREADS
AFS_VN_DESTROY_BUF_LOCK(vp);
#endif
-#endif /* AFS_SGI64_ENV */
return 0;
}
* be some pages around when we return, newly created by concurrent activity.
*/
void
-osi_VM_TryToSmush(avc, acred, sync)
- struct vcache *avc;
- struct AFS_UCRED *acred;
- int sync;
+osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync)
{
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
/* current remapf restriction - cannot have VOP_RWLOCK */
osi_Assert(OSI_GET_LOCKID() != avc->vc_rwlockid);
- if (((vnode_t *)avc)->v_type == VREG && AFS_VN_MAPPED(((vnode_t *)avc)))
- remapf(((vnode_t *)avc), 0, 0);
- PTOSSVP((struct vnode *)avc, (off_t)0, (off_t)MAXLONG);
+ if (((vnode_t *) avc)->v_type == VREG && AFS_VN_MAPPED(((vnode_t *) avc)))
+ remapf(((vnode_t *) avc), 0, 0);
+ PTOSSVP(AFSTOV(avc), (off_t) 0, (off_t) MAXLONG);
AFS_GLOCK();
- ObtainWriteLock(&avc->lock,62);
+ ObtainWriteLock(&avc->lock, 62);
}
/* Flush and invalidate pages, for fsync() with INVAL flag
* Locking: only the global lock is held.
*/
void
-osi_VM_FSyncInval(avc)
- struct vcache *avc;
+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();
}
* re-obtained.
*/
void
-osi_VM_StoreAllSegments(avc)
- struct vcache *avc;
+osi_VM_StoreAllSegments(struct vcache *avc)
{
int error;
osi_Assert(valusema(&avc->vc_rwlock) <= 0);
AFS_GUNLOCK();
/* Write out dirty pages list to avoid B_DELWRI buffers. */
- while (VN_GET_DPAGES((vnode_t*)avc)) {
- pdflush((struct vnode*)avc, 0);
+ while (VN_GET_DPAGES((vnode_t *) avc)) {
+ pdflush(AFSTOV(avc), 0);
}
- PFLUSHVP((struct vnode *)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) {
/*
* 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)
- cmn_err(CE_WARN, "AFS:Failed to push back pages for vnode 0x%x error %d (from afs_StoreOnLastReference)",
+ ObtainWriteLock(&avc->lock, 121);
+ 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);
}
* Locking: No lock is held, not even the global lock.
*/
void
-osi_VM_FlushPages(avc, credp)
- struct vcache *avc;
- struct AFS_UCRED *credp;
+osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
{
- vnode_t *vp = (vnode_t *)avc;
+ 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.
*/
* ptossvp tosses all pages associated with this vnode
* All in-use pages are marked BAD
*/
- PTOSSVP(vp, (off_t)0, (off_t)MAXLONG);
+ PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG);
}
/* Purge pages beyond end-of-file, when truncating a file.
* it only works on Solaris.
*/
void
-osi_VM_Truncate(avc, alen, acred)
- struct vcache *avc;
- int alen;
- struct AFS_UCRED *acred;
+osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred)
{
- PTOSSVP(&avc->v, (off_t)alen, (off_t)MAXLONG);
+ PTOSSVP(&avc->v, (off_t) alen, (off_t) MAXLONG);
}