aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/mdc/mdc_request.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/mdc/mdc_request.c')
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_request.c51
1 files changed, 22 insertions, 29 deletions
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index f8ef5fe5e771..7f208a6621e6 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req,
if (IS_ERR(c)) {
CDEBUG(D_INFO, "alloc capa failed!\n");
return PTR_ERR(c);
- } else {
- c->c_capa = *capa;
- *oc = c;
- return 0;
}
+
+ c->c_capa = *capa;
+ *oc = c;
+ return 0;
}
static inline int mdc_queue_wait(struct ptlrpc_request *req)
@@ -1201,7 +1201,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf)
/* Key is KEY_FID2PATH + getinfo_fid2path description */
keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf);
- OBD_ALLOC(key, keylen);
+ key = kzalloc(keylen, GFP_NOFS);
if (key == NULL)
return -ENOMEM;
memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH));
@@ -1234,7 +1234,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf)
PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno, gf->gf_path);
out:
- OBD_FREE(key, keylen);
+ kfree(key);
return rc;
}
@@ -1604,7 +1604,7 @@ static int mdc_changelog_send_thread(void *csdata)
CDEBUG(D_CHANGELOG, "changelog to fp=%p start %llu\n",
cs->cs_fp, cs->cs_startrec);
- OBD_ALLOC(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE);
+ cs->cs_buf = kzalloc(KUC_CHANGELOG_MSG_MAXSIZE, GFP_NOFS);
if (cs->cs_buf == NULL) {
rc = -ENOMEM;
goto out;
@@ -1644,9 +1644,8 @@ out:
llog_cat_close(NULL, llh);
if (ctxt)
llog_ctxt_put(ctxt);
- if (cs->cs_buf)
- OBD_FREE(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE);
- OBD_FREE_PTR(cs);
+ kfree(cs->cs_buf);
+ kfree(cs);
return rc;
}
@@ -1657,7 +1656,7 @@ static int mdc_ioc_changelog_send(struct obd_device *obd,
int rc;
/* Freed in mdc_changelog_send_thread */
- OBD_ALLOC_PTR(cs);
+ cs = kzalloc(sizeof(*cs), GFP_NOFS);
if (!cs)
return -ENOMEM;
@@ -1679,7 +1678,7 @@ static int mdc_ioc_changelog_send(struct obd_device *obd,
}
CERROR("Failed to start changelog thread: %d\n", rc);
- OBD_FREE_PTR(cs);
+ kfree(cs);
return rc;
}
@@ -1819,10 +1818,7 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp,
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
- if (rc)
- goto out;
-out:
ptlrpc_req_finished(req);
return rc;
}
@@ -1937,7 +1933,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
struct if_quotactl *qctl = karg;
struct obd_quotactl *oqctl;
- OBD_ALLOC_PTR(oqctl);
+ oqctl = kzalloc(sizeof(*oqctl), GFP_NOFS);
if (oqctl == NULL) {
rc = -ENOMEM;
goto out;
@@ -1951,7 +1947,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
qctl->obd_uuid = obd->u.cli.cl_target_uuid;
}
- OBD_FREE_PTR(oqctl);
+ kfree(oqctl);
goto out;
}
case LL_IOC_GET_CONNECT_FLAGS:
@@ -2094,7 +2090,6 @@ static int mdc_hsm_copytool_send(int len, void *val)
{
struct kuc_hdr *lh = (struct kuc_hdr *)val;
struct hsm_action_list *hal = (struct hsm_action_list *)(lh + 1);
- int rc;
if (len < sizeof(*lh) + sizeof(*hal)) {
CERROR("Short HSM message %d < %d\n", len,
@@ -2115,9 +2110,7 @@ static int mdc_hsm_copytool_send(int len, void *val)
lh->kuc_msglen, hal->hal_count, hal->hal_fsname);
/* Broadcast to HSM listeners */
- rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh);
-
- return rc;
+ return libcfs_kkuc_group_put(KUC_GRP_HSM, lh);
}
/**
@@ -2430,14 +2423,14 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
struct lprocfs_static_vars lvars = { NULL };
int rc;
- OBD_ALLOC(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
+ cli->cl_rpc_lock = kzalloc(sizeof(*cli->cl_rpc_lock), GFP_NOFS);
if (!cli->cl_rpc_lock)
return -ENOMEM;
mdc_init_rpc_lock(cli->cl_rpc_lock);
ptlrpcd_addref();
- OBD_ALLOC(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
+ cli->cl_close_lock = kzalloc(sizeof(*cli->cl_close_lock), GFP_NOFS);
if (!cli->cl_close_lock) {
rc = -ENOMEM;
goto err_rpc_lock;
@@ -2448,7 +2441,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
if (rc)
goto err_close_lock;
lprocfs_mdc_init_vars(&lvars);
- lprocfs_obd_setup(obd, lvars.obd_vars);
+ lprocfs_obd_setup(obd, lvars.obd_vars, lvars.sysfs_vars);
sptlrpc_lprocfs_cliobd_attach(obd);
ptlrpc_lprocfs_register_obd(obd);
@@ -2465,9 +2458,9 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
return rc;
err_close_lock:
- OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
+ kfree(cli->cl_close_lock);
err_rpc_lock:
- OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
+ kfree(cli->cl_rpc_lock);
ptlrpcd_decref();
return rc;
}
@@ -2525,8 +2518,8 @@ static int mdc_cleanup(struct obd_device *obd)
{
struct client_obd *cli = &obd->u.cli;
- OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
- OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
+ kfree(cli->cl_rpc_lock);
+ kfree(cli->cl_close_lock);
ptlrpcd_decref();
@@ -2714,7 +2707,7 @@ static int __init mdc_init(void)
lprocfs_mdc_init_vars(&lvars);
- return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
+ return class_register_type(&mdc_obd_ops, &mdc_md_ops,
LUSTRE_MDC_NAME, NULL);
}