Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-8056 llite: use inode_lock to access i_mutex
[fs/lustre-release.git]
/
lnet
/
selftest
/
console.c
diff --git
a/lnet/selftest/console.c
b/lnet/selftest/console.c
index
0be173d
..
f951c17
100644
(file)
--- a/
lnet/selftest/console.c
+++ b/
lnet/selftest/console.c
@@
-40,7
+40,6
@@
* Author: Liang Zhen <liangzhen@clusterfs.com>
*/
* Author: Liang Zhen <liangzhen@clusterfs.com>
*/
-#ifdef __KERNEL__
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
@@
-62,7
+61,7
@@
do { \
lstcon_session_t console_session;
lstcon_session_t console_session;
-void
+
static
void
lstcon_node_get(lstcon_node_t *nd)
{
LASSERT (nd->nd_ref >= 1);
lstcon_node_get(lstcon_node_t *nd)
{
LASSERT (nd->nd_ref >= 1);
@@
-116,7
+115,7
@@
lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
return 0;
}
return 0;
}
-void
+
static
void
lstcon_node_put(lstcon_node_t *nd)
{
lstcon_ndlink_t *ndl;
lstcon_node_put(lstcon_node_t *nd)
{
lstcon_ndlink_t *ndl;
@@
-206,9
+205,6
@@
lstcon_group_alloc(char *name, lstcon_group_t **grpp)
if (grp == NULL)
return -ENOMEM;
if (grp == NULL)
return -ENOMEM;
- memset(grp, 0, offsetof(lstcon_group_t,
- grp_ndl_hash[LST_NODE_HASHSIZE]));
-
grp->grp_ref = 1;
if (name != NULL) {
if (strlen(name) > sizeof(grp->grp_name)-1) {
grp->grp_ref = 1;
if (name != NULL) {
if (strlen(name) > sizeof(grp->grp_name)-1) {
@@
-288,12
+284,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
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create)
static int
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create)
@@
-351,7
+341,7
@@
lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new)
}
}
}
}
-int
+
static
int
lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_group_t *grp = (lstcon_group_t *)arg;
lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_group_t *grp = (lstcon_group_t *)arg;
@@
-380,7
+370,7
@@
lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
return 1;
}
return 1;
}
-int
+
static
int
lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t __user *ent_up)
{
lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t __user *ent_up)
{
@@
-447,7
+437,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;
}
@@
-456,7
+446,7
@@
lstcon_group_nodes_add(lstcon_group_t *grp,
tmp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
tmp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
@@
-471,7
+461,7
@@
lstcon_group_nodes_add(lstcon_group_t *grp,
lstcon_rpc_trans_destroy(trans);
lstcon_group_move(tmp, grp);
lstcon_rpc_trans_destroy(trans);
lstcon_group_move(tmp, grp);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
@@
-521,12
+511,12
@@
lstcon_group_nodes_remove(lstcon_group_t *grp,
lstcon_rpc_trans_destroy(trans);
/* release nodes anyway, because we can't rollback status */
lstcon_rpc_trans_destroy(trans);
/* release nodes anyway, because we can't rollback status */
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
error:
lstcon_group_move(tmp, grp);
return rc;
error:
lstcon_group_move(tmp, grp);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
@@
-540,7
+530,7
@@
lstcon_group_add(char *name)
rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0;
if (rc != 0) {
/* find a group with same name */
rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0;
if (rc != 0) {
/* find a group with same name */
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-574,14
+564,14
@@
lstcon_nodes_add(char *name, int count, lnet_process_id_t __user *ids_up,
if (grp->grp_ref > 2) {
/* referred by other threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by other threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
return -EBUSY;
}
rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-602,7
+592,7
@@
lstcon_group_del(char *name)
if (grp->grp_ref > 2) {
/* referred by others threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by others threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
return -EBUSY;
}
@@
-611,7
+601,7
@@
lstcon_group_del(char *name)
grp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
grp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-619,10
+609,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,
* status can't be rolled back, destroy group anway */
/* -ref for session, it's destroyed,
* status can't be rolled back, destroy group anway */
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-642,7
+632,7
@@
lstcon_group_clean(char *name, int args)
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
return -EBUSY;
}
@@
-651,10
+641,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 */
if (list_empty(&grp->grp_ndl_list))
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
return 0;
}
return 0;
}
@@
-676,16
+666,16
@@
lstcon_nodes_remove(char *name, int count,
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up);
return -EBUSY;
}
rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up);
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
return rc;
}
return rc;
}
@@
-706,7
+696,7
@@
lstcon_group_refresh(char *name, struct list_head __user *result_up)
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
return -EBUSY;
}
@@
-717,7
+707,7
@@
lstcon_group_refresh(char *name, struct list_head __user *result_up)
if (rc != 0) {
/* local error, return */
CDEBUG(D_NET, "Can't create transaction: %d\n", rc);
if (rc != 0) {
/* local error, return */
CDEBUG(D_NET, "Can't create transaction: %d\n", rc);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-727,7
+717,7
@@
lstcon_group_refresh(char *name, struct list_head __user *result_up)
lstcon_rpc_trans_destroy(trans);
/* -ref for me */
lstcon_rpc_trans_destroy(trans);
/* -ref for me */
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-806,11
+796,11
@@
lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p,
return rc;
}
return rc;
}
-
if (dents_up != 0
) {
+
if (dents_up != NULL
) {
/* verbose query */
rc = lstcon_nodes_getent(&grp->grp_ndl_list,
index_p, count_p, dents_up);
/* verbose query */
rc = lstcon_nodes_getent(&grp->grp_ndl_list,
index_p, count_p, dents_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-819,13
+809,11
@@
lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p,
LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t));
if (gentp == NULL) {
CERROR("Can't allocate ndlist_ent\n");
LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t));
if (gentp == NULL) {
CERROR("Can't allocate ndlist_ent\n");
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -ENOMEM;
}
return -ENOMEM;
}
- memset(gentp, 0, sizeof(lstcon_ndlist_ent_t));
-
list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
@@
-834,7
+822,7
@@
lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *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;
}
@@
-986,8
+974,6
@@
lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up,
if (entp == NULL)
return -ENOMEM;
if (entp == NULL)
return -ENOMEM;
- memset(entp, 0, sizeof(lstcon_test_batch_ent_t));
-
if (test == NULL) {
entp->u.tbe_batch.bae_ntest = bat->bat_ntest;
entp->u.tbe_batch.bae_state = bat->bat_state;
if (test == NULL) {
entp->u.tbe_batch.bae_ntest = bat->bat_ntest;
entp->u.tbe_batch.bae_state = bat->bat_state;
@@
-1013,7
+999,7
@@
lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up,
return rc;
}
return rc;
}
-int
+
static
int
lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
switch (transop) {
lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
switch (transop) {
@@
-1119,8
+1105,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_
put
(test->tes_dst_grp);
+ lstcon_group_
decref
(test->tes_src_grp);
+ lstcon_group_
decref
(test->tes_dst_grp);
LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen]));
LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen]));
@@
-1156,7
+1142,7
@@
lstcon_batch_destroy(lstcon_batch_t *bat)
LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
}
LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
}
-int
+
static
int
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_test_t *test;
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_test_t *test;
@@
-1335,7
+1321,6
@@
lstcon_test_add(char *batch_name, int type, int loop,
goto out;
}
goto out;
}
- memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen]));
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
test->tes_batch = batch;
test->tes_type = type;
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
test->tes_batch = batch;
test->tes_type = type;
@@
-1378,15
+1363,15
@@
out:
LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
if (dst_grp != NULL)
LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
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;
}
-int
+
static
int
lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
{
lstcon_test_t *test;
lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
{
lstcon_test_t *test;
@@
-1401,7
+1386,7
@@
lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
return -ENOENT;
}
return -ENOENT;
}
-int
+
static
int
lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t __user *ent_up)
{
lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t __user *ent_up)
{
@@
-1480,7
+1465,7
@@
lstcon_test_batch_query(char *name, int testidx, int client,
return rc;
}
return rc;
}
-int
+
static
int
lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t __user *ent_up)
{
lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t __user *ent_up)
{
@@
-1506,7
+1491,7
@@
lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
return 0;
}
return 0;
}
-int
+
static
int
lstcon_ndlist_stat(struct list_head *ndlist,
int timeout, struct list_head __user *result_up)
{
lstcon_ndlist_stat(struct list_head *ndlist,
int timeout, struct list_head __user *result_up)
{
@@
-1547,7
+1532,7
@@
lstcon_group_stat(char *grp_name, int timeout,
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;
}
@@
-1585,18
+1570,18
@@
lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up,
}
if (rc != 0) {
}
if (rc != 0) {
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up);
return rc;
}
rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
-int
+
static
int
lstcon_debug_ndlist(struct list_head *ndlist,
struct list_head *translist,
int timeout, struct list_head __user *result_up)
lstcon_debug_ndlist(struct list_head *ndlist,
struct list_head *translist,
int timeout, struct list_head __user *result_up)
@@
-1658,7
+1643,7
@@
lstcon_group_debug(int timeout, char *name,
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-1695,14
+1680,14
@@
lstcon_nodes_debug(int timeout,
}
if (rc != 0) {
}
if (rc != 0) {
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
return rc;
}
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-1726,8
+1711,6
@@
lstcon_new_session_id(lst_sid_t *sid)
sid->ses_stamp = cfs_time_current();
}
sid->ses_stamp = cfs_time_current();
}
-extern srpc_service_t lstcon_acceptor_service;
-
int
lstcon_session_new(char *name, int key, unsigned feats,
int timeout, int force, lst_sid_t __user *sid_up)
int
lstcon_session_new(char *name, int key, unsigned feats,
int timeout, int force, lst_sid_t __user *sid_up)
@@
-1814,8
+1797,6
@@
lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up,
if (entp == NULL)
return -ENOMEM;
if (entp == NULL)
return -ENOMEM;
- memset(entp, 0, sizeof(*entp));
-
list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
@@
-1884,7
+1865,7
@@
lstcon_session_end()
lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1);
lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1);
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
}
/* all nodes should be released */
}
/* all nodes should be released */
@@
-2005,15
+1986,15
@@
lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
out:
rep->msg_ses_feats = console_session.ses_features;
if (grp != NULL)
out:
rep->msg_ses_feats = console_session.ses_features;
if (grp != NULL)
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
mutex_unlock(&console_session.ses_mutex);
return rc;
}
mutex_unlock(&console_session.ses_mutex);
return rc;
}
-srpc_service_t lstcon_acceptor_service;
-void lstcon_init_acceptor_service(void)
+s
tatic s
rpc_service_t lstcon_acceptor_service;
+
static
void lstcon_init_acceptor_service(void)
{
/* initialize selftest console acceptor service table */
lstcon_acceptor_service.sv_name = "join session";
{
/* initialize selftest console acceptor service table */
lstcon_acceptor_service.sv_name = "join session";
@@
-2132,4
+2113,3
@@
lstcon_console_fini(void)
return 0;
}
return 0;
}
-#endif