This source file includes following definitions.
- nfs_bl_cache_invalidate
- nfs_bl_cache_revalidate
- nfs_cache_find
1
2 void nfs_bl_cache_invalidate(nfs_cache *nh)
3 {
4 unsigned long flags;
5 save_flags(flags);
6 cli();
7 if(nh->inuse)
8 nh->dead=1;
9 else
10 {
11 kfree_s(nh->data);
12 nh->data=NULL;
13 nh->free=1;
14 }
15 }
16
17 void nfs_bl_cache_revalidate(nfs_cache *nh, struct fattr fa)
18 {
19 nh->fattr=fattr;
20 nh->time=jiffies;
21 }
22
23
24
25
26
27
28 nfs_cache *nfs_cache_find(struct inode *inode, off_t pos)
29 {
30 nfs_cache *nh=&nfs_cache_slot[0];
31 nfs_cache *ffree=NULL;
32 struct nfs_fattr fattr;
33 int ct=0;
34 while(ct<NH_CACHE_SIZE)
35 {
36 if(nh->inode_num==inode->i_no && !nh->dead&&!nh->free&&nh->file_pos==pos)
37 {
38 if(abs(jiffies-nh->time)<EXPIRE_CACHE)
39 return nh;
40
41
42
43
44 if(nfs_proc_getattr(NFS_SERVER(inode), NFS_FH(inode), &fattr))
45 {
46 nfs_bl_cache_invalidate(nh);
47 continue;
48 }
49 if(nh->fattr.modified!=fattr.modified)
50 {
51 nfs_bl_cache_invalidate(nh);
52 continue;
53 }
54 nfs_refresh_inode(inode, fattr);
55 nh->fattr=fattr;
56 nfs_bl_cache_revalidate(nh);
57 return nh;
58 }
59 if(nh->free)
60 ffree=nh;
61 }
62 return ffree;
63 }