Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / afs / HPUX / osi_vm.c
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 */
9
10 #include <afsconfig.h>
11 #include "afs/param.h"
12
13
14 #include "afs/sysincludes.h" /* Standard vendor system headers */
15 #include "afsincludes.h" /* Afs-based standard headers */
16 #include "afs/afs_stats.h" /* statistics */
17
18 /* Try to discard pages, in order to recycle a vcache entry.
19 *
20 * We also make some sanity checks: ref count, open count, held locks.
21 *
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).
24 *
25 * Locking: afs_xvcache lock is held. It must not be dropped.
26 */
27 int
28 osi_VM_FlushVCache(struct vcache *avc)
29 {
30 if (avc->vrefCount > 1)
31 return EBUSY;
32
33 if (avc->opens)
34 return EBUSY;
35
36 return 0;
37 }
38
39 /* Try to store pages to cache, in order to store a file back to the server.
40 *
41 * Locking: the vcache entry's lock is held. It will usually be dropped and
42 * re-obtained.
43 */
44 void
45 osi_VM_StoreAllSegments(struct vcache *avc)
46 {
47 ; /* Nothing here yet */
48 }
49
50 /* Try to invalidate pages, for "fs flush" or "fs flushv"; or
51 * try to free pages, when deleting a file.
52 *
53 * Locking: the vcache entry's lock is held. It may be dropped and
54 * re-obtained.
55 */
56 void
57 osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync)
58 {
59 struct vnode *vp = AFSTOV(avc);
60
61 /* Flush the delayed write blocks associated with this vnode
62 * from the buffer cache
63 */
64 if ((vp->v_flag & VTEXT) == 0) {
65 mpurge(vp);
66 }
67 /* Mark the cached blocks on the free list as invalid; it invalidates blocks
68 * associated with vp which are on the freelist.
69 */
70 binvalfree(vp);
71 mpurge(vp);
72 }
73
74 /* Purge VM for a file when its callback is revoked.
75 *
76 * Locking: No lock is held, not even the global lock.
77 */
78 void
79 osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
80 {
81 ; /* Nothing here yet */
82 }
83
84 /* Purge pages beyond end-of-file, when truncating a file.
85 *
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.
89 */
90 void
91 osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred)
92 {
93 ; /* Nothing here yet */
94 }