* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Intel Corporation.
+ * Copyright (c) 2013, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
struct mds_device {
/* super-class */
- struct md_device mds_md_dev;
- struct ptlrpc_service *mds_regular_service;
- struct ptlrpc_service *mds_readpage_service;
- struct ptlrpc_service *mds_out_service;
- struct ptlrpc_service *mds_setattr_service;
- struct ptlrpc_service *mds_mdsc_service;
- struct ptlrpc_service *mds_mdss_service;
- struct ptlrpc_service *mds_fld_service;
+ struct md_device mds_md_dev;
+ struct ptlrpc_service *mds_regular_service;
+ struct ptlrpc_service *mds_readpage_service;
+ struct ptlrpc_service *mds_out_service;
+ struct ptlrpc_service *mds_setattr_service;
+ struct ptlrpc_service *mds_mdsc_service;
+ struct ptlrpc_service *mds_mdss_service;
+ struct ptlrpc_service *mds_fld_service;
+ struct mutex mds_health_mutex;
};
/*
* * Initialized in mdt_mod_init().
* */
static unsigned long mdt_num_threads;
-CFS_MODULE_PARM(mdt_num_threads, "ul", ulong, 0444,
- "number of MDS service threads to start "
- "(deprecated in favor of mds_num_threads)");
+module_param(mdt_num_threads, ulong, 0444);
+MODULE_PARM_DESC(mdt_num_threads, "number of MDS service threads to start (deprecated in favor of mds_num_threads)");
static unsigned long mds_num_threads;
-CFS_MODULE_PARM(mds_num_threads, "ul", ulong, 0444,
- "number of MDS service threads to start");
+module_param(mds_num_threads, ulong, 0444);
+MODULE_PARM_DESC(mds_num_threads, "number of MDS service threads to start");
static char *mds_num_cpts;
-CFS_MODULE_PARM(mds_num_cpts, "c", charp, 0444,
- "CPU partitions MDS threads should run on");
+module_param(mds_num_cpts, charp, 0444);
+MODULE_PARM_DESC(mds_num_cpts, "CPU partitions MDS threads should run on");
static unsigned long mds_rdpg_num_threads;
-CFS_MODULE_PARM(mds_rdpg_num_threads, "ul", ulong, 0444,
- "number of MDS readpage service threads to start");
+module_param(mds_rdpg_num_threads, ulong, 0444);
+MODULE_PARM_DESC(mds_rdpg_num_threads, "number of MDS readpage service threads to start");
static char *mds_rdpg_num_cpts;
-CFS_MODULE_PARM(mds_rdpg_num_cpts, "c", charp, 0444,
- "CPU partitions MDS readpage threads should run on");
+module_param(mds_rdpg_num_cpts, charp, 0444);
+MODULE_PARM_DESC(mds_rdpg_num_cpts, "CPU partitions MDS readpage threads should run on");
/* NB: these two should be removed along with setattr service in the future */
static unsigned long mds_attr_num_threads;
-CFS_MODULE_PARM(mds_attr_num_threads, "ul", ulong, 0444,
- "number of MDS setattr service threads to start");
+module_param(mds_attr_num_threads, ulong, 0444);
+MODULE_PARM_DESC(mds_attr_num_threads, "number of MDS setattr service threads to start");
static char *mds_attr_num_cpts;
-CFS_MODULE_PARM(mds_attr_num_cpts, "c", charp, 0444,
- "CPU partitions MDS setattr threads should run on");
+module_param(mds_attr_num_cpts, charp, 0444);
+MODULE_PARM_DESC(mds_attr_num_cpts, "CPU partitions MDS setattr threads should run on");
/* device init/fini methods */
static void mds_stop_ptlrpc_service(struct mds_device *m)
{
ENTRY;
+
+ mutex_lock(&m->mds_health_mutex);
if (m->mds_regular_service != NULL) {
ptlrpc_unregister_service(m->mds_regular_service);
m->mds_regular_service = NULL;
ptlrpc_unregister_service(m->mds_fld_service);
m->mds_fld_service = NULL;
}
+ mutex_unlock(&m->mds_health_mutex);
+
EXIT;
}
{
static struct ptlrpc_service_conf conf;
struct obd_device *obd = m->mds_md_dev.md_lu_dev.ld_obd;
- cfs_proc_dir_entry_t *procfs_entry;
+ struct proc_dir_entry *procfs_entry;
int rc = 0;
ENTRY;
LPROC_SEQ_FOPS_RO_TYPE(mds, uuid);
-static struct lprocfs_seq_vars lprocfs_mds_obd_vars[] = {
+static struct lprocfs_vars lprocfs_mds_obd_vars[] = {
{ "uuid", &mds_uuid_fops },
- { 0 }
+ { NULL }
};
static struct lu_device *mds_device_alloc(const struct lu_env *env,
obd->obd_lu_dev = l;
obd->obd_vars = lprocfs_mds_obd_vars;
- rc = lprocfs_seq_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd);
if (rc != 0) {
mds_device_free(env, l);
l = ERR_PTR(rc);
return l;
}
+ mutex_init(&m->mds_health_mutex);
+
rc = mds_start_ptlrpc_service(m);
if (rc != 0) {
.ldt_ctx_tags = LCT_MD_THREAD
};
+static int mds_health_check(const struct lu_env *env, struct obd_device *obd)
+{
+ struct mds_device *mds = mds_dev(obd->obd_lu_dev);
+ int rc = 0;
+
+
+ mutex_lock(&mds->mds_health_mutex);
+ rc |= ptlrpc_service_health_check(mds->mds_regular_service);
+ rc |= ptlrpc_service_health_check(mds->mds_readpage_service);
+ rc |= ptlrpc_service_health_check(mds->mds_out_service);
+ rc |= ptlrpc_service_health_check(mds->mds_setattr_service);
+ rc |= ptlrpc_service_health_check(mds->mds_mdsc_service);
+ rc |= ptlrpc_service_health_check(mds->mds_mdss_service);
+ rc |= ptlrpc_service_health_check(mds->mds_fld_service);
+ mutex_unlock(&mds->mds_health_mutex);
+
+ return rc != 0 ? 1 : 0;
+}
+
static struct obd_ops mds_obd_device_ops = {
.o_owner = THIS_MODULE,
+ .o_health_check = mds_health_check,
};
int mds_mod_init(void)
}
return class_register_type(&mds_obd_device_ops, NULL, true, NULL,
-#ifndef HAVE_ONLY_PROCFS_SEQ
- NULL,
-#endif
LUSTRE_MDS_NAME, &mds_device_type);
}