X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flinux%2Flustre_smfs.h;h=b6fd845b1477c3b3ec9a683808fe624fd34e3c85;hb=9d4b898b1c1c7c318fda5f0c345ed726c774c06a;hp=a534162a0e91fb3f4daf92708a649d7825973c31;hpb=a6378664db84986809b3eb843cb0bfad01b75269;p=fs%2Flustre-release.git diff --git a/lustre/include/linux/lustre_smfs.h b/lustre/include/linux/lustre_smfs.h index a534162..b6fd845 100644 --- a/lustre/include/linux/lustre_smfs.h +++ b/lustre/include/linux/lustre_smfs.h @@ -30,8 +30,13 @@ struct snap_inode_info { int sn_flags; /*the flags indicated inode type */ int sn_gen; /*the inode generation*/ int sn_index; /*the inode snap_index*/ + ino_t sn_root_ino; /*the root ino of this snap*/ }; struct smfs_inode_info { + /* this first part of struct should be the same as in mds_info_info */ + struct lustre_id smi_id; + + /* smfs part. */ struct inode *smi_inode; __u32 smi_flags; struct snap_inode_info sm_sninfo; @@ -71,7 +76,7 @@ struct mds_kml_pack_info { int mpi_size[4]; int mpi_total_size; }; -typedef int (*smfs_hook_func)(struct inode *inode, struct dentry *dentry, +typedef int (*smfs_hook_func)(struct inode *inode, void *dentry, void *data1, void *data2, int op, void *handle); struct smfs_hook_ops { struct list_head smh_list; @@ -93,11 +98,12 @@ struct smfs_super_info { char *smsi_cache_ftype; /* cache file system type */ char *smsi_ftype; /* file system type */ struct obd_export *smsi_exp; /* file system obd exp */ - struct snap_info *smsi_snap_info; /* snap table cow */ + struct snap_super_info *smsi_snap_info; /* snap table cow */ smfs_pack_rec_func smsi_pack_rec[PACK_MAX]; /* sm_pack_rec type ops */ __u32 smsi_flags; /* flags */ __u32 smsi_ops_check; struct list_head smsi_hook_list; + kmem_cache_t * smsi_inode_cachep; /*inode_cachep*/ }; @@ -121,26 +127,30 @@ struct fs_extent{ __u32 e_num; /* number of blocks covered by extent */ }; -#define I2SMI(inode) ((struct smfs_inode_info *) (&(inode->u.generic_ip))) +#define I2SMI(inode) ((struct smfs_inode_info *) ((inode->u.generic_ip))) +#define I2FSI(inode) (((inode->u.generic_ip))) + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#define S2SMI(sb) ((struct smfs_super_info *) (&(sb->u.generic_sbp))) -#define S2CSB(sb) (((struct smfs_super_info *) (&(sb->u.generic_sbp)))->smsi_sb) +#define S2FSI(sb) (((sb->u.generic_sbp))) +#define S2SMI(sb) ((struct smfs_super_info *) ((sb->u.generic_sbp))) +#define S2CSB(sb) (((struct smfs_super_info *)((sb->u.generic_sbp)))->smsi_sb) #else +#define S2FSI(sb) ((sb->s_fs_info)) #define S2SMI(sb) ((struct smfs_super_info *) (sb->s_fs_info)) #define S2CSB(sb) (((struct smfs_super_info *) (sb->s_fs_info))->smsi_sb) #endif -#define I2CI(inode) (((struct smfs_inode_info*) (&(inode->u.generic_ip)))->smi_inode) +#define I2CI(inode) (((struct smfs_inode_info*) ((inode->u.generic_ip)))->smi_inode) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#define I2CSB(inode) ((struct smfs_super_info *) (&(inode->i_sb->u.generic_sbp))) +#define I2CSB(inode) ((struct smfs_super_info *) ((inode->i_sb->u.generic_sbp))) #else #define I2CSB(inode) ((struct smfs_super_info *) (inode->i_sb->s_fs_info)) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) #define I2FOPS(inode) (((struct smfs_super_info *) \ - (&(inode->i_sb->u.generic_sbp)))->sm_cache_fsfilt) + ((inode->i_sb->u.generic_sbp)))->sm_cache_fsfilt) #else #define I2FOPS(inode) (((struct smfs_super_info *) \ (inode->i_sb->s_fs_info))->sm_cache_fsfilt) @@ -299,6 +309,7 @@ static inline void duplicate_inode(struct inode *dst_inode, dst_inode->i_version = src_inode->i_version; dst_inode->i_state = src_inode->i_state; dst_inode->i_generation = src_inode->i_generation; + dst_inode->i_flags = src_inode->i_flags; /* This is to make creating special files working. */ dst_inode->i_rdev = src_inode->i_rdev; @@ -309,9 +320,10 @@ static inline void post_smfs_inode(struct inode *inode, { if (inode && cache_inode) { duplicate_inode(inode, cache_inode); - /*Here we must release the cache_inode, - *Otherwise we will have no chance to - *do it + + /* + * here we must release the cache_inode, otherwise we will have + * no chance to do it later. */ cache_inode->i_state &=~I_LOCK; inode->i_blocks = cache_inode->i_blocks; @@ -321,8 +333,10 @@ static inline void post_smfs_inode(struct inode *inode, static inline void pre_smfs_inode(struct inode *inode, struct inode *cache_inode) { - if (inode && cache_inode) - duplicate_inode(cache_inode, inode); + if (inode && cache_inode) { + cache_inode->i_state = inode->i_state; + // duplicate_inode(cache_inode, inode); + } } /* instantiate a file handle to the cache file */ @@ -364,6 +378,7 @@ static inline void d_unalloc(struct dentry *dentry) INIT_LIST_HEAD(&dentry->d_hash); #else hlist_del_init(&dentry->d_hash); + dentry->d_flags |= DCACHE_UNHASHED; #endif dput(dentry); /* this will free the dentry memory */ } @@ -408,15 +423,11 @@ static inline void smfs_free_dentry_name(struct qstr *str) static inline struct dentry *pre_smfs_dentry(struct dentry *parent_dentry, struct inode *cache_inode, - struct dentry *dentry, - int *index) + struct dentry *dentry) { struct dentry *cache_dentry = NULL; - struct qstr name; - smfs_get_dentry_name_index(dentry, &name, index); - cache_dentry = d_alloc(parent_dentry, &name); - smfs_free_dentry_name(&name); + cache_dentry = d_alloc(parent_dentry, &dentry->d_name); if (!cache_dentry) RETURN(NULL); if (!parent_dentry) @@ -430,6 +441,11 @@ static inline void post_smfs_dentry(struct dentry *cache_dentry) { if (!cache_dentry) return; + + /* + * this is needed because d_unalloc() calls dput(), which in turn calls + * iput() on dentry inode. + */ if (cache_dentry->d_inode) igrab(cache_dentry->d_inode); d_unalloc(cache_dentry);