#include "llog_internal.h"
-static struct cfs_hash_ops uuid_hash_ops;
-static struct cfs_hash_ops nid_hash_ops;
+#ifdef HAVE_SERVER_SUPPORT
static struct cfs_hash_ops nid_stat_hash_ops;
static struct cfs_hash_ops gen_hash_ops;
+#endif /* HAVE_SERVER_SUPPORT */
+
+/*
+ * uuid<->export lustre hash operations
+ */
+/*
+ * NOTE: It is impossible to find an export that is in failed
+ * state with this function
+ */
+static int
+uuid_keycmp(struct rhashtable_compare_arg *arg, const void *obj)
+{
+ const struct obd_uuid *uuid = arg->key;
+ const struct obd_export *exp = obj;
+
+ if (obd_uuid_equals(uuid, &exp->exp_client_uuid) &&
+ !exp->exp_failed)
+ return 0;
+ return -ESRCH;
+}
+
+static void
+obd_export_exit(void *vexport, void *data)
+{
+ struct obd_export *exp = vexport;
+
+ class_export_put(exp);
+}
+
+static const struct rhashtable_params uuid_hash_params = {
+ .key_len = sizeof(struct obd_uuid),
+ .key_offset = offsetof(struct obd_export, exp_client_uuid),
+ .head_offset = offsetof(struct obd_export, exp_uuid_hash),
+ .obj_cmpfn = uuid_keycmp,
+ .max_size = MAX_OBD_DEVICES,
+ .automatic_shrinking = true,
+};
+
+int obd_uuid_add(struct obd_device *obd, struct obd_export *export)
+{
+ int rc;
+
+ class_export_get(export);
+ rcu_read_lock();
+ rc = rhashtable_lookup_insert_fast(&obd->obd_uuid_hash,
+ &export->exp_uuid_hash,
+ uuid_hash_params);
+ if (rc) {
+ class_export_put(export);
+ if (rc != -EEXIST) {
+ /* map obscure error codes to -ENOMEM */
+ rc = -ENOMEM;
+ } else {
+ rc = -EALREADY;
+ }
+ }
+ rcu_read_unlock();
+
+ return rc;
+}
+EXPORT_SYMBOL(obd_uuid_add);
+
+void obd_uuid_del(struct obd_device *obd, struct obd_export *export)
+{
+ int rc;
+
+ rcu_read_lock();
+ rc = rhashtable_remove_fast(&obd->obd_uuid_hash,
+ &export->exp_uuid_hash,
+ uuid_hash_params);
+ if (!rc)
+ class_export_put(export);
+ rcu_read_unlock();
+}
+EXPORT_SYMBOL(obd_uuid_del);
+
+#ifdef HAVE_SERVER_SUPPORT
+/* obd_uuid_lookup() is used only server side by target_handle_connect(),
+ * mdt_hsm_agent_send(), and obd_export_evict_by_uuid().
+ */
+struct obd_export *obd_uuid_lookup(struct obd_device *obd,
+ struct obd_uuid *uuid)
+{
+ struct obd_export *export = NULL;
+
+ rcu_read_lock();
+ export = rhashtable_lookup_fast(&obd->obd_uuid_hash, uuid,
+ uuid_hash_params);
+ if (export && !refcount_inc_not_zero(&export->exp_handle.h_ref))
+ export = NULL;
+ rcu_read_unlock();
+
+ return export;
+}
+EXPORT_SYMBOL(obd_uuid_lookup);
+
+/*
+ * nid<->export hash operations
+ */
+static u32 nid_keyhash(const void *data, u32 key_len, u32 seed)
+{
+ const struct obd_export *exp = data;
+ void *key;
+
+ if (!exp->exp_connection)
+ return 0;
+
+ key = &exp->exp_connection->c_peer.nid;
+ return jhash2(key, key_len / sizeof(u32), seed);
+}
+
+/*
+ * NOTE: It is impossible to find an export that is in failed
+ * state with this function
+ */
+static int
+nid_keycmp(struct rhashtable_compare_arg *arg, const void *obj)
+{
+ const lnet_nid_t *nid = arg->key;
+ const struct obd_export *exp = obj;
+
+ if (exp->exp_connection->c_peer.nid == *nid)
+ return 0;
+
+ return -ESRCH;
+}
+
+static void
+nid_export_exit(void *vexport, void *data)
+{
+ struct obd_export *exp = vexport;
+
+ class_export_put(exp);
+}
+
+static const struct rhashtable_params nid_hash_params = {
+ .key_len = sizeof(lnet_nid_t),
+ .head_offset = offsetof(struct obd_export, exp_nid_hash),
+ .obj_hashfn = nid_keyhash,
+ .obj_cmpfn = nid_keycmp,
+ .automatic_shrinking = true,
+};
+
+int obd_nid_add(struct obd_device *obd, struct obd_export *exp)
+{
+ int rc;
+
+ if (exp == exp->exp_obd->obd_self_export || exp->exp_hashed)
+ return 0;
+
+ class_export_get(exp);
+ rc = rhltable_insert_key(&obd->obd_nid_hash,
+ &exp->exp_connection->c_peer.nid,
+ &exp->exp_nid_hash,
+ nid_hash_params);
+ if (rc) {
+ class_export_put(exp);
+ /* map obscure error codes to -ENOMEM */
+ rc = -ENOMEM;
+ } else {
+ exp->exp_hashed = 1;
+ }
+ return rc;
+}
+EXPORT_SYMBOL(obd_nid_add);
+
+void obd_nid_del(struct obd_device *obd, struct obd_export *exp)
+{
+ int rc;
+
+ if (exp == exp->exp_obd->obd_self_export || !exp->exp_hashed)
+ return;
+
+ rc = rhltable_remove(&obd->obd_nid_hash, &exp->exp_nid_hash,
+ nid_hash_params);
+ if (rc == 0) {
+ class_export_put(exp);
+ exp->exp_hashed = 0;
+ }
+}
+EXPORT_SYMBOL(obd_nid_del);
+
+int obd_nid_export_for_each(struct obd_device *obd, lnet_nid_t nid,
+ int cb(struct obd_export *exp, void *data),
+ void *data)
+{
+ struct rhlist_head *exports, *tmp;
+ struct obd_export *exp;
+ int ret = 0;
+
+ rcu_read_lock();
+ exports = rhltable_lookup(&obd->obd_nid_hash, &nid, nid_hash_params);
+ if (!exports) {
+ ret = -ENODEV;
+ goto out_unlock;
+ }
+
+ rhl_for_each_entry_rcu(exp, tmp, exports, exp_nid_hash) {
+ if (!exp->exp_failed && cb(exp, data))
+ ret++;
+ }
+
+out_unlock:
+ rcu_read_unlock();
+ return ret;
+}
+EXPORT_SYMBOL(obd_nid_export_for_each);
+#endif /* HAVE_SERVER_SUPPORT */
/*********** string parsing utils *********/
* other fns check that status, and we're not actually set up yet.
*/
obd->obd_starting = 1;
- obd->obd_uuid_hash = NULL;
- obd->obd_nid_hash = NULL;
obd->obd_nid_stats_hash = NULL;
obd->obd_gen_hash = NULL;
spin_unlock(&obd->obd_dev_lock);
/* create an uuid-export lustre hash */
- obd->obd_uuid_hash = cfs_hash_create("UUID_HASH",
- HASH_UUID_CUR_BITS,
- HASH_UUID_MAX_BITS,
- HASH_UUID_BKT_BITS, 0,
- CFS_HASH_MIN_THETA,
- CFS_HASH_MAX_THETA,
- &uuid_hash_ops, CFS_HASH_DEFAULT);
- if (!obd->obd_uuid_hash)
- GOTO(err_exit, err = -ENOMEM);
+ err = rhashtable_init(&obd->obd_uuid_hash, &uuid_hash_params);
+ if (err)
+ GOTO(err_starting, err);
+#ifdef HAVE_SERVER_SUPPORT
/* create a nid-export lustre hash */
- obd->obd_nid_hash = cfs_hash_create("NID_HASH",
- HASH_NID_CUR_BITS,
- HASH_NID_MAX_BITS,
- HASH_NID_BKT_BITS, 0,
- CFS_HASH_MIN_THETA,
- CFS_HASH_MAX_THETA,
- &nid_hash_ops, CFS_HASH_DEFAULT);
- if (!obd->obd_nid_hash)
- GOTO(err_exit, err = -ENOMEM);
+ err = rhltable_init(&obd->obd_nid_hash, &nid_hash_params);
+ if (err)
+ GOTO(err_uuid_hash, err = -ENOMEM);
/* create a nid-stats lustre hash */
obd->obd_nid_stats_hash = cfs_hash_create("NID_STATS",
&nid_stat_hash_ops,
CFS_HASH_DEFAULT);
if (!obd->obd_nid_stats_hash)
- GOTO(err_exit, err = -ENOMEM);
+ GOTO(err_nid_hash, err = -ENOMEM);
/* create a client_generation-export lustre hash */
obd->obd_gen_hash = cfs_hash_create("UUID_HASH",
CFS_HASH_MAX_THETA,
&gen_hash_ops, CFS_HASH_DEFAULT);
if (!obd->obd_gen_hash)
- GOTO(err_exit, err = -ENOMEM);
+ GOTO(err_nid_stats_hash, err = -ENOMEM);
+#endif /* HAVE_SERVER_SUPPORT */
err = obd_setup(obd, lcfg);
if (err)
- GOTO(err_exit, err);
+#ifdef HAVE_SERVER_SUPPORT
+ GOTO(err_gen_hash, err);
+#else
+ GOTO(err_uuid_hash, err);
+#endif /* ! HAVE_SERVER_SUPPORT */
obd->obd_set_up = 1;
obd->obd_name, obd->obd_uuid.uuid);
RETURN(0);
-err_exit:
- if (obd->obd_uuid_hash) {
- cfs_hash_putref(obd->obd_uuid_hash);
- obd->obd_uuid_hash = NULL;
- }
- if (obd->obd_nid_hash) {
- cfs_hash_putref(obd->obd_nid_hash);
- obd->obd_nid_hash = NULL;
+
+#ifdef HAVE_SERVER_SUPPORT
+err_gen_hash:
+ if (obd->obd_gen_hash) {
+ cfs_hash_putref(obd->obd_gen_hash);
+ obd->obd_gen_hash = NULL;
}
+err_nid_stats_hash:
if (obd->obd_nid_stats_hash) {
cfs_hash_putref(obd->obd_nid_stats_hash);
obd->obd_nid_stats_hash = NULL;
}
- if (obd->obd_gen_hash) {
- cfs_hash_putref(obd->obd_gen_hash);
- obd->obd_gen_hash = NULL;
- }
+err_nid_hash:
+ rhltable_destroy(&obd->obd_nid_hash);
+#endif /* HAVE_SERVER_SUPPORT */
+err_uuid_hash:
+ rhashtable_destroy(&obd->obd_uuid_hash);
+err_starting:
obd->obd_starting = 0;
CERROR("setup %s failed (%d)\n", obd->obd_name, err);
return err;
case 'A':
LCONSOLE_WARN("Failing over %s\n",
obd->obd_name);
+ spin_lock(&obd->obd_dev_lock);
obd->obd_fail = 1;
+#ifdef HAVE_SERVER_SUPPORT
obd->obd_no_transno = 1;
+#endif
obd->obd_no_recov = 1;
+ spin_unlock(&obd->obd_dev_lock);
if (OBP(obd, iocontrol)) {
obd_iocontrol(OBD_IOC_SYNC,
obd->obd_self_export,
obd->obd_name, err);
/* destroy an uuid-export hash body */
- if (obd->obd_uuid_hash) {
- cfs_hash_putref(obd->obd_uuid_hash);
- obd->obd_uuid_hash = NULL;
- }
-
+ rhashtable_free_and_destroy(&obd->obd_uuid_hash, obd_export_exit,
+ NULL);
+#ifdef HAVE_SERVER_SUPPORT
/* destroy a nid-export hash body */
- if (obd->obd_nid_hash) {
- cfs_hash_putref(obd->obd_nid_hash);
- obd->obd_nid_hash = NULL;
- }
+ rhltable_free_and_destroy(&obd->obd_nid_hash, nid_export_exit, NULL);
/* destroy a nid-stats hash body */
if (obd->obd_nid_stats_hash) {
cfs_hash_putref(obd->obd_gen_hash);
obd->obd_gen_hash = NULL;
}
-
+#endif /* HAVE_SERVER_SUPPORT */
class_decref(obd, "setup", obd);
obd->obd_set_up = 0;
kfree(subsys);
if (kobj) {
char *value = param;
- char *envp[3];
+ char *envp[4];
int i;
param = strsep(&value, "=");
envp[0] = kasprintf(GFP_KERNEL, "PARAM=%s", param);
envp[1] = kasprintf(GFP_KERNEL, "SETTING=%s", value);
- envp[2] = NULL;
+ envp[2] = kasprintf(GFP_KERNEL, "TIME=%lld",
+ ktime_get_real_seconds());
+ envp[3] = NULL;
rc = kobject_uevent_env(kobj, KOBJ_CHANGE, envp);
for (i = 0; i < ARRAY_SIZE(envp); i++)
EXPORT_SYMBOL(lustre_register_quota_process_config);
#endif /* HAVE_SERVER_SUPPORT */
+#define QMT0_DEV_NAME_LEN (LUSTRE_MAXFSNAME + sizeof("-QMT0000"))
+static struct obd_device *obd_find_qmt0(char *obd_name)
+{
+ char qmt_name[QMT0_DEV_NAME_LEN];
+ struct obd_device *qmt = NULL;
+
+ if (!server_name2fsname(obd_name, qmt_name, NULL)) {
+ strlcat(qmt_name, "-QMT0000", QMT0_DEV_NAME_LEN);
+ qmt = class_name2obd(qmt_name);
+ }
+
+ return qmt;
+}
+
/**
* Process configuration commands given in lustre_cfg form.
* These may come from direct calls (e.g. class_manual_cleanup)
}
case LCFG_POOL_NEW: {
err = obd_pool_new(obd, lustre_cfg_string(lcfg, 2));
+ if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
+ obd = obd_find_qmt0(obd->obd_name);
+ if (obd)
+ obd_pool_new(obd, lustre_cfg_string(lcfg, 2));
+ }
GOTO(out, err = 0);
}
case LCFG_POOL_ADD: {
err = obd_pool_add(obd, lustre_cfg_string(lcfg, 2),
lustre_cfg_string(lcfg, 3));
+ if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
+ obd = obd_find_qmt0(obd->obd_name);
+ if (obd)
+ obd_pool_add(obd, lustre_cfg_string(lcfg, 2),
+ lustre_cfg_string(lcfg, 3));
+ }
GOTO(out, err = 0);
}
case LCFG_POOL_REM: {
err = obd_pool_rem(obd, lustre_cfg_string(lcfg, 2),
lustre_cfg_string(lcfg, 3));
+ if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
+ obd = obd_find_qmt0(obd->obd_name);
+ if (obd)
+ obd_pool_rem(obd, lustre_cfg_string(lcfg, 2),
+ lustre_cfg_string(lcfg, 3));
+ }
GOTO(out, err = 0);
}
case LCFG_POOL_DEL: {
err = obd_pool_del(obd, lustre_cfg_string(lcfg, 2));
+ if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
+ obd = obd_find_qmt0(obd->obd_name);
+ if (obd)
+ obd_pool_del(obd, lustre_cfg_string(lcfg, 2));
+ }
GOTO(out, err = 0);
}
/*
}
if (!attr) {
- char *envp[3];
+ char *envp[4], *param, *path;
+
+ path = kobject_get_path(kobj, GFP_KERNEL);
+ if (!path)
+ return -EINVAL;
+
+ /* convert sysfs path to uevent format */
+ param = path;
+ while ((param = strchr(param, '/')) != NULL)
+ *param = '.';
- envp[0] = kasprintf(GFP_KERNEL, "PARAM=%s.%s.%.*s",
- kobject_name(kobj->parent),
- kobject_name(kobj),
- (int) keylen, key);
+ param = strstr(path, "fs.lustre.") + 10;
+
+ envp[0] = kasprintf(GFP_KERNEL, "PARAM=%s.%.*s",
+ param, (int) keylen, key);
envp[1] = kasprintf(GFP_KERNEL, "SETTING=%s", value);
- envp[2] = NULL;
+ envp[2] = kasprintf(GFP_KERNEL, "TIME=%lld",
+ ktime_get_real_seconds());
+ envp[3] = NULL;
if (kobject_uevent_env(kobj, KOBJ_CHANGE, envp)) {
CERROR("%s: failed to send uevent %s\n",
for (i = 0; i < ARRAY_SIZE(envp); i++)
kfree(envp[i]);
+ kfree(path);
} else {
count += lustre_attr_store(kobj, attr, value,
strlen(value));
}
EXPORT_SYMBOL(class_modify_config);
-int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
- struct lustre_cfg *lcfg, void *data)
-{
- struct lprocfs_vars *var;
- struct file fakefile;
- struct seq_file fake_seqfile;
- char *key, *sval;
- int i, keylen, vallen;
- int matched = 0, j = 0;
- int rc = 0;
- int skip = 0;
-
- ENTRY;
-
- if (lcfg->lcfg_command != LCFG_PARAM) {
- CERROR("Unknown command: %d\n", lcfg->lcfg_command);
- RETURN(-EINVAL);
- }
-
- /* fake a seq file so that var->fops->write can work... */
- fakefile.private_data = &fake_seqfile;
- fake_seqfile.private = data;
- /*
- * e.g. tunefs.lustre --param mdt.group_upcall=foo /r/tmp/lustre-mdt
- * or lctl conf_param lustre-MDT0000.mdt.group_upcall=bar
- * or lctl conf_param lustre-OST0000.osc.max_dirty_mb=36
- */
- for (i = 1; i < lcfg->lcfg_bufcount; i++) {
- key = lustre_cfg_buf(lcfg, i);
- /* Strip off prefix */
- if (class_match_param(key, prefix, &key))
- /*
- * If the prefix doesn't match, return error so we
- * can pass it down the stack
- */
- RETURN(-ENOSYS);
- sval = strchr(key, '=');
- if (!sval || *(sval + 1) == 0) {
- CERROR("%s: can't parse param '%s' (missing '=')\n",
- lustre_cfg_string(lcfg, 0),
- lustre_cfg_string(lcfg, i));
- /* rc = -EINVAL; continue parsing other params */
- continue;
- }
- keylen = sval - key;
- sval++;
- vallen = strlen(sval);
- matched = 0;
- j = 0;
- /* Search proc entries */
- while (lvars[j].name) {
- var = &lvars[j];
- if (class_match_param(key, var->name, NULL) == 0 &&
- keylen == strlen(var->name)) {
- matched++;
- rc = -EROFS;
-
- if (var->fops && var->fops->write) {
- mm_segment_t oldfs;
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- rc = (var->fops->write)(&fakefile, sval,
- vallen, NULL);
- set_fs(oldfs);
- }
- break;
- }
- j++;
- }
- if (!matched) {
- /*
- * It was upgraded from old MDT/OST device,
- * ignore the obsolete "sec_level" parameter.
- */
- if (strncmp("sec_level", key, keylen) == 0)
- continue;
-
- CERROR("%s: unknown config parameter '%s'\n",
- lustre_cfg_string(lcfg, 0),
- lustre_cfg_string(lcfg, i));
- /* rc = -EINVAL; continue parsing other params */
- skip++;
- } else if (rc < 0) {
- CERROR("%s: error writing parameter '%s': rc = %d\n",
- lustre_cfg_string(lcfg, 0), key, rc);
- rc = 0;
- } else {
- CDEBUG(D_CONFIG, "%s: set parameter '%s'\n",
- lustre_cfg_string(lcfg, 0), key);
- }
- }
-
- if (rc > 0)
- rc = 0;
- if (!rc && skip)
- rc = skip;
- RETURN(rc);
-}
-EXPORT_SYMBOL(class_process_proc_param);
-
/*
* Supplemental functions for config logs, it allocates lustre_cfg
* buffers plus initialized llog record header at the beginning.
#ifdef HAVE_SERVER_SUPPORT
/* newer MDS replaces LOV/OSC with LOD/OSP */
- {
+ if ((lcfg->lcfg_command == LCFG_ATTACH ||
+ lcfg->lcfg_command == LCFG_SET_PARAM ||
+ lcfg->lcfg_command == LCFG_PARAM) &&
+ cfg->cfg_sb && IS_MDT(s2lsi(cfg->cfg_sb))) {
char *typename = lustre_cfg_string(lcfg, 1);
- if ((lcfg->lcfg_command == LCFG_ATTACH && typename &&
- strcmp(typename, LUSTRE_LOV_NAME) == 0) &&
- cfg->cfg_sb && IS_MDT(s2lsi(cfg->cfg_sb))) {
+ if (typename &&
+ strcmp(typename, LUSTRE_LOV_NAME) == 0) {
CDEBUG(D_CONFIG,
"For 2.x interoperability, rename obd "
"type from lov to lod (%s)\n",
s2lsi(cfg->cfg_sb)->lsi_svname);
strcpy(typename, LUSTRE_LOD_NAME);
}
- if ((lcfg->lcfg_command == LCFG_ATTACH && typename &&
- strcmp(typename, LUSTRE_OSC_NAME) == 0) &&
- cfg->cfg_sb && IS_MDT(s2lsi(cfg->cfg_sb))) {
+ if (typename &&
+ strcmp(typename, LUSTRE_OSC_NAME) == 0) {
CDEBUG(D_CONFIG,
"For 2.x interoperability, rename obd "
"type from osc to osp (%s)\n",
if (cfg->cfg_instance &&
lcfg->lcfg_command != LCFG_SPTLRPC_CONF &&
LUSTRE_CFG_BUFLEN(lcfg, 0) > 0) {
- inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) + 16 + 4;
+ inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) +
+ LUSTRE_MAXINSTANCE + 4;
OBD_ALLOC(inst_name, inst_len);
if (!inst_name)
GOTO(out, rc = -ENOMEM);
}
EXPORT_SYMBOL(class_config_parse_llog);
-static struct lcfg_type_data {
- __u32 ltd_type;
- char *ltd_name;
- char *ltd_bufs[4];
-} lcfg_data_table[] = {
- { LCFG_ATTACH, "attach", { "type", "UUID", "3", "4" } },
- { LCFG_DETACH, "detach", { "1", "2", "3", "4" } },
- { LCFG_SETUP, "setup", { "UUID", "node", "options", "failout" } },
- { LCFG_CLEANUP, "cleanup", { "1", "2", "3", "4" } },
- { LCFG_ADD_UUID, "add_uuid", { "node", "2", "3", "4" } },
- { LCFG_DEL_UUID, "del_uuid", { "1", "2", "3", "4" } },
- { LCFG_MOUNTOPT, "new_profile", { "name", "lov", "lmv", "4" } },
- { LCFG_DEL_MOUNTOPT, "del_mountopt", { "1", "2", "3", "4" } , },
- { LCFG_SET_TIMEOUT, "set_timeout", { "parameter", "2", "3", "4" } },
- { LCFG_SET_UPCALL, "set_upcall", { "1", "2", "3", "4" } },
- { LCFG_ADD_CONN, "add_conn", { "node", "2", "3", "4" } },
- { LCFG_DEL_CONN, "del_conn", { "1", "2", "3", "4" } },
- { LCFG_LOV_ADD_OBD, "add_osc", { "ost", "index", "gen", "UUID" } },
- { LCFG_LOV_DEL_OBD, "del_osc", { "1", "2", "3", "4" } },
- { LCFG_PARAM, "conf_param", { "parameter", "value", "3", "4" } },
- { LCFG_MARKER, "marker", { "1", "2", "3", "4" } },
- { LCFG_LOG_START, "log_start", { "1", "2", "3", "4" } },
- { LCFG_LOG_END, "log_end", { "1", "2", "3", "4" } },
- { LCFG_LOV_ADD_INA, "add_osc_inactive", { "1", "2", "3", "4" } },
- { LCFG_ADD_MDC, "add_mdc", { "mdt", "index", "gen", "UUID" } },
- { LCFG_DEL_MDC, "del_mdc", { "1", "2", "3", "4" } },
- { LCFG_SPTLRPC_CONF, "security", { "parameter", "2", "3", "4" } },
- { LCFG_POOL_NEW, "new_pool", { "fsname", "pool", "3", "4" } },
- { LCFG_POOL_ADD, "add_pool", { "fsname", "pool", "ost", "4" } },
- { LCFG_POOL_REM, "remove_pool", { "fsname", "pool", "ost", "4" } },
- { LCFG_POOL_DEL, "del_pool", { "fsname", "pool", "3", "4" } },
- { LCFG_SET_LDLM_TIMEOUT, "set_ldlm_timeout",
- { "parameter", "2", "3", "4" } },
- { LCFG_SET_PARAM, "set_param", { "parameter", "value", "3", "4" } },
- { 0, NULL, { NULL, NULL, NULL, NULL } }
-};
-
-static struct lcfg_type_data *lcfg_cmd2data(__u32 cmd)
-{
- int i = 0;
-
- while (lcfg_data_table[i].ltd_type != 0) {
- if (lcfg_data_table[i].ltd_type == cmd)
- return &lcfg_data_table[i];
- i++;
- }
- return NULL;
-}
-
/**
* Parse config record and output dump in supplied buffer.
*
char nidstr[LNET_NIDSTR_SIZE];
libcfs_nid2str_r(lcfg->lcfg_nid, nidstr, sizeof(nidstr));
- ptr += snprintf(ptr, end-ptr, "nid=%s(%#llx)\n ",
+ ptr += snprintf(ptr, end-ptr, "nid=%s(%#llx) ",
nidstr, lcfg->lcfg_nid);
}
}
EXPORT_SYMBOL(class_manual_cleanup);
+#ifdef HAVE_SERVER_SUPPORT
/*
- * uuid<->export lustre hash operations
- */
-
-static unsigned
-uuid_hash(struct cfs_hash *hs, const void *key, unsigned mask)
-{
- return cfs_hash_djb2_hash(((struct obd_uuid *)key)->uuid,
- sizeof(((struct obd_uuid *)key)->uuid), mask);
-}
-
-static void *
-uuid_key(struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- exp = hlist_entry(hnode, struct obd_export, exp_uuid_hash);
-
- return &exp->exp_client_uuid;
-}
-
-/*
- * NOTE: It is impossible to find an export that is in failed
- * state with this function
- */
-static int
-uuid_keycmp(const void *key, struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- LASSERT(key);
- exp = hlist_entry(hnode, struct obd_export, exp_uuid_hash);
-
- return obd_uuid_equals(key, &exp->exp_client_uuid) &&
- !exp->exp_failed;
-}
-
-static void *
-uuid_export_object(struct hlist_node *hnode)
-{
- return hlist_entry(hnode, struct obd_export, exp_uuid_hash);
-}
-
-static void
-uuid_export_get(struct cfs_hash *hs, struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- exp = hlist_entry(hnode, struct obd_export, exp_uuid_hash);
- class_export_get(exp);
-}
-
-static void
-uuid_export_put_locked(struct cfs_hash *hs, struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- exp = hlist_entry(hnode, struct obd_export, exp_uuid_hash);
- class_export_put(exp);
-}
-
-static struct cfs_hash_ops uuid_hash_ops = {
- .hs_hash = uuid_hash,
- .hs_key = uuid_key,
- .hs_keycmp = uuid_keycmp,
- .hs_object = uuid_export_object,
- .hs_get = uuid_export_get,
- .hs_put_locked = uuid_export_put_locked,
-};
-
-
-/*
- * nid<->export hash operations
+ * nid<->nidstats hash operations
*/
-
static unsigned
-nid_hash(struct cfs_hash *hs, const void *key, unsigned mask)
+nidstats_hash(struct cfs_hash *hs, const void *key, unsigned int mask)
{
return cfs_hash_djb2_hash(key, sizeof(lnet_nid_t), mask);
}
static void *
-nid_key(struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- exp = hlist_entry(hnode, struct obd_export, exp_nid_hash);
-
- RETURN(&exp->exp_connection->c_peer.nid);
-}
-
-/*
- * NOTE: It is impossible to find an export that is in failed
- * state with this function
- */
-static int
-nid_kepcmp(const void *key, struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- LASSERT(key);
- exp = hlist_entry(hnode, struct obd_export, exp_nid_hash);
-
- RETURN(exp->exp_connection->c_peer.nid == *(lnet_nid_t *)key &&
- !exp->exp_failed);
-}
-
-static void *
-nid_export_object(struct hlist_node *hnode)
-{
- return hlist_entry(hnode, struct obd_export, exp_nid_hash);
-}
-
-static void
-nid_export_get(struct cfs_hash *hs, struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- exp = hlist_entry(hnode, struct obd_export, exp_nid_hash);
- class_export_get(exp);
-}
-
-static void
-nid_export_put_locked(struct cfs_hash *hs, struct hlist_node *hnode)
-{
- struct obd_export *exp;
-
- exp = hlist_entry(hnode, struct obd_export, exp_nid_hash);
- class_export_put(exp);
-}
-
-static struct cfs_hash_ops nid_hash_ops = {
- .hs_hash = nid_hash,
- .hs_key = nid_key,
- .hs_keycmp = nid_kepcmp,
- .hs_object = nid_export_object,
- .hs_get = nid_export_get,
- .hs_put_locked = nid_export_put_locked,
-};
-
-
-/*
- * nid<->nidstats hash operations
- */
-
-static void *
nidstats_key(struct hlist_node *hnode)
{
struct nid_stat *ns;
}
static struct cfs_hash_ops nid_stat_hash_ops = {
- .hs_hash = nid_hash,
+ .hs_hash = nidstats_hash,
.hs_key = nidstats_key,
.hs_keycmp = nidstats_keycmp,
.hs_object = nidstats_object,
.hs_get = gen_export_get,
.hs_put_locked = gen_export_put_locked,
};
+
+#endif /* HAVE_SERVER_SUPPORT */