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 restore_flags(flags);
16 }
17
18 void nfs_bl_cache_revalidate(nfs_cache *nh, struct fattr fa)
19 {
20 nh->fattr=fattr;
21 nh->time=jiffies;
22 }
23
24
25
26
27
28
29 nfs_cache *nfs_cache_find(struct inode *inode, off_t pos)
30 {
31 nfs_cache *nh=&nfs_cache_slot[0];
32 nfs_cache *ffree=NULL;
33 struct nfs_fattr fattr;
34 int ct=0;
35 while(ct<NH_CACHE_SIZE)
36 {
37 if(nh->inode_num==inode->i_no && !nh->dead&&!nh->free&&nh->file_pos==pos)
38 {
39 if(abs(jiffies-nh->time)<EXPIRE_CACHE)
40 return nh;
41
42
43
44
45 if(nfs_proc_getattr(NFS_SERVER(inode), NFS_FH(inode), &fattr))
46 {
47 nfs_bl_cache_invalidate(nh);
48 continue;
49 }
50 if(nh->fattr.modified!=fattr.modified)
51 {
52 nfs_bl_cache_invalidate(nh);
53 continue;
54 }
55 nfs_refresh_inode(inode, fattr);
56 nh->fattr=fattr;
57 nfs_bl_cache_revalidate(nh);
58 return nh;
59 }
60 if(nh->free)
61 ffree=nh;
62 }
63 return ffree;
64 }