(v & 0xFF)
-#define EXT3_EA_TRANS_BLOCKS EXT3_DATA_TRANS_BLOCKS
-#define EXT3_SETMETA_TRANS_BLOCKS EXT3_DATA_TRANS_BLOCKS
-#define EXT3_NEWINODE_TRANS_BLOCKS 10
-#define SNAP_INSERTLIST_TRANS_BLOCKS (2 * EXT3_EA_TRANS_BLOCKS + 1)
-#define SNAP_DELETELIST_TRANS_BLOCKS (2 * EXT3_EA_TRANS_BLOCKS + 2)
-#define SNAP_COPYBLOCK_TRANS_BLOCKS (EXT3_DATA_TRANS_BLOCKS)
-#define SNAP_MIGRATEDATA_TRANS_BLOCKS 2
-#define SNAP_SETIND_TRANS_BLOCKS (SNAP_INSERTLIST_TRANS_BLOCKS + 1)
-#define SNAP_ADDORPHAN_TRANS_BLOCKS 2
-#define SNAP_REMOVEORPHAN_TRANS_BLOCKS 1
-#define SNAP_RESTOREORPHAN_TRANS_BLOCKS (EXT3_EA_TRANS_BLOCKS + \
- SNAP_DELETELIST_TRANS_BLOCKS + \
- EXT3_NEWINODE_TRANS_BLOCKS + \
- 2 * SNAP_MIGRATEDATA_TRANS_BLOCKS)
-#define SNAP_BIGCOPY_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS)
-#define SNAP_CREATEIND_TRANS_BLOCKS (EXT3_NEWINODE_TRANS_BLOCKS + \
- SNAP_MIGRATEDATA_TRANS_BLOCKS + \
- SNAP_SETIND_TRANS_BLOCKS + \
- SNAP_BIGCOPY_TRANS_BLOCKS + 3)
-#define SNAP_MIGRATEBLK_TRANS_BLOCKS 2
-#define SNAP_DESTROY_TRANS_BLOCKS (SNAP_DELETELIST_TRANS_BLOCKS + \
- EXT3_EA_TRANS_BLOCKS + 2)
-#define SNAP_RESTORE_TRANS_BLOCKS (EXT3_NEWINODE_TRANS_BLOCKS + \
- 2 * SNAP_MIGRATEDATA_TRANS_BLOCKS + 1)
/*Snap Table*/
#define SNAP_MAX 32
#define SNAP_MAX_TABLES 32
#define SNAP_MAX_NAMELEN 64
-#define MAX_SNAPTABLE_COUNT "MAXSnapCount"
-#define SNAPTABLE_MAGIC 0x19760218
-#define SNAPTABLE_INFO "snaptable"
-#define SNAP_GENERATION "snap_generation"
+#define MAX_SNAPTABLE_COUNT "MAXSnapCount"
+#define SNAPTABLE_MAGIC 0x19760218
+#define SNAPTABLE_INFO "snaptable"
+#define SNAP_GENERATION "snap_generation"
+#define SNAP_COUNT "snapcount"
+#define SNAP_ROOT_INO "snap_root_ino"
+
+#define SNAP_LOOKUP (REINT_MAX + 1)
struct snap {
time_t sn_time;
struct snap sntbl_items[0];
};
+#define DOT_NAME_MAX_LEN 32
+struct snap_dot_info {
+ char *dot_name;
+ int dot_name_len;
+ int dot_snap_enable;
+};
+
struct snap_info {
+ struct list_head sni_list;
+ ino_t sni_root_ino;
+ struct semaphore sni_sema;
+ spinlock_t sni_lock;
+ struct snap_table *sni_table;
+ struct dentry *sni_cowed_dentry;
+ struct snap_dot_info *sni_dot_info;
+};
+
+struct snap_super_info {
struct fsfilt_operations *snap_fsfilt;
- struct fsfilt_operations *snap_cache_fsfilt;
- struct semaphore sntbl_sema;
- spinlock_t sntbl_lock;
- struct snap_table *sntbl;
- struct dentry *sn_cowed_dentry;
+ struct fsfilt_operations *snap_cache_fsfilt;
+ struct list_head snap_list;
+ int snap_table_size;
+ int snap_count;
};
-extern int smfs_add_snap_item(struct super_block *sb, char *name);
+
+extern int smfs_add_snap_item(struct super_block *sb, char *path_name,
+ char *name);
extern int smfs_start_cow(struct super_block *sb);
extern int smfs_stop_cow(struct super_block *sb);
};
int smfs_cow(struct inode *dir, struct dentry *dentry,
void *data1, void *data2, int op);
-int smfs_cow_write(struct inode *inode, struct dentry *dentry, void *data1,
- void *data2);
+int smfs_cow_write_pre(struct inode *inode, void *de, void *data1, void *data2);
+struct inode* smfs_cow_get_ind(struct inode *inode, int index);
+
+
+#define DOT_SNAP_NAME ".snap"
+#define DOT_SNAP_INDEX 0xffff
+static inline int smfs_primary_inode(struct inode *inode)
+{
+ struct snap_inode_info *sn_info = &I2SMI(inode)->sm_sninfo;
+
+ if (sn_info->sn_index == 0)
+ return 1;
+ return 0;
+}
+static inline int smfs_dotsnap_inode(struct inode *inode)
+{
+ struct snap_inode_info *sn_info = &I2SMI(inode)->sm_sninfo;
+
+ if (sn_info->sn_index == DOT_SNAP_INDEX)
+ return 1;
+ return 0;
+}
+static inline int smfs_under_dotsnap_inode(struct inode *inode)
+{
+ struct snap_inode_info *sn_info = &I2SMI(inode)->sm_sninfo;
+
+ if (sn_info->sn_index > 0 && sn_info->sn_index != DOT_SNAP_INDEX)
+ return 1;
+ return 0;
+}
+#define SNAP_MINOR 242
+#define SNAP_MAJOR 10
+
#endif /*_LUSTRE_SNAP_H*/