*namestr = pos + 5;
} else if (!strcmp(pos, "kml")) {
SMFS_SET(*flags, SMFS_PLG_KML);
+ } else if (!strcmp(pos, "audit")) {
+ SMFS_SET(*flags, SMFS_PLG_AUDIT);
} else if (!strcmp(pos, "cache")) {
SMFS_SET(*flags, SMFS_PLG_LRU);
} else if (!strcmp(pos, "snap")) {
}
}
-static void smfs_mds_flags(struct mds_obd * mds, struct inode * root)
+static void smfs_mds_flags(struct mds_obd *mds, struct inode *root)
{
- struct inode * pend = mds->mds_pending_dir->d_inode;
+ struct inode *pend = mds->mds_pending_dir->d_inode;
CDEBUG(D_SUPER,"MDS OBD post_setup\n");
+
/* enable plugins for all in ROOT */
SMFS_SET(I2SMI(root)->smi_flags, SMFS_PLG_ALL);
+
/* the same for PENDING */
SMFS_SET(I2SMI(pend)->smi_flags, SMFS_PLG_ALL);
}
-
+
+extern int (*audit_id2name_superhack) (struct obd_device *obd, char **name,
+ int *namelen, struct lustre_id *id);
int smfs_post_setup(struct obd_device *obd, struct vfsmount *mnt,
- struct dentry * root_dentry)
+ struct dentry *root_dentry)
{
struct lvfs_run_ctxt saved, *current_ctxt = NULL;
struct smfs_super_info *smb = S2SMI(mnt->mnt_sb);
int rc = 0;
-
ENTRY;
+
+ /* XXX to register id2name function of mds in smfs */
+ //if (data != NULL)
+ // audit_id2name_superhack = data;
OBD_ALLOC(current_ctxt, sizeof(*current_ctxt));
if (!current_ctxt)
push_ctxt(&saved, smb->smsi_ctxt, NULL);
- rc = smfs_llog_setup(smb);
- if (!rc) {
- rc = SMFS_PLG_HELP(mnt->mnt_sb, PLG_START, NULL);
- }
+ rc = smfs_llog_setup(&smb->smsi_logs_dir, &smb->smsi_objects_dir);
+ if (!rc)
+ rc = SMFS_PLG_HELP(mnt->mnt_sb, PLG_START, obd);
pop_ctxt(&saved, smb->smsi_ctxt, NULL);
- /* connect KML ctxt to obd */
- if (obd && smb->smsi_kml_log) {
- smb->smsi_kml_log->loc_idx = LLOG_REINT_ORIG_CTXT;
- smb->smsi_kml_log->loc_obd = obd;
- obd->obd_llog_ctxt[LLOG_REINT_ORIG_CTXT] = smb->smsi_kml_log;
- }
-
/* enable plugins for directories on MDS or OST */
if (obd && obd->obd_type && obd->obd_type->typ_name) {
- if (!strcmp(obd->obd_type->typ_name, "obdfilter")) {
+ if (!strcmp(obd->obd_type->typ_name, OBD_FILTER_DEVICENAME)) {
struct filter_obd *filt = &obd->u.filter;
-
smfs_filter_flags(filt, root_dentry->d_inode);
- }
- else if (!strcmp(obd->obd_type->typ_name, "mds")) {
+ } else if (!strcmp(obd->obd_type->typ_name, OBD_MDS_DEVICENAME)) {
struct mds_obd * mds = &obd->u.mds;
-
smfs_mds_flags(mds, root_dentry->d_inode);
- }
- else
+ SMFS_SET_HND_IBLOCKS(smb);
+ } else {
CDEBUG(D_SUPER,"Unknown OBD (%s) post_setup\n",
obd->obd_type->typ_name);
+ }
}
if (rc)
OBD_FREE(current_ctxt, sizeof(*current_ctxt));
-
+
RETURN(rc);
}
INIT_LIST_HEAD(&smb->smsi_plg_list);
init_rwsem(&smb->plg_sem);
+ if (SMFS_IS(flags, SMFS_PLG_AUDIT))
+ smfs_init_audit(sb);
if (SMFS_IS(flags, SMFS_PLG_KML))
smfs_init_kml(sb);
if (SMFS_IS(flags, SMFS_PLG_LRU))
static void smfs_remove_plugins(struct super_block *sb)
{
+ struct smfs_plugin * plg, *tmp;
+ struct smfs_super_info *smb = S2SMI(sb);
+ struct list_head * plist = &smb->smsi_plg_list;
+
ENTRY;
-
- SMFS_PLG_HELP(sb, PLG_EXIT, (void*)sb);
+
+ list_for_each_entry_safe(plg, tmp, plist, plg_list) {
+ plg->plg_exit(sb, plg->plg_private);
+ }
EXIT;
}
RETURN(plg);
}
-void smfs_pre_hook (struct inode * inode, int op, void * msg)
+void smfs_pre_hook (struct inode * inode, hook_op op, void * msg)
{
struct smfs_super_info *smb = S2SMI(inode->i_sb);
struct smfs_inode_info *smi = I2SMI(inode);
//EXIT;
}
-void smfs_post_hook (struct inode * inode, int op, void * msg, int ret)
+void smfs_post_hook (struct inode * inode, hook_op op, void * msg, int ret)
{
struct smfs_super_info *smb = S2SMI(inode->i_sb);
- struct smfs_inode_info *smi = I2SMI(inode);
+ //struct smfs_inode_info *smi = I2SMI(inode);
struct list_head *hlist = &smb->smsi_plg_list;
struct smfs_plugin *plg;
//check that plugin is active
if(!SMFS_IS(smb->plg_flags, plg->plg_type))
continue;
- //check that inode is allowed
+ /* this will be checked inside plg_post_op()
if (!SMFS_IS(smi->smi_flags, plg->plg_type))
continue;
-
+ */
if (plg->plg_post_op)
plg->plg_post_op(op, inode, msg, ret, plg->plg_private);
}
return rc;
}
+void * smfs_get_plg_priv(struct smfs_super_info * smb, int type)
+{
+ struct list_head *hlist = &smb->smsi_plg_list;
+ struct smfs_plugin *plg, *tmp;
+
+ list_for_each_entry_safe(plg, tmp, hlist, plg_list) {
+ if (plg->plg_type == type) {
+ return (plg->plg_private);
+ }
+ }
+
+ EXIT;
+
+ return NULL;
+}