return l;
}
-static void cmm_device_free(const struct lu_env *env, struct lu_device *d)
+static struct lu_device *cmm_device_free(const struct lu_env *env,
+ struct lu_device *d)
{
struct cmm_device *m = lu2cmm_dev(d);
+ struct lu_device *next = md2lu_dev(m->cmm_child);
+ ENTRY;
LASSERT(m->cmm_tgt_count == 0);
LASSERT(list_empty(&m->cmm_targets));
OBD_FREE_PTR(m->cmm_fld);
m->cmm_fld = NULL;
}
- md_device_fini(&m->cmm_md_dev);
+ md_device_fini(&m->cmm_md_dev);
OBD_FREE_PTR(m);
+ RETURN(next);
}
-/* context key constructor/destructor */
-static void *cmm_key_init(const struct lu_context *ctx,
- struct lu_context_key *key)
-{
- struct cmm_thread_info *info;
+/* context key constructor/destructor: cmm_key_init, cmm_key_fini */
+LU_KEY_INIT_FINI(cmm, struct cmm_thread_info);
- CLASSERT(CFS_PAGE_SIZE >= sizeof *info);
- OBD_ALLOC_PTR(info);
- if (info == NULL)
- info = ERR_PTR(-ENOMEM);
- return info;
-}
-
-static void cmm_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- struct cmm_thread_info *info = data;
- OBD_FREE_PTR(info);
-}
-
-static struct lu_context_key cmm_thread_key = {
- .lct_tags = LCT_MD_THREAD,
- .lct_init = cmm_key_init,
- .lct_fini = cmm_key_fini
-};
+/* context key: cmm_thread_key */
+LU_CONTEXT_KEY_DEFINE(cmm, LCT_MD_THREAD);
struct cmm_thread_info *cmm_env_info(const struct lu_env *env)
{
return info;
}
-static int cmm_type_init(struct lu_device_type *t)
-{
- LU_CONTEXT_KEY_INIT(&cmm_thread_key);
- return lu_context_key_register(&cmm_thread_key);
-}
-
-static void cmm_type_fini(struct lu_device_type *t)
-{
- lu_context_key_degister(&cmm_thread_key);
-}
+/* type constructor/destructor: cmm_type_init/cmm_type_fini */
+LU_TYPE_INIT_FINI(cmm, &cmm_thread_key);
static int cmm_device_init(const struct lu_env *env, struct lu_device *d,
const char *name, struct lu_device *next)
{ 0 }
};
-LPROCFS_INIT_VARS(cmm, lprocfs_cmm_module_vars, lprocfs_cmm_obd_vars);
+static void lprocfs_cmm_init_vars(struct lprocfs_static_vars *lvars)
+{
+ lvars->module_vars = lprocfs_cmm_module_vars;
+ lvars->obd_vars = lprocfs_cmm_obd_vars;
+}
static int __init cmm_mod_init(void)
{
struct lprocfs_static_vars lvars;
- lprocfs_init_vars(cmm, &lvars);
+ lprocfs_cmm_init_vars(&lvars);
return class_register_type(&cmm_obd_device_ops, NULL, lvars.module_vars,
LUSTRE_CMM_NAME, &cmm_device_type);
}