static struct lu_device *mdd_device_fini(const struct lu_env *env,
struct lu_device *d)
{
- struct mdd_device *mdd = lu2mdd_dev(d);
- int rc;
+ struct mdd_device *mdd = lu2mdd_dev(d);
if (d->ld_site)
lu_dev_del_linkage(d->ld_site, d);
- rc = mdd_procfs_fini(mdd);
- if (rc) {
- CERROR("proc fini error %d \n", rc);
- return ERR_PTR(rc);
- }
+ mdd_procfs_fini(mdd);
return NULL;
}
static void mdd_device_shutdown(const struct lu_env *env, struct mdd_device *m,
struct lustre_cfg *cfg)
{
+ mdd_generic_thread_stop(&m->mdd_orph_cleanup_thread);
lfsck_degister(env, m->mdd_bottom);
mdd_hsm_actions_llog_fini(env, m);
mdd_changelog_fini(env, m);
ENTRY;
switch (cfg->lcfg_command) {
- case LCFG_PARAM: {
- struct lprocfs_static_vars lvars;
-
- lprocfs_mdd_init_vars(&lvars);
- rc = class_process_proc_param(PARAM_MDD, lvars.obd_vars, cfg,m);
- if (rc > 0 || rc == -ENOSYS)
- /* we don't understand; pass it on */
- rc = next->ld_ops->ldo_process_config(env, next, cfg);
- break;
- }
+ case LCFG_PARAM: {
+ struct obd_device *obd = mdd2obd_dev(m);
+
+ rc = class_process_proc_seq_param(PARAM_MDD, obd->obd_vars,
+ cfg, m);
+ if (rc > 0 || rc == -ENOSYS)
+ /* we don't understand; pass it on */
+ rc = next->ld_ops->ldo_process_config(env, next, cfg);
+ break;
+ }
case LCFG_SETUP:
rc = next->ld_ops->ldo_process_config(env, next, cfg);
if (rc)
next = &mdd->mdd_child->dd_lu_dev;
/* XXX: orphans handling. */
- __mdd_orphan_cleanup(env, mdd);
+ mdd_orphan_cleanup(env, mdd);
rc = next->ld_ops->ldo_recovery_complete(env, next);
RETURN(rc);
/* context key: mdd_thread_key */
LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD);
+int mdd_generic_thread_start(struct mdd_generic_thread *thread,
+ int (*func)(void *), void *data, char *name)
+{
+ struct task_struct *task;
+
+ LASSERT(thread->mgt_init == false);
+ init_completion(&thread->mgt_started);
+ init_completion(&thread->mgt_finished);
+ thread->mgt_data = data;
+ thread->mgt_abort = false;
+ thread->mgt_init = true;
+
+ task = kthread_run(func, thread, name);
+ if (IS_ERR(task)) {
+ complete(&thread->mgt_finished);
+ return PTR_ERR(task);
+ }
+ wait_for_completion(&thread->mgt_started);
+ return 0;
+}
+
+void mdd_generic_thread_stop(struct mdd_generic_thread *thread)
+{
+ if (thread->mgt_init == true) {
+ thread->mgt_abort = true;
+ wait_for_completion(&thread->mgt_finished);
+ }
+}
+
static int __init mdd_mod_init(void)
{
- struct lprocfs_static_vars lvars;
int rc;
- lprocfs_mdd_init_vars(&lvars);
-
rc = lu_kmem_init(mdd_caches);
if (rc)
return rc;
rc = class_register_type(&mdd_obd_device_ops, NULL, true, NULL,
#ifndef HAVE_ONLY_PROCFS_SEQ
- lvars.module_vars,
+ NULL,
#endif
LUSTRE_MDD_NAME, &mdd_device_type);
if (rc)