From b9128c5c4888ff401f3e3cc91273bc08bdb1f2cc Mon Sep 17 00:00:00 2001 From: tappro <tappro> Date: Wed, 13 Apr 2005 06:58:43 +0000 Subject: [PATCH] b=5881 r=alex changes related to iopen support, fc3 compatibility and new smfs plugin API --- lustre/smfs/smfs_api.h | 56 ++++++++++++++++++++++--------------- lustre/smfs/smfs_internal.h | 11 ++++++-- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/lustre/smfs/smfs_api.h b/lustre/smfs/smfs_api.h index 2f3aea316b..d7911dbc41 100644 --- a/lustre/smfs/smfs_api.h +++ b/lustre/smfs/smfs_api.h @@ -1,12 +1,13 @@ /* SMFS plugin stuff */ -#define SMFS_PLG_DUMMY 0x0001L -#define SMFS_PLG_KML 0x0002L +#define SMFS_PLG_KML 0x0001L #define SMFS_PLG_LRU 0x0004L -#define SMFS_PLG_COW 0x0008L +#define SMFS_PLG_COW 0x0020L +#define SMFS_PLG_DUMMY 0x1000L +#define SMFS_PLG_ALL (~0L) -#define SMFS_SET_PLG(flags, mask) (flags |= mask) -#define SMFS_IS_PLG(flags, mask) (flags & mask) -#define SMFS_CLEAR_PLG(flags, mask) (flags &= ~mask) +#define SMFS_SET(flags, mask) (flags |= mask) +#define SMFS_IS(flags, mask) (flags & mask) +#define SMFS_CLEAR(flags, mask) (flags &= ~mask) typedef int (*smfs_plg_hook)(int hook_code, struct inode *, void *arg, int rc, void * priv); @@ -35,12 +36,17 @@ struct smfs_plugin { #define HOOK_SETATTR 10 #define HOOK_WRITE 11 #define HOOK_READDIR 12 -#define HOOK_MAX 13 +#define HOOK_F_SETATTR 13 +#define HOOK_MAX 14 struct hook_msg { struct dentry * dentry; }; +struct hook_link_msg { + struct dentry * dentry; + struct dentry * new_dentry; +}; struct hook_unlink_msg { struct dentry * dentry; int mode; @@ -76,7 +82,11 @@ struct hook_setattr_msg { struct iattr *attr; }; -#define SMFS_PRE_HOOK(inode, op, msg) \ +void smfs_pre_hook (struct inode*, int, void*); +void smfs_post_hook(struct inode*,int, void*, int); + +#define SMFS_PRE_HOOK(inode, op, msg) smfs_pre_hook (inode, op, msg) +/*\ do { \ struct smfs_super_info *smb = S2SMI(inode->i_sb); \ struct list_head *hlist = &smb->smsi_plg_list; \ @@ -88,8 +98,10 @@ do { \ plg->plg_private); \ } \ } while(0) +*/ -#define SMFS_POST_HOOK(inode, op, msg, rc) \ +#define SMFS_POST_HOOK(inode, op, msg, rc) smfs_post_hook(inode, op, msg, rc) +/*\ do { \ struct smfs_super_info *smb = S2SMI(inode->i_sb); \ struct list_head *hlist = &smb->smsi_plg_list; \ @@ -101,24 +113,22 @@ do { \ plg->plg_private); \ } \ } while(0) - +*/ #define PLG_EXIT 0 #define PLG_TRANS_SIZE 1 #define PLG_TEST_INODE 2 #define PLG_SET_INODE 3 -#define PLG_HELPER_MAX 4 - -#define SMFS_PLG_HELP(sb, op, data) \ -do { \ - struct list_head *hlist = &S2SMI(sb)->smsi_plg_list; \ - struct smfs_plugin *plugin, *tmp; \ - \ - list_for_each_entry_safe(plugin, tmp, hlist, plg_list) { \ - if (plugin->plg_helper) \ - plugin->plg_helper(op, sb, data, \ - plugin->plg_private); \ - } \ -} while(0) +#define PLG_START 4 +#define PLG_STOP 5 +#define PLG_HELPER_MAX 6 + +struct plg_hmsg { + __u32 data; + __u32 result; +}; + +int smfs_helper (struct super_block *, int, void *); +#define SMFS_PLG_HELP(sb, op, data) smfs_helper(sb, op, data) int smfs_register_plugin(struct super_block *, struct smfs_plugin *); void * smfs_deregister_plugin(struct super_block *, int); diff --git a/lustre/smfs/smfs_internal.h b/lustre/smfs/smfs_internal.h index f54d822114..e2eedd1e65 100644 --- a/lustre/smfs/smfs_internal.h +++ b/lustre/smfs/smfs_internal.h @@ -29,6 +29,10 @@ #define SMFS_PSDEV_MINOR 250 #define SMFS_PSDEV_MAJOR 10 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)) +#define FC3_KERNEL +#endif + struct option { char *opt; char *value; @@ -124,8 +128,8 @@ struct smfs_hook_ops *smfs_unregister_hook_ops(struct smfs_super_info *smb, /*smfs_lib.c*/ void smfs_put_super(struct super_block *sb); int smfs_fill_super(struct super_block *sb, void *data, int silent); - -void smfs_cleanup_hooks(struct smfs_super_info *smb); +int smfs_post_setup(struct super_block *, struct vfsmount *); +void smfs_post_cleanup(struct super_block *); /*sysctl.c*/ extern int sm_debug_level; extern int sm_inodes; @@ -134,6 +138,9 @@ extern int sm_stack; /*dir.c*/ extern struct inode_operations smfs_dir_iops; extern struct file_operations smfs_dir_fops; +extern struct inode_operations smfs_iopen_iops; +extern struct file_operations smfs_iopen_fops; + /*file.c*/ extern struct inode_operations smfs_file_iops; extern struct file_operations smfs_file_fops; -- GitLab