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 spin_lock(&dcache_lock);
27 head = &(AFSTOV(avc))->i_dentry;
31 while ((cur = cur->next) != head) {
32 dentry = list_entry(cur, struct dentry, d_alias);
34 if (d_unhashed(dentry))
39 spin_unlock(&dcache_lock);
40 if (d_invalidate(dentry) == -EBUSY) {
42 /* perhaps lock and try to continue? (use cur as head?) */
46 spin_lock(&dcache_lock);
49 spin_unlock(&dcache_lock);
54 /* See if we can evict it from the VLRUQ */
55 if (VREFCOUNT_GT(avc,0) && !VREFCOUNT_GT(avc,1) && avc->opens == 0
56 && (avc->f.states & CUnlinkedDel) == 0) {
58 code = afs_FlushVCache(avc, slept);
73 ip = new_inode(afs_globalVFS);
75 osi_Panic("afs_NewVCache: no more inodes");
77 #if defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
80 tvc = afs_osi_Alloc(sizeof(struct vcache));
81 ip->u.generic_ip = tvc;
89 osi_PrePopulateVCache(struct vcache *avc) {
91 memset(&(avc->f), 0, sizeof(struct fvcache));
96 osi_AttachVnode(struct vcache *avc, int seq) { /* Nada */ }
99 osi_PostPopulateVCache(struct vcache *avc) {