aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm/ldlm_lib.c')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_lib.c95
1 files changed, 31 insertions, 64 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 3c8d4413d976..b586d5a88d00 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -219,7 +219,8 @@ EXPORT_SYMBOL(client_import_find_conn);
void client_destroy_import(struct obd_import *imp)
{
/* Drop security policy instance after all RPCs have finished/aborted
- * to let all busy contexts be released. */
+ * to let all busy contexts be released.
+ */
class_import_get(imp);
class_destroy_import(imp);
sptlrpc_import_sec_put(imp);
@@ -227,29 +228,6 @@ void client_destroy_import(struct obd_import *imp)
}
EXPORT_SYMBOL(client_destroy_import);
-/**
- * Check whether or not the OSC is on MDT.
- * In the config log,
- * osc on MDT
- * setup 0:{fsname}-OSTxxxx-osc[-MDTxxxx] 1:lustre-OST0000_UUID 2:NID
- * osc on client
- * setup 0:{fsname}-OSTxxxx-osc 1:lustre-OST0000_UUID 2:NID
- *
- **/
-static int osc_on_mdt(char *obdname)
-{
- char *ptr;
-
- ptr = strrchr(obdname, '-');
- if (ptr == NULL)
- return 0;
-
- if (strncmp(ptr + 1, "MDT", 3) == 0)
- return 1;
-
- return 0;
-}
-
/* Configure an RPC client OBD device.
*
* lcfg parameters:
@@ -264,11 +242,12 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
struct obd_uuid server_uuid;
int rq_portal, rp_portal, connect_op;
char *name = obddev->obd_type->typ_name;
- ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN;
+ enum ldlm_ns_type ns_type = LDLM_NS_TYPE_UNKNOWN;
int rc;
/* In a more perfect world, we would hang a ptlrpc_client off of
- * obd_type and just use the values from there. */
+ * obd_type and just use the values from there.
+ */
if (!strcmp(name, LUSTRE_OSC_NAME)) {
rq_portal = OST_REQUEST_PORTAL;
rp_portal = OSC_REPLY_PORTAL;
@@ -284,22 +263,6 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
cli->cl_sp_me = LUSTRE_SP_CLI;
cli->cl_sp_to = LUSTRE_SP_MDT;
ns_type = LDLM_NS_TYPE_MDC;
- } else if (!strcmp(name, LUSTRE_OSP_NAME)) {
- if (strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL) {
- /* OSP_on_MDT for other MDTs */
- connect_op = MDS_CONNECT;
- cli->cl_sp_to = LUSTRE_SP_MDT;
- ns_type = LDLM_NS_TYPE_MDC;
- rq_portal = OUT_PORTAL;
- } else {
- /* OSP on MDT for OST */
- connect_op = OST_CONNECT;
- cli->cl_sp_to = LUSTRE_SP_OST;
- ns_type = LDLM_NS_TYPE_OSC;
- rq_portal = OST_REQUEST_PORTAL;
- }
- rp_portal = OSC_REPLY_PORTAL;
- cli->cl_sp_me = LUSTRE_SP_CLI;
} else if (!strcmp(name, LUSTRE_MGC_NAME)) {
rq_portal = MGS_REQUEST_PORTAL;
rp_portal = MGC_REPLY_PORTAL;
@@ -387,7 +350,8 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
/* This value may be reduced at connect time in
* ptlrpc_connect_interpret() . We initialize it to only
* 1MB until we know what the performance looks like.
- * In the future this should likely be increased. LU-1431 */
+ * In the future this should likely be increased. LU-1431
+ */
cli->cl_max_pages_per_rpc = min_t(int, PTLRPC_MAX_BRW_PAGES,
LNET_MTU >> PAGE_CACHE_SHIFT);
@@ -400,10 +364,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 512 /* MB */) {
cli->cl_max_rpcs_in_flight = 4;
} else {
- if (osc_on_mdt(obddev->obd_name))
- cli->cl_max_rpcs_in_flight = MDS_OSC_MAX_RIF_DEFAULT;
- else
- cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT;
+ cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT;
}
rc = ldlm_get_ref();
if (rc) {
@@ -415,7 +376,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
&obddev->obd_ldlm_client);
imp = class_new_import(obddev);
- if (imp == NULL) {
+ if (!imp) {
rc = -ENOENT;
goto err_ldlm;
}
@@ -451,7 +412,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
LDLM_NAMESPACE_CLIENT,
LDLM_NAMESPACE_GREEDY,
ns_type);
- if (obddev->obd_namespace == NULL) {
+ if (!obddev->obd_namespace) {
CERROR("Unable to create client namespace - %s\n",
obddev->obd_name);
rc = -ENOMEM;
@@ -477,7 +438,7 @@ int client_obd_cleanup(struct obd_device *obddev)
ldlm_namespace_free_post(obddev->obd_namespace);
obddev->obd_namespace = NULL;
- LASSERT(obddev->u.cli.cl_import == NULL);
+ LASSERT(!obddev->u.cli.cl_import);
ldlm_put_ref();
return 0;
@@ -528,7 +489,7 @@ int client_connect_import(const struct lu_env *env,
LASSERT(imp->imp_state == LUSTRE_IMP_DISCON);
goto out_ldlm;
}
- LASSERT(*exp != NULL && (*exp)->exp_connection);
+ LASSERT(*exp && (*exp)->exp_connection);
if (data) {
LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) ==
@@ -587,17 +548,19 @@ int client_disconnect_export(struct obd_export *exp)
/* Mark import deactivated now, so we don't try to reconnect if any
* of the cleanup RPCs fails (e.g. LDLM cancel, etc). We don't
- * fully deactivate the import, or that would drop all requests. */
+ * fully deactivate the import, or that would drop all requests.
+ */
spin_lock(&imp->imp_lock);
imp->imp_deactive = 1;
spin_unlock(&imp->imp_lock);
/* Some non-replayable imports (MDS's OSCs) are pinged, so just
* delete it regardless. (It's safe to delete an import that was
- * never added.) */
+ * never added.)
+ */
(void)ptlrpc_pinger_del_import(imp);
- if (obd->obd_namespace != NULL) {
+ if (obd->obd_namespace) {
/* obd_force == local only */
ldlm_cli_cancel_unused(obd->obd_namespace, NULL,
obd->obd_force ? LCF_LOCAL : 0, NULL);
@@ -606,7 +569,8 @@ int client_disconnect_export(struct obd_export *exp)
}
/* There's no need to hold sem while disconnecting an import,
- * and it may actually cause deadlock in GSS. */
+ * and it may actually cause deadlock in GSS.
+ */
up_write(&cli->cl_sem);
rc = ptlrpc_disconnect_import(imp, 0);
down_write(&cli->cl_sem);
@@ -615,7 +579,8 @@ int client_disconnect_export(struct obd_export *exp)
out_disconnect:
/* Use server style - class_disconnect should be always called for
- * o_disconnect. */
+ * o_disconnect.
+ */
err = class_disconnect(exp);
if (!rc && err)
rc = err;
@@ -634,7 +599,8 @@ int target_pack_pool_reply(struct ptlrpc_request *req)
struct obd_device *obd;
/* Check that we still have all structures alive as this may
- * be some late RPC at shutdown time. */
+ * be some late RPC at shutdown time.
+ */
if (unlikely(!req->rq_export || !req->rq_export->exp_obd ||
!exp_connect_lru_resize(req->rq_export))) {
lustre_msg_set_slv(req->rq_repmsg, 0);
@@ -684,14 +650,14 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
svcpt = req->rq_rqbd->rqbd_svcpt;
rs = req->rq_reply_state;
- if (rs == NULL || !rs->rs_difficult) {
+ if (!rs || !rs->rs_difficult) {
/* no notifiers */
target_send_reply_msg(req, rc, fail_id);
return;
}
/* must be an export if locks saved */
- LASSERT(req->rq_export != NULL);
+ LASSERT(req->rq_export);
/* req/reply consistent */
LASSERT(rs->rs_svcpt == svcpt);
@@ -700,7 +666,7 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
LASSERT(!rs->rs_scheduled_ever);
LASSERT(!rs->rs_handled);
LASSERT(!rs->rs_on_net);
- LASSERT(rs->rs_export == NULL);
+ LASSERT(!rs->rs_export);
LASSERT(list_empty(&rs->rs_obd_list));
LASSERT(list_empty(&rs->rs_exp_list));
@@ -739,7 +705,8 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
* reply ref until ptlrpc_handle_rs() is done
* with the reply state (if the send was successful, there
* would have been +1 ref for the net, which
- * reply_out_callback leaves alone) */
+ * reply_out_callback leaves alone)
+ */
rs->rs_on_net = 0;
ptlrpc_rs_addref(rs);
}
@@ -760,7 +727,7 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
}
EXPORT_SYMBOL(target_send_reply);
-ldlm_mode_t lck_compat_array[] = {
+enum ldlm_mode lck_compat_array[] = {
[LCK_EX] = LCK_COMPAT_EX,
[LCK_PW] = LCK_COMPAT_PW,
[LCK_PR] = LCK_COMPAT_PR,
@@ -775,7 +742,7 @@ ldlm_mode_t lck_compat_array[] = {
* Rather arbitrary mapping from LDLM error codes to errno values. This should
* not escape to the user level.
*/
-int ldlm_error2errno(ldlm_error_t error)
+int ldlm_error2errno(enum ldlm_error error)
{
int result;
@@ -803,7 +770,7 @@ int ldlm_error2errno(ldlm_error_t error)
break;
default:
if (((int)error) < 0) /* cast to signed type */
- result = error; /* as ldlm_error_t can be unsigned */
+ result = error; /* as enum ldlm_error can be unsigned */
else {
CERROR("Invalid DLM result code: %d\n", error);
result = -EPROTO;