2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include "afs/param.h"
13 #include "afs/sysincludes.h" /*Standard vendor system headers */
14 #include "afsincludes.h" /*AFS-based standard headers */
17 osi_TryEvictVCache(struct vcache *avc, int *slept) {
20 struct dentry *dentry;
21 struct list_head *cur, *head;
23 /* First, see if we can evict the inode from the dcache */
24 if (avc != afs_globalVp && VREFCOUNT(avc) > 1 && avc->opens == 0) {
26 ReleaseWriteLock(&afs_xvcache);
28 spin_lock(&dcache_lock);
29 head = &(AFSTOV(avc))->i_dentry;
33 while ((cur = cur->next) != head) {
34 dentry = list_entry(cur, struct dentry, d_alias);
36 if (d_unhashed(dentry))
41 spin_unlock(&dcache_lock);
42 if (d_invalidate(dentry) == -EBUSY) {
44 /* perhaps lock and try to continue? (use cur as head?) */
48 spin_lock(&dcache_lock);
51 spin_unlock(&dcache_lock);
54 ObtainWriteLock(&afs_xvcache, 733);
57 /* See if we can evict it from the VLRUQ */
58 if (VREFCOUNT_GT(avc,0) && !VREFCOUNT_GT(avc,1) && avc->opens == 0
59 && (avc->f.states & CUnlinkedDel) == 0) {
60 int didsleep = *slept;
62 code = afs_FlushVCache(avc, slept);
63 /* flushvcache wipes slept; restore slept if we did before */
81 ip = new_inode(afs_globalVFS);
83 osi_Panic("afs_NewVCache: no more inodes");
85 #if defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
88 tvc = afs_osi_Alloc(sizeof(struct vcache));
89 ip->u.generic_ip = tvc;
97 osi_PrePopulateVCache(struct vcache *avc) {
99 memset(&(avc->f), 0, sizeof(struct fvcache));
104 osi_AttachVnode(struct vcache *avc, int seq) { /* Nada */ }
107 osi_PostPopulateVCache(struct vcache *avc) {