Merge 1.8.0~pre4 packaging into master
[pkg-k5-afs_openafs.git] / src / afs / HPUX / osi_vm.c
blobef87e910800f588d0052568a56b5d8def49f15f5
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #include <afsconfig.h>
11 #include "afs/param.h"
14 #include "afs/sysincludes.h" /* Standard vendor system headers */
15 #include "afsincludes.h" /* Afs-based standard headers */
16 #include "afs/afs_stats.h" /* statistics */
18 /* Try to discard pages, in order to recycle a vcache entry.
20 * We also make some sanity checks: ref count, open count, held locks.
22 * We also do some non-VM-related chores, such as releasing the cred pointer
23 * (for AIX and Solaris) and releasing the gnode (for AIX).
25 * Locking: afs_xvcache lock is held. It must not be dropped.
27 int
28 osi_VM_FlushVCache(struct vcache *avc)
30 if (avc->vrefCount > 1)
31 return EBUSY;
33 if (avc->opens)
34 return EBUSY;
36 return 0;
39 /* Try to store pages to cache, in order to store a file back to the server.
41 * Locking: the vcache entry's lock is held. It will usually be dropped and
42 * re-obtained.
44 void
45 osi_VM_StoreAllSegments(struct vcache *avc)
47 ; /* Nothing here yet */
50 /* Try to invalidate pages, for "fs flush" or "fs flushv"; or
51 * try to free pages, when deleting a file.
53 * Locking: the vcache entry's lock is held. It may be dropped and
54 * re-obtained.
56 void
57 osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync)
59 struct vnode *vp = AFSTOV(avc);
61 /* Flush the delayed write blocks associated with this vnode
62 * from the buffer cache
64 if ((vp->v_flag & VTEXT) == 0) {
65 mpurge(vp);
67 /* Mark the cached blocks on the free list as invalid; it invalidates blocks
68 * associated with vp which are on the freelist.
70 binvalfree(vp);
71 mpurge(vp);
74 /* Purge VM for a file when its callback is revoked.
76 * Locking: No lock is held, not even the global lock.
78 void
79 osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
81 ; /* Nothing here yet */
84 /* Purge pages beyond end-of-file, when truncating a file.
86 * Locking: no lock is held, not even the global lock.
87 * activeV is raised. This is supposed to block pageins, but at present
88 * it only works on Solaris.
90 void
91 osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred)
93 ; /* Nothing here yet */