Commit 33db686a authored by Shivani Bhardwaj's avatar Shivani Bhardwaj Committed by Greg Kroah-Hartman

Staging: lustre: console: Drop unnecessary wrapper function

Remove the function lstcon_group_put() and replace all its calls with the
function lstcon_group_decref() because the former function just
performs the job of calling the latter.
Signed-off-by: default avatarShivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e5b6b5d4
...@@ -277,12 +277,6 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp) ...@@ -277,12 +277,6 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp)
return -ENOENT; return -ENOENT;
} }
static void
lstcon_group_put(lstcon_group_t *grp)
{
lstcon_group_decref(grp);
}
static int static int
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create) lstcon_ndlink_t **ndlpp, int create)
...@@ -436,7 +430,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, ...@@ -436,7 +430,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
} }
if (rc != 0) { if (rc != 0) {
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
} }
...@@ -445,7 +439,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, ...@@ -445,7 +439,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
tmp, lstcon_sesrpc_condition, &trans); tmp, lstcon_sesrpc_condition, &trans);
if (rc != 0) { if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc); CERROR("Can't create transaction: %d\n", rc);
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
} }
...@@ -460,7 +454,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, ...@@ -460,7 +454,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
lstcon_rpc_trans_destroy(trans); lstcon_rpc_trans_destroy(trans);
lstcon_group_move(tmp, grp); lstcon_group_move(tmp, grp);
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
} }
...@@ -510,12 +504,12 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, ...@@ -510,12 +504,12 @@ lstcon_group_nodes_remove(lstcon_group_t *grp,
lstcon_rpc_trans_destroy(trans); lstcon_rpc_trans_destroy(trans);
/* release nodes anyway, because we can't rollback status */ /* release nodes anyway, because we can't rollback status */
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
error: error:
lstcon_group_move(tmp, grp); lstcon_group_move(tmp, grp);
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
} }
...@@ -529,7 +523,7 @@ lstcon_group_add(char *name) ...@@ -529,7 +523,7 @@ lstcon_group_add(char *name)
rc = (lstcon_group_find(name, &grp) == 0) ? -EEXIST : 0; rc = (lstcon_group_find(name, &grp) == 0) ? -EEXIST : 0;
if (rc != 0) { if (rc != 0) {
/* find a group with same name */ /* find a group with same name */
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -563,14 +557,14 @@ lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up, ...@@ -563,14 +557,14 @@ lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up,
if (grp->grp_ref > 2) { if (grp->grp_ref > 2) {
/* referred by other threads or test */ /* referred by other threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name); CDEBUG(D_NET, "Group %s is busy\n", name);
lstcon_group_put(grp); lstcon_group_decref(grp);
return -EBUSY; return -EBUSY;
} }
rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up); rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -591,7 +585,7 @@ lstcon_group_del(char *name) ...@@ -591,7 +585,7 @@ lstcon_group_del(char *name)
if (grp->grp_ref > 2) { if (grp->grp_ref > 2) {
/* referred by others threads or test */ /* referred by others threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name); CDEBUG(D_NET, "Group %s is busy\n", name);
lstcon_group_put(grp); lstcon_group_decref(grp);
return -EBUSY; return -EBUSY;
} }
...@@ -600,7 +594,7 @@ lstcon_group_del(char *name) ...@@ -600,7 +594,7 @@ lstcon_group_del(char *name)
grp, lstcon_sesrpc_condition, &trans); grp, lstcon_sesrpc_condition, &trans);
if (rc != 0) { if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc); CERROR("Can't create transaction: %d\n", rc);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -608,10 +602,10 @@ lstcon_group_del(char *name) ...@@ -608,10 +602,10 @@ lstcon_group_del(char *name)
lstcon_rpc_trans_destroy(trans); lstcon_rpc_trans_destroy(trans);
lstcon_group_put(grp); lstcon_group_decref(grp);
/* -ref for session, it's destroyed, /* -ref for session, it's destroyed,
* status can't be rolled back, destroy group anyway */ * status can't be rolled back, destroy group anyway */
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -631,7 +625,7 @@ lstcon_group_clean(char *name, int args) ...@@ -631,7 +625,7 @@ lstcon_group_clean(char *name, int args)
if (grp->grp_ref > 2) { if (grp->grp_ref > 2) {
/* referred by test */ /* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name); CDEBUG(D_NET, "Group %s is busy\n", name);
lstcon_group_put(grp); lstcon_group_decref(grp);
return -EBUSY; return -EBUSY;
} }
...@@ -640,10 +634,10 @@ lstcon_group_clean(char *name, int args) ...@@ -640,10 +634,10 @@ lstcon_group_clean(char *name, int args)
lstcon_group_drain(grp, args); lstcon_group_drain(grp, args);
lstcon_group_put(grp); lstcon_group_decref(grp);
/* release empty group */ /* release empty group */
if (list_empty(&grp->grp_ndl_list)) if (list_empty(&grp->grp_ndl_list))
lstcon_group_put(grp); lstcon_group_decref(grp);
return 0; return 0;
} }
...@@ -664,16 +658,16 @@ lstcon_nodes_remove(char *name, int count, ...@@ -664,16 +658,16 @@ lstcon_nodes_remove(char *name, int count,
if (grp->grp_ref > 2) { if (grp->grp_ref > 2) {
/* referred by test */ /* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name); CDEBUG(D_NET, "Group %s is busy\n", name);
lstcon_group_put(grp); lstcon_group_decref(grp);
return -EBUSY; return -EBUSY;
} }
rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up); rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up);
lstcon_group_put(grp); lstcon_group_decref(grp);
/* release empty group */ /* release empty group */
if (list_empty(&grp->grp_ndl_list)) if (list_empty(&grp->grp_ndl_list))
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -694,7 +688,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up) ...@@ -694,7 +688,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up)
if (grp->grp_ref > 2) { if (grp->grp_ref > 2) {
/* referred by test */ /* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name); CDEBUG(D_NET, "Group %s is busy\n", name);
lstcon_group_put(grp); lstcon_group_decref(grp);
return -EBUSY; return -EBUSY;
} }
...@@ -705,7 +699,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up) ...@@ -705,7 +699,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up)
if (rc != 0) { if (rc != 0) {
/* local error, return */ /* local error, return */
CDEBUG(D_NET, "Can't create transaction: %d\n", rc); CDEBUG(D_NET, "Can't create transaction: %d\n", rc);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -715,7 +709,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up) ...@@ -715,7 +709,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up)
lstcon_rpc_trans_destroy(trans); lstcon_rpc_trans_destroy(trans);
/* -ref for me */ /* -ref for me */
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -797,7 +791,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, ...@@ -797,7 +791,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
/* verbose query */ /* verbose query */
rc = lstcon_nodes_getent(&grp->grp_ndl_list, rc = lstcon_nodes_getent(&grp->grp_ndl_list,
index_p, count_p, dents_up); index_p, count_p, dents_up);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -806,7 +800,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, ...@@ -806,7 +800,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t)); LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t));
if (gentp == NULL) { if (gentp == NULL) {
CERROR("Can't allocate ndlist_ent\n"); CERROR("Can't allocate ndlist_ent\n");
lstcon_group_put(grp); lstcon_group_decref(grp);
return -ENOMEM; return -ENOMEM;
} }
...@@ -819,7 +813,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, ...@@ -819,7 +813,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t)); LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t));
lstcon_group_put(grp); lstcon_group_decref(grp);
return 0; return 0;
} }
...@@ -1096,8 +1090,8 @@ lstcon_batch_destroy(lstcon_batch_t *bat) ...@@ -1096,8 +1090,8 @@ lstcon_batch_destroy(lstcon_batch_t *bat)
list_del(&test->tes_link); list_del(&test->tes_link);
lstcon_group_put(test->tes_src_grp); lstcon_group_decref(test->tes_src_grp);
lstcon_group_put(test->tes_dst_grp); lstcon_group_decref(test->tes_dst_grp);
LIBCFS_FREE(test, offsetof(lstcon_test_t, LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen])); tes_param[test->tes_paramlen]));
...@@ -1352,10 +1346,10 @@ lstcon_test_add(char *batch_name, int type, int loop, ...@@ -1352,10 +1346,10 @@ lstcon_test_add(char *batch_name, int type, int loop,
LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen])); LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
if (dst_grp != NULL) if (dst_grp != NULL)
lstcon_group_put(dst_grp); lstcon_group_decref(dst_grp);
if (src_grp != NULL) if (src_grp != NULL)
lstcon_group_put(src_grp); lstcon_group_decref(src_grp);
return rc; return rc;
} }
...@@ -1518,7 +1512,7 @@ lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up) ...@@ -1518,7 +1512,7 @@ lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up)
rc = lstcon_ndlist_stat(&grp->grp_ndl_list, timeout, result_up); rc = lstcon_ndlist_stat(&grp->grp_ndl_list, timeout, result_up);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -1556,13 +1550,13 @@ lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, ...@@ -1556,13 +1550,13 @@ lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
} }
if (rc != 0) { if (rc != 0) {
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
} }
rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up); rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up);
lstcon_group_put(tmp); lstcon_group_decref(tmp);
return rc; return rc;
} }
...@@ -1629,7 +1623,7 @@ lstcon_group_debug(int timeout, char *name, ...@@ -1629,7 +1623,7 @@ lstcon_group_debug(int timeout, char *name,
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL, rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up); timeout, result_up);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -1666,14 +1660,14 @@ lstcon_nodes_debug(int timeout, ...@@ -1666,14 +1660,14 @@ lstcon_nodes_debug(int timeout,
} }
if (rc != 0) { if (rc != 0) {
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL, rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up); timeout, result_up);
lstcon_group_put(grp); lstcon_group_decref(grp);
return rc; return rc;
} }
...@@ -1847,7 +1841,7 @@ lstcon_session_end(void) ...@@ -1847,7 +1841,7 @@ lstcon_session_end(void)
lstcon_group_t, grp_link); lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1); LASSERT(grp->grp_ref == 1);
lstcon_group_put(grp); lstcon_group_decref(grp);
} }
/* all nodes should be released */ /* all nodes should be released */
...@@ -1966,7 +1960,7 @@ lstcon_acceptor_handle(srpc_server_rpc_t *rpc) ...@@ -1966,7 +1960,7 @@ lstcon_acceptor_handle(srpc_server_rpc_t *rpc)
out: out:
rep->msg_ses_feats = console_session.ses_features; rep->msg_ses_feats = console_session.ses_features;
if (grp != NULL) if (grp != NULL)
lstcon_group_put(grp); lstcon_group_decref(grp);
mutex_unlock(&console_session.ses_mutex); mutex_unlock(&console_session.ses_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment