As the kobject has a name (after kobject_add has been called),
we don't need to also store it in typ_name.
So use typ_kobj.name instead of typ_name.
This requires changing some "char *" to "const char *" as
typ.kobj.name is const.
Change-Id: Iaf0ef192e91ba1b4bd1c1b124dc1068de632d341
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/34717
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
/** What portal do we expect replies on */
__u32 cli_reply_portal;
/** Name of the client */
/** What portal do we expect replies on */
__u32 cli_reply_portal;
/** Name of the client */
};
/** state flags of requests */
};
/** state flags of requests */
*/
void ptlrpc_request_committed(struct ptlrpc_request *req, int force);
*/
void ptlrpc_request_committed(struct ptlrpc_request *req, int force);
-void ptlrpc_init_client(int req_portal, int rep_portal, char *name,
+void ptlrpc_init_client(int req_portal, int rep_portal, const char *name,
struct ptlrpc_client *);
void ptlrpc_cleanup_client(struct obd_import *imp);
struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid,
struct ptlrpc_client *);
void ptlrpc_cleanup_client(struct obd_import *imp);
struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid,
#ifdef HAVE_SERVER_SUPPORT
bool typ_sym_filter;
#endif
#ifdef HAVE_SERVER_SUPPORT
bool typ_sym_filter;
#endif
int typ_refcnt;
struct lu_device_type *typ_lu;
spinlock_t obd_type_lock;
struct kobject typ_kobj;
};
int typ_refcnt;
struct lu_device_type *typ_lu;
spinlock_t obd_type_lock;
struct kobject typ_kobj;
};
+#define typ_name typ_kobj.name
struct brw_page {
u64 off;
struct brw_page {
u64 off;
struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
void class_obd_list(void);
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
void class_obd_list(void);
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
struct obd_uuid *grp_uuid);
struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
int *next);
struct obd_uuid *grp_uuid);
struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
int *next);
struct obd_import *imp;
struct obd_uuid server_uuid;
int rq_portal, rp_portal, connect_op;
struct obd_import *imp;
struct obd_uuid server_uuid;
int rq_portal, rp_portal, connect_op;
- char *name = obddev->obd_type->typ_name;
+ const char *name = obddev->obd_type->typ_name;
enum ldlm_ns_type ns_type = LDLM_NS_TYPE_UNKNOWN;
char *cli_name = lustre_cfg_buf(lcfg, 0);
struct ptlrpc_connection fake_conn = { .c_self = 0,
enum ldlm_ns_type ns_type = LDLM_NS_TYPE_UNKNOWN;
char *cli_name = lustre_cfg_buf(lcfg, 0);
struct ptlrpc_connection fake_conn = { .c_self = 0,
list_del(&type->typ_chain);
spin_unlock(&obd_types_lock);
list_del(&type->typ_chain);
spin_unlock(&obd_types_lock);
- if (type->typ_procroot)
- remove_proc_subtree(type->typ_name, proc_lustre_root);
+ if (type->typ_name && type->typ_procroot)
+ remove_proc_subtree(type->typ_name, proc_lustre_root);
- OBD_FREE(type->typ_name, strlen(type->typ_name) + 1);
- }
if (type->typ_md_ops)
OBD_FREE_PTR(type->typ_md_ops);
if (type->typ_dt_ops)
if (type->typ_md_ops)
OBD_FREE_PTR(type->typ_md_ops);
if (type->typ_dt_ops)
#endif /* HAVE_SERVER_SUPPORT */
OBD_ALLOC_PTR(type->typ_dt_ops);
OBD_ALLOC_PTR(type->typ_md_ops);
#endif /* HAVE_SERVER_SUPPORT */
OBD_ALLOC_PTR(type->typ_dt_ops);
OBD_ALLOC_PTR(type->typ_md_ops);
- OBD_ALLOC(type->typ_name, strlen(name) + 1);
if (type->typ_dt_ops == NULL ||
if (type->typ_dt_ops == NULL ||
- type->typ_md_ops == NULL ||
- type->typ_name == NULL)
+ type->typ_md_ops == NULL)
GOTO (failed, rc = -ENOMEM);
*(type->typ_dt_ops) = *dt_ops;
/* md_ops is optional */
if (md_ops)
*(type->typ_md_ops) = *md_ops;
GOTO (failed, rc = -ENOMEM);
*(type->typ_dt_ops) = *dt_ops;
/* md_ops is optional */
if (md_ops)
*(type->typ_md_ops) = *md_ops;
- strcpy(type->typ_name, name);
spin_lock_init(&type->obd_type_lock);
#ifdef HAVE_SERVER_SUPPORT
spin_lock_init(&type->obd_type_lock);
#ifdef HAVE_SERVER_SUPPORT
#endif
#ifdef CONFIG_PROC_FS
if (enable_proc && !type->typ_procroot) {
#endif
#ifdef CONFIG_PROC_FS
if (enable_proc && !type->typ_procroot) {
- type->typ_procroot = lprocfs_register(type->typ_name,
+ type->typ_procroot = lprocfs_register(name,
proc_lustre_root,
NULL, type);
if (IS_ERR(type->typ_procroot)) {
proc_lustre_root,
NULL, type);
if (IS_ERR(type->typ_procroot)) {
specified, then only the client with that uuid is returned,
otherwise any client connected to the tgt is returned. */
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
specified, then only the client with that uuid is returned,
otherwise any client connected to the tgt is returned. */
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
struct obd_uuid *grp_uuid)
{
int i;
struct obd_uuid *grp_uuid)
{
int i;
if (obd == NULL)
continue;
if (obd == NULL)
continue;
- if ((strncmp(obd->obd_type->typ_name, typ_name,
- strlen(typ_name)) == 0)) {
+ if ((strncmp(obd->obd_type->typ_name, type_name,
+ strlen(type_name)) == 0)) {
if (obd_uuid_equals(tgt_uuid,
&obd->u.cli.cl_target_uuid) &&
((grp_uuid)? obd_uuid_equals(grp_uuid,
if (obd_uuid_equals(tgt_uuid,
&obd->u.cli.cl_target_uuid) &&
((grp_uuid)? obd_uuid_equals(grp_uuid,
__u32 old;
int diff;
int i;
__u32 old;
int diff;
int i;
int rc;
if (max > OBD_MAX_RIF_MAX || max < 1)
return -ERANGE;
int rc;
if (max > OBD_MAX_RIF_MAX || max < 1)
return -ERANGE;
- typ_name = cli->cl_import->imp_obd->obd_type->typ_name;
- if (strcmp(typ_name, LUSTRE_MDC_NAME) == 0) {
+ type_name = cli->cl_import->imp_obd->obd_type->typ_name;
+ if (strcmp(type_name, LUSTRE_MDC_NAME) == 0) {
/* adjust max_mod_rpcs_in_flight to ensure it is always
* strictly lower that max_rpcs_in_flight */
if (max < 2) {
/* adjust max_mod_rpcs_in_flight to ensure it is always
* strictly lower that max_rpcs_in_flight */
if (max < 2) {
/**
* Initialize passed in client structure \a cl.
*/
/**
* Initialize passed in client structure \a cl.
*/
-void ptlrpc_init_client(int req_portal, int rep_portal, char *name,
+void ptlrpc_init_client(int req_portal, int rep_portal, const char *name,
struct ptlrpc_client *cl)
{
cl->cli_request_portal = req_portal;
struct ptlrpc_client *cl)
{
cl->cli_request_portal = req_portal;
imp->imp_obd->obd_type == NULL) {
rc = -EINVAL;
} else {
imp->imp_obd->obd_type == NULL) {
rc = -EINVAL;
} else {
- argv[2] = imp->imp_obd->obd_type->typ_name;
+ argv[2] = (char *)imp->imp_obd->obd_type->typ_name;
argv[4] = imp->imp_obd->obd_name;
spin_lock(&imp->imp_sec->ps_lock);
if (imp->imp_sec->ps_sepol_mtime == 0 &&
argv[4] = imp->imp_obd->obd_name;
spin_lock(&imp->imp_sec->ps_lock);
if (imp->imp_sec->ps_sepol_mtime == 0 &&