Whamcloud - gitweb
update snapfs 1. fix bug in write table_count in write snap_table 2. fixbug in repla...
[fs/lustre-release.git] / lustre / snapfs / dcache.c
1 /*
2  * Directory operations for SnapFS filesystem
3  */
4
5 #define DEBUG_SUBSYSTEM S_SNAP
6
7 #include <linux/module.h>
8 #include <linux/kernel.h>
9 #include <linux/string.h>
10 #include <linux/slab.h>
11 #include <linux/stat.h>
12 #include <linux/unistd.h>
13 #include <linux/jbd.h>
14 #include <linux/ext3_fs.h>
15 #include <linux/snap.h>
16
17 #include "snapfs_internal.h" 
18
19
20 /* called when a cache lookup succeeds */
21
22 /* XXX PJB: the intent here is to make sure that inodes which are
23    currently primary inodes under .snap directories are dropped when
24    they are COWED.  It seems hard to me to get semantics that are equally
25    good as for mounted snap_clone file systems, but we should try to get
26    close 
27 */
28 static int currentfs_dentry_revalidate(struct dentry *de, int flag)
29 {
30 //      struct inode *inode = de->d_inode;
31         ENTRY;
32
33         /* unless an ancestor is a .snap directory there is nothing to do */
34 #if 0
35         if ( !currentfs_is_under_dotsnap(dentry) ) {
36                 EXIT;
37                 return 1;
38         }
39         /* XXX PJB get this to work guys! */
40         if ( de->d_parent == "dotsnap inode" && 
41              inode_is_newer_than(find_time_by_name(de->d_parent->d_name.name))){
42                 1. drop this dentry 
43                 2. make sure the VFS does a new lookup
44                 3. probably all you need to do is 
45                 return 0;
46         }
47 #else 
48         RETURN(1);
49 #endif
50 }
51
52 struct dentry_operations currentfs_dentry_ops = 
53 {
54         d_revalidate: currentfs_dentry_revalidate
55 };
56