diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/obd_config.c')
-rw-r--r-- | drivers/staging/lustre/lustre/obdclass/obd_config.c | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 49cdc647910c..5395e994deab 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -71,8 +71,9 @@ int class_find_param(char *buf, char *key, char **valp) EXPORT_SYMBOL(class_find_param); /* returns 0 if this is the first key in the buffer, else 1. - valp points to first char after key. */ -static int class_match_param(char *buf, char *key, char **valp) + * valp points to first char after key. + */ +static int class_match_param(char *buf, const char *key, char **valp) { if (!buf) return 1; @@ -114,9 +115,10 @@ enum { }; /* 0 is good nid, - 1 not found - < 0 error - endh is set to next separator */ + * 1 not found + * < 0 error + * endh is set to next separator + */ static int class_parse_value(char *buf, int opc, void *value, char **endh, int quiet) { @@ -210,7 +212,7 @@ static int class_attach(struct lustre_cfg *lcfg) name, typename, rc); goto out; } - LASSERTF(obd != NULL, "Cannot get obd device %s of type %s\n", + LASSERTF(obd, "Cannot get obd device %s of type %s\n", name, typename); LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC, "obd %p obd_magic %08X != %08X\n", @@ -230,7 +232,8 @@ static int class_attach(struct lustre_cfg *lcfg) mutex_init(&obd->obd_dev_mutex); spin_lock_init(&obd->obd_osfs_lock); /* obd->obd_osfs_age must be set to a value in the distant - * past to guarantee a fresh statfs is fetched on mount. */ + * past to guarantee a fresh statfs is fetched on mount. + */ obd->obd_osfs_age = cfs_time_shift_64(-1000); /* XXX belongs in setup not attach */ @@ -272,9 +275,9 @@ static int class_attach(struct lustre_cfg *lcfg) obd->obd_minor, typename, atomic_read(&obd->obd_refcount)); return 0; out: - if (obd != NULL) { + if (obd) class_release_dev(obd); - } + return rc; } @@ -286,7 +289,7 @@ static int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) int err = 0; struct obd_export *exp; - LASSERT(obd != NULL); + LASSERT(obd); LASSERTF(obd == class_num2obd(obd->obd_minor), "obd %p != obd_devs[%d] %p\n", obd, obd->obd_minor, class_num2obd(obd->obd_minor)); @@ -315,7 +318,8 @@ static int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) return -EEXIST; } /* just leave this on forever. I can't use obd_set_up here because - other fns check that status, and we're not actually set up yet. */ + * other fns check that status, and we're not actually set up yet. + */ obd->obd_starting = 1; obd->obd_uuid_hash = NULL; spin_unlock(&obd->obd_dev_lock); @@ -503,7 +507,8 @@ void class_decref(struct obd_device *obd, const char *scope, const void *source) if ((refs == 1) && obd->obd_stopping) { /* All exports have been destroyed; there should - be no more in-progress ops by this point.*/ + * be no more in-progress ops by this point. + */ spin_lock(&obd->obd_self_export->exp_lock); obd->obd_self_export->exp_flags |= exp_flags_from_obd(obd); @@ -723,7 +728,8 @@ static int class_set_global(char *ptr, int val, struct lustre_cfg *lcfg) } /* We can't call ll_process_config or lquota_process_config directly because - * it lives in a module that must be loaded after this one. */ + * it lives in a module that must be loaded after this one. + */ static int (*client_process_config)(struct lustre_cfg *lcfg); static int (*quota_process_config)(struct lustre_cfg *lcfg); @@ -812,7 +818,8 @@ int class_process_config(struct lustre_cfg *lcfg) lustre_cfg_string(lcfg, 2), lustre_cfg_string(lcfg, 3)); /* set these mount options somewhere, so ll_fill_super - * can find them. */ + * can find them. + */ err = class_add_profile(LUSTRE_CFG_BUFLEN(lcfg, 1), lustre_cfg_string(lcfg, 1), LUSTRE_CFG_BUFLEN(lcfg, 2), @@ -988,8 +995,9 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, 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 */ + * 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 */ @@ -1008,7 +1016,7 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, /* Search proc entries */ while (lvars[j].name) { var = &lvars[j]; - if (class_match_param(key, (char *)var->name, NULL) == 0 + if (!class_match_param(key, var->name, NULL) && keylen == strlen(var->name)) { matched++; rc = -EROFS; @@ -1027,9 +1035,10 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, } if (!matched) { /* If the prefix doesn't match, return error so we - can pass it down the stack */ + * can pass it down the stack + */ if (strnchr(key, keylen, '.')) - return -ENOSYS; + return -ENOSYS; CERROR("%s: unknown param %s\n", (char *)lustre_cfg_string(lcfg, 0), key); /* rc = -EINVAL; continue parsing other params */ @@ -1040,9 +1049,9 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, rc = 0; } else { CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n", - lustre_cfg_string(lcfg, 0), - (int)strlen(prefix) - 1, prefix, - (int)(sval - key - 1), key, sval); + lustre_cfg_string(lcfg, 0), + (int)strlen(prefix) - 1, prefix, + (int)(sval - key - 1), key, sval); } } @@ -1116,7 +1125,8 @@ int class_config_llog_handler(const struct lu_env *env, } } /* A config command without a start marker before it is - illegal (post 146) */ + * illegal (post 146) + */ if (!(clli->cfg_flags & CFG_F_COMPAT146) && !(clli->cfg_flags & CFG_F_MARKER) && (lcfg->lcfg_command != LCFG_MARKER)) { @@ -1182,8 +1192,9 @@ int class_config_llog_handler(const struct lu_env *env, } /* we override the llog's uuid for clients, to insure they - are unique */ - if (clli && clli->cfg_instance != NULL && + * are unique + */ + if (clli && clli->cfg_instance && lcfg->lcfg_command == LCFG_ATTACH) { lustre_cfg_bufs_set_string(&bufs, 2, clli->cfg_uuid.uuid); @@ -1211,7 +1222,8 @@ int class_config_llog_handler(const struct lu_env *env, lcfg_new->lcfg_flags = lcfg->lcfg_flags; /* XXX Hack to try to remain binary compatible with - * pre-newconfig logs */ + * pre-newconfig logs + */ if (lcfg->lcfg_nal != 0 && /* pre-newconfig log? */ (lcfg->lcfg_nid >> 32) == 0) { __u32 addr = (__u32)(lcfg->lcfg_nid & 0xffffffff); @@ -1270,7 +1282,7 @@ int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, if (cfg) { cd.lpcd_first_idx = cfg->cfg_last_idx; callback = cfg->cfg_callback; - LASSERT(callback != NULL); + LASSERT(callback); } else { callback = class_config_llog_handler; } |