int lmd_parse(char *options, struct lustre_mount_data *lmd);
/* mgc_request.c */
-int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
-int mgc_logname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
+int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id,
+ enum mgs_cfg_type type);
+int mgc_logname2resid(char *fsname, struct ldlm_res_id *res_id,
+ enum mgs_cfg_type type);
/** @} disk */
struct config_llog_data *cld_barrier;/* barrier log (for MDT only) */
struct obd_export *cld_mgcexp;
struct mutex cld_lock;
- int cld_type;
+ enum mgs_cfg_type cld_type;
unsigned int cld_stopping:1, /* we were told to stop
* watching */
cld_lostlock:1; /* lock not requeued */
} u;
};
-enum {
- CONFIG_T_CONFIG = 0,
- CONFIG_T_SPTLRPC = 1,
- CONFIG_T_RECOVER = 2,
- CONFIG_T_PARAMS = 3,
- CONFIG_T_NODEMAP = 4,
- CONFIG_T_BARRIER = 5,
- CONFIG_T_MAX
+enum mgs_cfg_type {
+ MGS_CFG_T_CONFIG = 0,
+ MGS_CFG_T_SPTLRPC = 1,
+ MGS_CFG_T_RECOVER = 2,
+ MGS_CFG_T_PARAMS = 3,
+ MGS_CFG_T_NODEMAP = 4,
+ MGS_CFG_T_BARRIER = 5,
+ MGS_CFG_T_MAX
};
struct mgs_config_body {
char mcb_name[MTI_NAME_MAXLEN]; /* logname */
__u64 mcb_offset; /* next index of config log to request */
- __u16 mcb_type; /* type of log: CONFIG_T_[CONFIG|RECOVER] */
+ __u16 mcb_type; /* type of log: MGS_CFG_T_[CONFIG|RECOVER] */
__u8 mcb_nm_cur_pass;
__u8 mcb_bits; /* bits unit size of config log */
__u32 mcb_units; /* # of units for bulk transfer */
int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld);
-static inline int cld_is_sptlrpc(struct config_llog_data *cld)
+static inline bool cld_is_sptlrpc(struct config_llog_data *cld)
{
- return cld->cld_type == CONFIG_T_SPTLRPC;
+ return cld->cld_type == MGS_CFG_T_SPTLRPC;
}
-static inline int cld_is_recover(struct config_llog_data *cld)
+static inline bool cld_is_recover(struct config_llog_data *cld)
{
- return cld->cld_type == CONFIG_T_RECOVER;
+ return cld->cld_type == MGS_CFG_T_RECOVER;
}
-static inline int cld_is_nodemap(struct config_llog_data *cld)
+static inline bool cld_is_nodemap(struct config_llog_data *cld)
{
- return cld->cld_type == CONFIG_T_NODEMAP;
+ return cld->cld_type == MGS_CFG_T_NODEMAP;
}
-static inline int cld_is_barrier(struct config_llog_data *cld)
+static inline bool cld_is_barrier(struct config_llog_data *cld)
{
- return cld->cld_type == CONFIG_T_BARRIER;
+ return cld->cld_type == MGS_CFG_T_BARRIER;
}
#endif /* _MGC_INTERNAL_H */
#include "mgc_internal.h"
static int mgc_name2resid(char *name, int len, struct ldlm_res_id *res_id,
- int type)
+ enum mgs_cfg_type type)
{
__u64 resname = 0;
res_id->name[0] = cpu_to_le64(resname);
/* XXX: unfortunately, sptlprc and config llog share one lock */
switch(type) {
- case CONFIG_T_CONFIG:
- case CONFIG_T_SPTLRPC:
+ case MGS_CFG_T_CONFIG:
+ case MGS_CFG_T_SPTLRPC:
resname = 0;
break;
- case CONFIG_T_RECOVER:
- case CONFIG_T_PARAMS:
- case CONFIG_T_NODEMAP:
- case CONFIG_T_BARRIER:
+ case MGS_CFG_T_RECOVER:
+ case MGS_CFG_T_PARAMS:
+ case MGS_CFG_T_NODEMAP:
+ case MGS_CFG_T_BARRIER:
resname = type;
break;
default:
return 0;
}
-int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type)
+int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id,
+ enum mgs_cfg_type type)
{
/* fsname is at most 8 chars long, maybe contain "-".
* e.g. "lustre", "SUN-000" */
}
EXPORT_SYMBOL(mgc_fsname2resid);
-int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, int type)
+int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id,
+ enum mgs_cfg_type type)
{
char *name_end;
int len;
static
struct config_llog_data *do_config_log_add(struct obd_device *obd,
char *logname,
- int type,
+ enum mgs_cfg_type type,
struct config_llog_instance *cfg,
struct super_block *sb)
{
strncat(logname, "-cliir", sizeof(logname));
}
- cld = do_config_log_add(obd, logname, CONFIG_T_RECOVER, &lcfg, sb);
+ cld = do_config_log_add(obd, logname, MGS_CFG_T_RECOVER, &lcfg, sb);
return cld;
}
-static struct config_llog_data *config_log_find_or_add(struct obd_device *obd,
- char *logname, struct super_block *sb, int type,
- struct config_llog_instance *cfg)
+static struct config_llog_data *
+config_log_find_or_add(struct obd_device *obd, char *logname,
+ struct super_block *sb, enum mgs_cfg_type type,
+ struct config_llog_instance *cfg)
{
struct config_llog_instance lcfg = *cfg;
struct config_llog_data *cld;
if (cfg->cfg_sub_clds & CONFIG_SUB_SPTLRPC) {
sptlrpc_cld = config_log_find_or_add(obd, seclogname, NULL,
- CONFIG_T_SPTLRPC, cfg);
+ MGS_CFG_T_SPTLRPC, cfg);
if (IS_ERR(sptlrpc_cld)) {
CERROR("%s: can't create sptlrpc log %s: rc = %ld\n",
obd->obd_name, seclogname, PTR_ERR(sptlrpc_cld));
if (!IS_MGS(lsi) && cfg->cfg_sub_clds & CONFIG_SUB_NODEMAP) {
nodemap_cld = config_log_find_or_add(obd, LUSTRE_NODEMAP_NAME,
- NULL, CONFIG_T_NODEMAP,
+ NULL, MGS_CFG_T_NODEMAP,
cfg);
if (IS_ERR(nodemap_cld)) {
rc = PTR_ERR(nodemap_cld);
if (cfg->cfg_sub_clds & CONFIG_SUB_PARAMS) {
params_cld = config_log_find_or_add(obd, PARAMS_FILENAME, sb,
- CONFIG_T_PARAMS, cfg);
+ MGS_CFG_T_PARAMS, cfg);
if (IS_ERR(params_cld)) {
rc = PTR_ERR(params_cld);
CERROR("%s: can't create params log: rc = %d\n",
snprintf(seclogname + (ptr - logname), sizeof(seclogname) - 1,
"-%s", BARRIER_FILENAME);
barrier_cld = config_log_find_or_add(obd, seclogname, sb,
- CONFIG_T_BARRIER, cfg);
+ MGS_CFG_T_BARRIER, cfg);
if (IS_ERR(barrier_cld)) {
rc = PTR_ERR(barrier_cld);
CERROR("%s: can't create barrier log: rc = %d\n",
}
}
- cld = do_config_log_add(obd, logname, CONFIG_T_CONFIG, cfg, sb);
+ cld = do_config_log_add(obd, logname, MGS_CFG_T_CONFIG, cfg, sb);
if (IS_ERR(cld)) {
rc = PTR_ERR(cld);
CERROR("%s: can't create log: rc = %d\n",
LASSERT(fsdb->fsdb_mdt_count > 0);
- rc = mgc_logname2resid(fsdb->fsdb_name, &res_id, CONFIG_T_BARRIER);
+ rc = mgc_logname2resid(fsdb->fsdb_name, &res_id, MGS_CFG_T_BARRIER);
if (rc)
RETURN(rc);
return mgs_completion_ast_generic(lock, flags, cbdata, AST_BARRIER);
}
-void mgs_revoke_lock(struct mgs_device *mgs, struct fs_db *fsdb, int type)
+void mgs_revoke_lock(struct mgs_device *mgs, struct fs_db *fsdb,
+ enum mgs_cfg_type type)
{
ldlm_completion_callback cp = NULL;
struct lustre_handle lockh = {
rc = mgc_fsname2resid(fsdb->fsdb_name, &res_id, type);
LASSERT(rc == 0);
switch (type) {
- case CONFIG_T_CONFIG:
- case CONFIG_T_NODEMAP:
+ case MGS_CFG_T_CONFIG:
+ case MGS_CFG_T_NODEMAP:
cp = mgs_completion_ast_config;
if (test_and_set_bit(FSDB_REVOKING_LOCK, &fsdb->fsdb_flags))
rc = -EALREADY;
break;
- case CONFIG_T_PARAMS:
+ case MGS_CFG_T_PARAMS:
cp = mgs_completion_ast_params;
if (test_and_set_bit(FSDB_REVOKING_PARAMS, &fsdb->fsdb_flags))
rc = -EALREADY;
break;
- case CONFIG_T_RECOVER:
+ case MGS_CFG_T_RECOVER:
cp = mgs_completion_ast_ir;
break;
- case CONFIG_T_BARRIER:
+ case MGS_CFG_T_BARRIER:
cp = mgs_completion_ast_barrier;
break;
default:
le64_to_cpu(res_id.name[0]),
le64_to_cpu(res_id.name[1]), rc);
- if (type == CONFIG_T_CONFIG)
+ if (type == MGS_CFG_T_CONFIG)
clear_bit(FSDB_REVOKING_LOCK,
&fsdb->fsdb_flags);
- if (type == CONFIG_T_PARAMS)
+ if (type == MGS_CFG_T_PARAMS)
clear_bit(FSDB_REVOKING_PARAMS,
&fsdb->fsdb_flags);
}
}
out:
- mgs_revoke_lock(mgs, c_fsdb, CONFIG_T_CONFIG);
+ mgs_revoke_lock(mgs, c_fsdb, MGS_CFG_T_CONFIG);
out_norevoke:
if (!rc && mti->mti_flags & LDD_F_SV_TYPE_MDT && b_fsdb) {
}
switch (body->mcb_type) {
- case CONFIG_T_RECOVER:
+ case MGS_CFG_T_RECOVER:
rc = mgs_get_ir_logs(req);
break;
- case CONFIG_T_NODEMAP:
+ case MGS_CFG_T_NODEMAP:
rc = nodemap_get_config_req(req->rq_export->exp_obd, req);
break;
- case CONFIG_T_CONFIG:
+ case MGS_CFG_T_CONFIG:
rc = -EOPNOTSUPP;
break;
default:
CWARN("%s: cannot make nodemap fsdb: rc = %d\n",
mgs->mgs_obd->obd_name, rc);
} else {
- mgs_revoke_lock(mgs, fsdb, CONFIG_T_NODEMAP);
+ mgs_revoke_lock(mgs, fsdb, MGS_CFG_T_NODEMAP);
mgs_put_fsdb(mgs, fsdb);
}
int mgs_get_lock(struct obd_device *obd, struct ldlm_res_id *res,
struct lustre_handle *lockh);
int mgs_put_lock(struct lustre_handle *lockh);
-void mgs_revoke_lock(struct mgs_device *mgs, struct fs_db *fsdb, int type);
+void mgs_revoke_lock(struct mgs_device *mgs, struct fs_db *fsdb,
+ enum mgs_cfg_type type);
/* mgs_nids.c */
int mgs_ir_update(const struct lu_env *env, struct mgs_device *mgs,
mutex_lock(&fsdb->fsdb_mutex);
rc = mgs_write_log_param(env, mgs, fsdb, mti, mti->mti_params);
mutex_unlock(&fsdb->fsdb_mutex);
- mgs_revoke_lock(mgs, fsdb, CONFIG_T_CONFIG);
+ mgs_revoke_lock(mgs, fsdb, MGS_CFG_T_CONFIG);
out:
if (fsdb)
mutex_lock(&fsdb->fsdb_mutex);
rc = mgs_write_log_param2(env, mgs, fsdb, mti, mti->mti_params);
mutex_unlock(&fsdb->fsdb_mutex);
- mgs_revoke_lock(mgs, fsdb, CONFIG_T_PARAMS);
+ mgs_revoke_lock(mgs, fsdb, MGS_CFG_T_PARAMS);
mgs_put_fsdb(mgs, fsdb);
out:
RETURN(rc);
locked = false;
name_destroy(&logname);
/* request for update */
- mgs_revoke_lock(mgs, fsdb, CONFIG_T_CONFIG);
+ mgs_revoke_lock(mgs, fsdb, MGS_CFG_T_CONFIG);
GOTO(out_mti, rc);
snprintf(name, sizeof(name) - 1, "mgs_%s_notify", fsdb->fsdb_name);
complete(&fsdb->fsdb_notify_comp);
set_user_nice(current, -2);
- mgc_fsname2resid(fsdb->fsdb_name, &resid, CONFIG_T_RECOVER);
+ mgc_fsname2resid(fsdb->fsdb_name, &resid, MGS_CFG_T_RECOVER);
while (1) {
wait_event_idle(fsdb->fsdb_notify_waitq,
fsdb->fsdb_notify_stop ||
name, atomic_read(&fsdb->fsdb_notify_phase));
fsdb->fsdb_notify_start = ktime_get();
- mgs_revoke_lock(fsdb->fsdb_mgs, fsdb, CONFIG_T_RECOVER);
+ mgs_revoke_lock(fsdb->fsdb_mgs, fsdb, MGS_CFG_T_RECOVER);
}
complete(&fsdb->fsdb_notify_comp);
if (!body)
RETURN(-EINVAL);
- if (body->mcb_type != CONFIG_T_RECOVER)
+ if (body->mcb_type != MGS_CFG_T_RECOVER)
RETURN(-EINVAL);
rc = delogname(body->mcb_name, fsname, &type);
if (!body)
RETURN(-EINVAL);
- if (body->mcb_type != CONFIG_T_NODEMAP)
+ if (body->mcb_type != MGS_CFG_T_NODEMAP)
RETURN(-EINVAL);
rdpg.rp_count = (body->mcb_units << body->mcb_bits);
(long long)(int)offsetof(struct mgs_config_body, mcb_units));
LASSERTF((int)sizeof(((struct mgs_config_body *)0)->mcb_units) == 4, "found %lld\n",
(long long)(int)sizeof(((struct mgs_config_body *)0)->mcb_units));
- BUILD_BUG_ON(CONFIG_T_CONFIG != 0);
- BUILD_BUG_ON(CONFIG_T_SPTLRPC != 1);
- BUILD_BUG_ON(CONFIG_T_RECOVER != 2);
- BUILD_BUG_ON(CONFIG_T_PARAMS != 3);
- BUILD_BUG_ON(CONFIG_T_NODEMAP != 4);
- BUILD_BUG_ON(CONFIG_T_BARRIER != 5);
+ BUILD_BUG_ON(MGS_CFG_T_CONFIG != 0);
+ BUILD_BUG_ON(MGS_CFG_T_SPTLRPC != 1);
+ BUILD_BUG_ON(MGS_CFG_T_RECOVER != 2);
+ BUILD_BUG_ON(MGS_CFG_T_PARAMS != 3);
+ BUILD_BUG_ON(MGS_CFG_T_NODEMAP != 4);
+ BUILD_BUG_ON(MGS_CFG_T_BARRIER != 5);
/* Checks for struct mgs_config_res */
LASSERTF((int)sizeof(struct mgs_config_res) == 16, "found %lld\n",
CHECK_MEMBER(mgs_config_body, mcb_bits);
CHECK_MEMBER(mgs_config_body, mcb_units);
- CHECK_CVALUE(CONFIG_T_CONFIG);
- CHECK_CVALUE(CONFIG_T_SPTLRPC);
- CHECK_CVALUE(CONFIG_T_RECOVER);
- CHECK_CVALUE(CONFIG_T_PARAMS);
- CHECK_CVALUE(CONFIG_T_NODEMAP);
- CHECK_CVALUE(CONFIG_T_BARRIER);
+ CHECK_CVALUE(MGS_CFG_T_CONFIG);
+ CHECK_CVALUE(MGS_CFG_T_SPTLRPC);
+ CHECK_CVALUE(MGS_CFG_T_RECOVER);
+ CHECK_CVALUE(MGS_CFG_T_PARAMS);
+ CHECK_CVALUE(MGS_CFG_T_NODEMAP);
+ CHECK_CVALUE(MGS_CFG_T_BARRIER);
}
static void
(long long)(int)offsetof(struct mgs_config_body, mcb_units));
LASSERTF((int)sizeof(((struct mgs_config_body *)0)->mcb_units) == 4, "found %lld\n",
(long long)(int)sizeof(((struct mgs_config_body *)0)->mcb_units));
- BUILD_BUG_ON(CONFIG_T_CONFIG != 0);
- BUILD_BUG_ON(CONFIG_T_SPTLRPC != 1);
- BUILD_BUG_ON(CONFIG_T_RECOVER != 2);
- BUILD_BUG_ON(CONFIG_T_PARAMS != 3);
- BUILD_BUG_ON(CONFIG_T_NODEMAP != 4);
- BUILD_BUG_ON(CONFIG_T_BARRIER != 5);
+ BUILD_BUG_ON(MGS_CFG_T_CONFIG != 0);
+ BUILD_BUG_ON(MGS_CFG_T_SPTLRPC != 1);
+ BUILD_BUG_ON(MGS_CFG_T_RECOVER != 2);
+ BUILD_BUG_ON(MGS_CFG_T_PARAMS != 3);
+ BUILD_BUG_ON(MGS_CFG_T_NODEMAP != 4);
+ BUILD_BUG_ON(MGS_CFG_T_BARRIER != 5);
/* Checks for struct mgs_config_res */
LASSERTF((int)sizeof(struct mgs_config_res) == 16, "found %lld\n",