Commit 7e7ab095 authored by Mike Shuey's avatar Mike Shuey Committed by Greg Kroah-Hartman

staging: lustre: lnet: lnet: code cleanups - variable declarations

Unify variable declarations to use a single space, and any other obvious
spacing flaws.
Signed-off-by: default avatarMike Shuey <shuey@purdue.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4f445e63
......@@ -143,10 +143,10 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
__u32 local_ip, __u32 peer_ip, int peer_port)
{
lnet_acceptor_connreq_t cr;
struct socket *sock;
int rc;
int port;
int fatal;
struct socket *sock;
int rc;
int port;
int fatal;
CLASSERT(sizeof(cr) <= 16); /* not too big to be on the stack */
......@@ -211,12 +211,12 @@ static int
lnet_accept(struct socket *sock, __u32 magic)
{
lnet_acceptor_connreq_t cr;
__u32 peer_ip;
int peer_port;
int rc;
int flip;
lnet_ni_t *ni;
char *str;
__u32 peer_ip;
int peer_port;
int rc;
int flip;
lnet_ni_t *ni;
char *str;
LASSERT(sizeof(cr) <= 16); /* not too big for the stack */
......@@ -333,11 +333,11 @@ static int
lnet_acceptor(void *arg)
{
struct socket *newsock;
int rc;
__u32 magic;
__u32 peer_ip;
int peer_port;
int secure = (int)((long_ptr_t)arg);
int rc;
__u32 magic;
__u32 peer_ip;
int peer_port;
int secure = (int)((long_ptr_t)arg);
LASSERT(lnet_acceptor_state.pta_sock == NULL);
......@@ -444,7 +444,7 @@ accept2secure(const char *acc, long *sec)
int
lnet_acceptor_start(void)
{
int rc;
int rc;
long rc2;
long secure;
......
......@@ -41,7 +41,7 @@
#define D_LNI D_CONSOLE
lnet_t the_lnet; /* THE state of the network */
lnet_t the_lnet; /* THE state of the network */
EXPORT_SYMBOL(the_lnet);
......@@ -70,8 +70,8 @@ lnet_get_routes(void)
static char *
lnet_get_networks(void)
{
char *nets;
int rc;
char *nets;
int rc;
if (*networks != 0 && *ip2nets != 0) {
LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or 'ip2nets' but not both at once\n");
......@@ -107,8 +107,8 @@ lnet_fini_locks(void)
static int
lnet_create_remote_nets_table(void)
{
int i;
struct list_head *hash;
int i;
struct list_head *hash;
LASSERT(the_lnet.ln_remote_nets_hash == NULL);
LASSERT(the_lnet.ln_remote_nets_hbits > 0);
......@@ -273,8 +273,8 @@ static void lnet_assert_wire_constants(void)
static lnd_t *
lnet_find_lnd_by_type(int type)
{
lnd_t *lnd;
struct list_head *tmp;
lnd_t *lnd;
struct list_head *tmp;
/* holding lnd mutex */
list_for_each(tmp, &the_lnet.ln_lnds) {
......@@ -325,7 +325,7 @@ void
lnet_counters_get(lnet_counters_t *counters)
{
lnet_counters_t *ctr;
int i;
int i;
memset(counters, 0, sizeof(*counters));
......@@ -353,7 +353,7 @@ void
lnet_counters_reset(void)
{
lnet_counters_t *counters;
int i;
int i;
lnet_net_lock(LNET_LOCK_EX);
......@@ -396,8 +396,8 @@ lnet_freelist_init(lnet_freelist_t *fl, int n, int size)
void
lnet_freelist_fini(lnet_freelist_t *fl)
{
struct list_head *el;
int count;
struct list_head *el;
int count;
if (fl->fl_nobjs == 0)
return;
......@@ -441,7 +441,7 @@ lnet_res_type2str(int type)
static void
lnet_res_container_cleanup(struct lnet_res_container *rec)
{
int count = 0;
int count = 0;
if (rec->rec_type == 0) /* not set yet, it's uninitialized */
return;
......@@ -486,8 +486,8 @@ static int
lnet_res_container_setup(struct lnet_res_container *rec,
int cpt, int type, int objnum, int objsz)
{
int rc = 0;
int i;
int rc = 0;
int i;
LASSERT(rec->rec_type == 0);
......@@ -525,8 +525,8 @@ lnet_res_container_setup(struct lnet_res_container *rec,
static void
lnet_res_containers_destroy(struct lnet_res_container **recs)
{
struct lnet_res_container *rec;
int i;
struct lnet_res_container *rec;
int i;
cfs_percpt_for_each(rec, i, recs)
lnet_res_container_cleanup(rec);
......@@ -537,10 +537,10 @@ lnet_res_containers_destroy(struct lnet_res_container **recs)
static struct lnet_res_container **
lnet_res_containers_create(int type, int objnum, int objsz)
{
struct lnet_res_container **recs;
struct lnet_res_container *rec;
int rc;
int i;
struct lnet_res_container **recs;
struct lnet_res_container *rec;
int rc;
int i;
recs = cfs_percpt_alloc(lnet_cpt_table(), sizeof(*rec));
if (recs == NULL) {
......@@ -564,9 +564,9 @@ lnet_libhandle_t *
lnet_res_lh_lookup(struct lnet_res_container *rec, __u64 cookie)
{
/* ALWAYS called with lnet_res_lock held */
struct list_head *head;
lnet_libhandle_t *lh;
unsigned int hash;
struct list_head *head;
lnet_libhandle_t *lh;
unsigned int hash;
if ((cookie & LNET_COOKIE_MASK) != rec->rec_type)
return NULL;
......@@ -586,8 +586,8 @@ void
lnet_res_lh_initialize(struct lnet_res_container *rec, lnet_libhandle_t *lh)
{
/* ALWAYS called with lnet_res_lock held */
unsigned int ibits = LNET_COOKIE_TYPE_BITS + LNET_CPT_BITS;
unsigned int hash;
unsigned int ibits = LNET_COOKIE_TYPE_BITS + LNET_CPT_BITS;
unsigned int hash;
lh->lh_cookie = rec->rec_lh_cookie;
rec->rec_lh_cookie += 1 << ibits;
......@@ -605,7 +605,7 @@ lnet_prepare(lnet_pid_t requested_pid)
{
/* Prepare to bring up the network */
struct lnet_res_container **recs;
int rc = 0;
int rc = 0;
LASSERT(the_lnet.ln_refcount == 0);
......@@ -725,8 +725,8 @@ lnet_unprepare(void)
lnet_ni_t *
lnet_net2ni_locked(__u32 net, int cpt)
{
struct list_head *tmp;
lnet_ni_t *ni;
struct list_head *tmp;
lnet_ni_t *ni;
LASSERT(cpt != LNET_LOCK_EX);
......@@ -758,8 +758,8 @@ EXPORT_SYMBOL(lnet_net2ni);
static unsigned int
lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number)
{
__u64 key = nid;
unsigned int val;
__u64 key = nid;
unsigned int val;
LASSERT(number >= 1 && number <= LNET_CPT_NUMBER);
......@@ -801,8 +801,8 @@ lnet_cpt_of_nid_locked(lnet_nid_t nid)
int
lnet_cpt_of_nid(lnet_nid_t nid)
{
int cpt;
int cpt2;
int cpt;
int cpt2;
if (LNET_CPT_NUMBER == 1)
return 0; /* the only one */
......@@ -821,8 +821,8 @@ EXPORT_SYMBOL(lnet_cpt_of_nid);
int
lnet_islocalnet(__u32 net)
{
struct lnet_ni *ni;
int cpt;
struct lnet_ni *ni;
int cpt;
cpt = lnet_net_lock_current();
......@@ -838,8 +838,8 @@ lnet_islocalnet(__u32 net)
lnet_ni_t *
lnet_nid2ni_locked(lnet_nid_t nid, int cpt)
{
struct lnet_ni *ni;
struct list_head *tmp;
struct lnet_ni *ni;
struct list_head *tmp;
LASSERT(cpt != LNET_LOCK_EX);
......@@ -858,8 +858,8 @@ lnet_nid2ni_locked(lnet_nid_t nid, int cpt)
int
lnet_islocalnid(lnet_nid_t nid)
{
struct lnet_ni *ni;
int cpt;
struct lnet_ni *ni;
int cpt;
cpt = lnet_net_lock_current();
ni = lnet_nid2ni_locked(nid, cpt);
......@@ -874,10 +874,10 @@ int
lnet_count_acceptor_nis(void)
{
/* Return the # of NIs that need the acceptor. */
int count = 0;
struct list_head *tmp;
struct lnet_ni *ni;
int cpt;
int count = 0;
struct list_head *tmp;
struct lnet_ni *ni;
int cpt;
cpt = lnet_net_lock_current();
list_for_each(tmp, &the_lnet.ln_nis) {
......@@ -895,7 +895,7 @@ lnet_count_acceptor_nis(void)
static int
lnet_ni_tq_credits(lnet_ni_t *ni)
{
int credits;
int credits;
LASSERT(ni->ni_ncpts >= 1);
......@@ -912,9 +912,9 @@ lnet_ni_tq_credits(lnet_ni_t *ni)
static void
lnet_shutdown_lndnis(void)
{
int i;
int islo;
lnet_ni_t *ni;
int i;
int islo;
lnet_ni_t *ni;
/* NB called holding the global mutex */
......@@ -968,8 +968,8 @@ lnet_shutdown_lndnis(void)
* and shut them down in guaranteed thread context */
i = 2;
while (!list_empty(&the_lnet.ln_nis_zombie)) {
int *ref;
int j;
int *ref;
int j;
ni = list_entry(the_lnet.ln_nis_zombie.next,
lnet_ni_t, ni_list);
......@@ -1029,15 +1029,15 @@ lnet_shutdown_lndnis(void)
static int
lnet_startup_lndnis(void)
{
lnd_t *lnd;
struct lnet_ni *ni;
struct lnet_tx_queue *tq;
struct list_head nilist;
int i;
int rc = 0;
int lnd_type;
int nicount = 0;
char *nets = lnet_get_networks();
lnd_t *lnd;
struct lnet_ni *ni;
struct lnet_tx_queue *tq;
struct list_head nilist;
int i;
int rc = 0;
int lnd_type;
int nicount = 0;
char *nets = lnet_get_networks();
INIT_LIST_HEAD(&nilist);
......@@ -1181,7 +1181,7 @@ lnet_startup_lndnis(void)
int
LNetInit(void)
{
int rc;
int rc;
lnet_assert_wire_constants();
LASSERT(!the_lnet.ln_init);
......@@ -1277,8 +1277,8 @@ EXPORT_SYMBOL(LNetFini);
int
LNetNIInit(lnet_pid_t requested_pid)
{
int im_a_router = 0;
int rc;
int im_a_router = 0;
int rc;
LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
......@@ -1413,9 +1413,9 @@ int
LNetCtl(unsigned int cmd, void *arg)
{
struct libcfs_ioctl_data *data = arg;
lnet_process_id_t id = {0};
lnet_ni_t *ni;
int rc;
lnet_process_id_t id = {0};
lnet_ni_t *ni;
int rc;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -1531,10 +1531,10 @@ EXPORT_SYMBOL(LNetCtl);
int
LNetGetId(unsigned int index, lnet_process_id_t *id)
{
struct lnet_ni *ni;
struct list_head *tmp;
int cpt;
int rc = -ENOENT;
struct lnet_ni *ni;
struct list_head *tmp;
int cpt;
int rc = -ENOENT;
LASSERT(the_lnet.ln_init);
......@@ -1575,11 +1575,11 @@ EXPORT_SYMBOL(LNetSnprintHandle);
static int
lnet_create_ping_info(void)
{
int i;
int n;
int rc;
unsigned int infosz;
lnet_ni_t *ni;
int i;
int n;
int rc;
unsigned int infosz;
lnet_ni_t *ni;
lnet_process_id_t id;
lnet_ping_info_t *pinfo;
......@@ -1633,7 +1633,7 @@ lnet_create_ping_info(void)
static void
lnet_destroy_ping_info(void)
{
struct lnet_ni *ni;
struct lnet_ni *ni;
lnet_net_lock(0);
......@@ -1654,12 +1654,12 @@ lnet_destroy_ping_info(void)
int
lnet_ping_target_init(void)
{
lnet_md_t md = { NULL };
lnet_handle_me_t meh;
lnet_md_t md = { NULL };
lnet_handle_me_t meh;
lnet_process_id_t id;
int rc;
int rc2;
int infosz;
int rc;
int rc2;
int infosz;
rc = lnet_create_ping_info();
if (rc != 0)
......@@ -1722,11 +1722,11 @@ lnet_ping_target_init(void)
void
lnet_ping_target_fini(void)
{
lnet_event_t event;
int rc;
int which;
int timeout_ms = 1000;
sigset_t blocked = cfs_block_allsigs();
lnet_event_t event;
int rc;
int which;
int timeout_ms = 1000;
sigset_t blocked = cfs_block_allsigs();
LNetMDUnlink(the_lnet.ln_ping_target_md);
/* NB md could be busy; this just starts the unlink */
......@@ -1759,22 +1759,22 @@ lnet_ping_target_fini(void)
int
lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids, int n_ids)
{
lnet_handle_eq_t eqh;
lnet_handle_md_t mdh;
lnet_event_t event;
lnet_md_t md = { NULL };
int which;
int unlinked = 0;
int replied = 0;
const int a_long_time = 60000; /* mS */
int infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]);
lnet_ping_info_t *info;
lnet_process_id_t tmpid;
int i;
int nob;
int rc;
int rc2;
sigset_t blocked;
lnet_handle_eq_t eqh;
lnet_handle_md_t mdh;
lnet_event_t event;
lnet_md_t md = { NULL };
int which;
int unlinked = 0;
int replied = 0;
const int a_long_time = 60000; /* mS */
int infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]);
lnet_ping_info_t *info;
lnet_process_id_t tmpid;
int i;
int nob;
int rc;
int rc2;
sigset_t blocked;
if (n_ids <= 0 ||
id.nid == LNET_NID_ANY ||
......
......@@ -38,9 +38,9 @@
#include "../../include/linux/lnet/lib-lnet.h"
struct lnet_text_buf_t { /* tmp struct for parsing routes */
struct list_head ltb_list; /* stash on lists */
int ltb_size; /* allocated size */
char ltb_text[0]; /* text buffer */
struct list_head ltb_list; /* stash on lists */
int ltb_size; /* allocated size */
char ltb_text[0]; /* text buffer */
};
static int lnet_tbnob; /* track text buf allocation */
......@@ -80,8 +80,8 @@ lnet_issep(char c)
static int
lnet_net_unique(__u32 net, struct list_head *nilist)
{
struct list_head *tmp;
lnet_ni_t *ni;
struct list_head *tmp;
lnet_ni_t *ni;
list_for_each(tmp, nilist) {
ni = list_entry(tmp, lnet_ni_t, ni_list);
......@@ -111,10 +111,10 @@ lnet_ni_free(struct lnet_ni *ni)
static lnet_ni_t *
lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist)
{
struct lnet_tx_queue *tq;
struct lnet_ni *ni;
int rc;
int i;
struct lnet_tx_queue *tq;
struct lnet_ni *ni;
int rc;
int i;
if (!lnet_net_unique(net, nilist)) {
LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n",
......@@ -178,13 +178,13 @@ int
lnet_parse_networks(struct list_head *nilist, char *networks)
{
struct cfs_expr_list *el = NULL;
int tokensize = strlen(networks) + 1;
char *tokens;
char *str;
char *tmp;
struct lnet_ni *ni;
__u32 net;
int nnets = 0;
int tokensize = strlen(networks) + 1;
char *tokens;
char *str;
char *tmp;
struct lnet_ni *ni;
__u32 net;
int nnets = 0;
if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
/* _WAY_ conservative */
......@@ -210,12 +210,12 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
goto failed;
while (str != NULL && *str != 0) {
char *comma = strchr(str, ',');
char *bracket = strchr(str, '(');
char *square = strchr(str, '[');
char *iface;
int niface;
int rc;
char *comma = strchr(str, ',');
char *bracket = strchr(str, '(');
char *square = strchr(str, '[');
char *iface;
int niface;
int rc;
/* NB we don't check interface conflicts here; it's the LNDs
* responsibility (if it cares at all) */
......@@ -369,7 +369,7 @@ static struct lnet_text_buf_t *
lnet_new_text_buf(int str_len)
{
struct lnet_text_buf_t *ltb;
int nob;
int nob;
/* NB allocate space for the terminating 0 */
nob = offsetof(struct lnet_text_buf_t, ltb_text[str_len + 1]);
......@@ -404,7 +404,7 @@ lnet_free_text_buf(struct lnet_text_buf_t *ltb)
static void
lnet_free_text_bufs(struct list_head *tbs)
{
struct lnet_text_buf_t *ltb;
struct lnet_text_buf_t *ltb;
while (!list_empty(tbs)) {
ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list);
......@@ -417,11 +417,11 @@ lnet_free_text_bufs(struct list_head *tbs)
static int
lnet_str2tbs_sep(struct list_head *tbs, char *str)
{
struct list_head pending;
char *sep;
int nob;
int i;
struct lnet_text_buf_t *ltb;
struct list_head pending;
char *sep;
int nob;
int i;
struct lnet_text_buf_t *ltb;
INIT_LIST_HEAD(&pending);
......@@ -477,8 +477,8 @@ lnet_expand1tb(struct list_head *list,
char *str, char *sep1, char *sep2,
char *item, int itemlen)
{
int len1 = (int)(sep1 - str);
int len2 = strlen(sep2 + 1);
int len1 = (int)(sep1 - str);
int len2 = strlen(sep2 + 1);
struct lnet_text_buf_t *ltb;
LASSERT(*sep1 == '[');
......@@ -500,18 +500,18 @@ lnet_expand1tb(struct list_head *list,
static int
lnet_str2tbs_expand(struct list_head *tbs, char *str)
{
char num[16];
struct list_head pending;
char *sep;
char *sep2;
char *parsed;
char *enditem;
int lo;
int hi;
int stride;
int i;
int nob;
int scanned;
char num[16];
struct list_head pending;
char *sep;
char *sep2;
char *parsed;
char *enditem;
int lo;
int hi;
int stride;
int i;
int nob;
int scanned;
INIT_LIST_HEAD(&pending);
......@@ -584,8 +584,8 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
static int
lnet_parse_hops(char *str, unsigned int *hops)
{
int len = strlen(str);
int nob = len;
int len = strlen(str);
int nob = len;
return (sscanf(str, "%u%n", hops, &nob) >= 1 &&
nob == len &&
......@@ -597,9 +597,9 @@ lnet_parse_hops(char *str, unsigned int *hops)
static int
lnet_parse_priority(char *str, unsigned int *priority, char **token)
{
int nob;
int nob;
char *sep;
int len;
int len;
sep = strchr(str, LNET_PRIORITY_SEPARATOR);
if (sep == NULL) {
......@@ -628,23 +628,23 @@ static int
lnet_parse_route(char *str, int *im_a_router)
{
/* static scratch buffer OK (single threaded) */
static char cmd[LNET_SINGLE_TEXTBUF_NOB];
struct list_head nets;
struct list_head gateways;
struct list_head *tmp1;
struct list_head *tmp2;
__u32 net;
lnet_nid_t nid;
struct lnet_text_buf_t *ltb;
int rc;
char *sep;
char *token = str;
int ntokens = 0;
int myrc = -1;
unsigned int hops;
int got_hops = 0;
unsigned int priority = 0;
static char cmd[LNET_SINGLE_TEXTBUF_NOB];
struct list_head nets;
struct list_head gateways;
struct list_head *tmp1;
struct list_head *tmp2;
__u32 net;
lnet_nid_t nid;
struct lnet_text_buf_t *ltb;
int rc;
char *sep;
char *token = str;
int ntokens = 0;
int myrc = -1;
unsigned int hops;
int got_hops = 0;
unsigned int priority = 0;
INIT_LIST_HEAD(&gateways);
INIT_LIST_HEAD(&nets);
......@@ -772,7 +772,7 @@ lnet_parse_route(char *str, int *im_a_router)
static int
lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
{
struct lnet_text_buf_t *ltb;
struct lnet_text_buf_t *ltb;
while (!list_empty(tbs)) {
ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list);
......@@ -792,8 +792,8 @@ lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
int
lnet_parse_routes(char *routes, int *im_a_router)
{
struct list_head tbs;
int rc = 0;
struct list_head tbs;
int rc = 0;
*im_a_router = 0;
......@@ -814,8 +814,8 @@ static int
lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
{
LIST_HEAD(list);
int rc;
int i;
int rc;
int i;
rc = cfs_ip_addr_parse(token, len, &list);
if (rc != 0)
......@@ -834,13 +834,13 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
{
static char tokens[LNET_SINGLE_TEXTBUF_NOB];
int matched = 0;
int ntokens = 0;
int len;
int matched = 0;
int ntokens = 0;
int len;
char *net = NULL;
char *sep;
char *token;
int rc;
int rc;
LASSERT(strlen(net_entry) < sizeof(tokens));
......@@ -889,8 +889,8 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
static __u32
lnet_netspec2net(char *netspec)
{
char *bracket = strchr(netspec, '(');
__u32 net;
char *bracket = strchr(netspec, '(');
__u32 net;
if (bracket != NULL)
*bracket = 0;
......@@ -906,15 +906,15 @@ lnet_netspec2net(char *netspec)
static int
lnet_splitnets(char *source, struct list_head *nets)
{
int offset = 0;
int offset2;
int len;
struct lnet_text_buf_t *tb;
struct lnet_text_buf_t *tb2;
struct list_head *t;
char *sep;
char *bracket;
__u32 net;
int offset = 0;
int offset2;
int len;
struct lnet_text_buf_t *tb;
struct lnet_text_buf_t *tb2;
struct list_head *t;
char *sep;
char *bracket;
__u32 net;
LASSERT(!list_empty(nets));
LASSERT(nets->next == nets->prev); /* single entry */
......@@ -986,22 +986,22 @@ lnet_splitnets(char *source, struct list_head *nets)
static int
lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
{
static char networks[LNET_SINGLE_TEXTBUF_NOB];
static char source[LNET_SINGLE_TEXTBUF_NOB];
struct list_head raw_entries;
struct list_head matched_nets;
struct list_head current_nets;
struct list_head *t;
struct list_head *t2;
struct lnet_text_buf_t *tb;
struct lnet_text_buf_t *tb2;
__u32 net1;
__u32 net2;
int len;
int count;
int dup;
int rc;
static char networks[LNET_SINGLE_TEXTBUF_NOB];
static char source[LNET_SINGLE_TEXTBUF_NOB];
struct list_head raw_entries;
struct list_head matched_nets;
struct list_head current_nets;
struct list_head *t;
struct list_head *t2;
struct lnet_text_buf_t *tb;
struct lnet_text_buf_t *tb2;
__u32 net1;
__u32 net2;
int len;
int count;
int dup;
int rc;
INIT_LIST_HEAD(&raw_entries);
if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) {
......@@ -1112,15 +1112,15 @@ lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip)
static int
lnet_ipaddr_enumerate(__u32 **ipaddrsp)
{
int up;
__u32 netmask;
__u32 *ipaddrs;
__u32 *ipaddrs2;
int nip;
char **ifnames;
int nif = libcfs_ipif_enumerate(&ifnames);
int i;
int rc;
int up;
__u32 netmask;
__u32 *ipaddrs;
__u32 *ipaddrs2;
int nip;
char **ifnames;
int nif = libcfs_ipif_enumerate(&ifnames);
int i;
int rc;
if (nif <= 0)
return nif;
......@@ -1178,9 +1178,9 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
int
lnet_parse_ip2nets(char **networksp, char *ip2nets)
{
__u32 *ipaddrs = NULL;
int nip = lnet_ipaddr_enumerate(&ipaddrs);
int rc;
__u32 *ipaddrs = NULL;
int nip = lnet_ipaddr_enumerate(&ipaddrs);
int rc;
if (nip < 0) {
LCONSOLE_ERROR_MSG(0x117,
......@@ -1215,14 +1215,14 @@ lnet_parse_ip2nets(char **networksp, char *ip2nets)
int
lnet_set_ip_niaddr(lnet_ni_t *ni)
{
__u32 net = LNET_NIDNET(ni->ni_nid);
__u32 net = LNET_NIDNET(ni->ni_nid);
char **names;
int n;
__u32 ip;
__u32 netmask;
int up;
int i;
int rc;
int n;
__u32 ip;
__u32 netmask;
int up;
int i;
int rc;
/* Convenience for LNDs that use the IP address of a local interface as
* the local address part of their NID */
......
......@@ -70,7 +70,7 @@ int
LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
lnet_handle_eq_t *handle)
{
lnet_eq_t *eq;
lnet_eq_t *eq;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -151,13 +151,13 @@ EXPORT_SYMBOL(LNetEQAlloc);
int
LNetEQFree(lnet_handle_eq_t eqh)
{
struct lnet_eq *eq;
lnet_event_t *events = NULL;
int **refs = NULL;
int *ref;
int rc = 0;
int size = 0;
int i;
struct lnet_eq *eq;
lnet_event_t *events = NULL;
int **refs = NULL;
int *ref;
int rc = 0;
int size = 0;
int i;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -185,9 +185,9 @@ LNetEQFree(lnet_handle_eq_t eqh)
}
/* stash for free after lock dropped */
events = eq->eq_events;
size = eq->eq_size;
refs = eq->eq_refs;
events = eq->eq_events;
size = eq->eq_size;
refs = eq->eq_refs;
lnet_res_lh_invalidate(&eq->eq_lh);
list_del(&eq->eq_list);
......@@ -237,9 +237,9 @@ lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev)
static int
lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev)
{
int new_index = eq->eq_deq_seq & (eq->eq_size - 1);
lnet_event_t *new_event = &eq->eq_events[new_index];
int rc;
int new_index = eq->eq_deq_seq & (eq->eq_size - 1);
lnet_event_t *new_event = &eq->eq_events[new_index];
int rc;
/* must called with lnet_eq_wait_lock hold */
if (LNET_SEQ_GT(eq->eq_deq_seq, new_event->sequence))
......@@ -323,10 +323,10 @@ static int
lnet_eq_wait_locked(int *timeout_ms)
__must_hold(&the_lnet.ln_eq_wait_lock)
{
int tms = *timeout_ms;
int wait;
wait_queue_t wl;
unsigned long now;
int tms = *timeout_ms;
int wait;
wait_queue_t wl;
unsigned long now;
if (tms == 0)
return -1; /* don't want to wait and no new event */
......@@ -392,9 +392,9 @@ int
LNetEQPoll(lnet_handle_eq_t *eventqs, int neq, int timeout_ms,
lnet_event_t *event, int *which)
{
int wait = 1;
int rc;
int i;
int wait = 1;
int rc;
int i;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......
......@@ -74,7 +74,7 @@ lnet_md_unlink(lnet_libmd_t *md)
CDEBUG(D_NET, "Unlinking md %p\n", md);
if (md->md_eq != NULL) {
int cpt = lnet_cpt_of_cookie(md->md_lh.lh_cookie);
int cpt = lnet_cpt_of_cookie(md->md_lh.lh_cookie);
LASSERT(*md->md_eq->eq_refs[cpt] > 0);
(*md->md_eq->eq_refs[cpt])--;
......@@ -88,9 +88,9 @@ lnet_md_unlink(lnet_libmd_t *md)
static int
lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink)
{
int i;
int i;
unsigned int niov;
int total_length = 0;
int total_length = 0;
lmd->md_me = NULL;
lmd->md_start = umd->start;
......@@ -268,10 +268,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
{
LIST_HEAD(matches);
LIST_HEAD(drops);
struct lnet_me *me;
struct lnet_libmd *md;
int cpt;
int rc;
struct lnet_me *me;
struct lnet_libmd *md;
int cpt;
int rc;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -346,9 +346,9 @@ EXPORT_SYMBOL(LNetMDAttach);
int
LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle)
{
lnet_libmd_t *md;
int cpt;
int rc;
lnet_libmd_t *md;
int cpt;
int rc;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -421,9 +421,9 @@ EXPORT_SYMBOL(LNetMDBind);
int
LNetMDUnlink(lnet_handle_md_t mdh)
{
lnet_event_t ev;
lnet_libmd_t *md;
int cpt;
lnet_event_t ev;
lnet_libmd_t *md;
int cpt;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......
......@@ -80,8 +80,8 @@ LNetMEAttach(unsigned int portal,
lnet_handle_me_t *handle)
{
struct lnet_match_table *mtable;
struct lnet_me *me;
struct list_head *head;
struct lnet_me *me;
struct list_head *head;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -151,10 +151,10 @@ LNetMEInsert(lnet_handle_me_t current_meh,
lnet_unlink_t unlink, lnet_ins_pos_t pos,
lnet_handle_me_t *handle)
{
struct lnet_me *current_me;
struct lnet_me *new_me;
struct lnet_portal *ptl;
int cpt;
struct lnet_me *current_me;
struct lnet_me *new_me;
struct lnet_portal *ptl;
int cpt;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......@@ -228,10 +228,10 @@ EXPORT_SYMBOL(LNetMEInsert);
int
LNetMEUnlink(lnet_handle_me_t meh)
{
lnet_me_t *me;
lnet_libmd_t *md;
lnet_event_t ev;
int cpt;
lnet_me_t *me;
lnet_libmd_t *md;
lnet_event_t ev;
int cpt;
LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0);
......
This diff is collapsed.
......@@ -60,8 +60,8 @@ lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev)
void
lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type)
{
lnet_hdr_t *hdr = &msg->msg_hdr;
lnet_event_t *ev = &msg->msg_ev;
lnet_hdr_t *hdr = &msg->msg_hdr;
lnet_event_t *ev = &msg->msg_ev;
LASSERT(!msg->msg_routing);
......@@ -73,7 +73,7 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type)
ev->target.pid = le32_to_cpu(hdr->dest_pid);
ev->initiator.nid = LNET_NID_ANY;
ev->initiator.pid = the_lnet.ln_pid;
ev->sender = LNET_NID_ANY;
ev->sender = LNET_NID_ANY;
} else {
/* event for passive message */
......@@ -82,9 +82,9 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type)
ev->initiator.pid = hdr->src_pid;
ev->initiator.nid = hdr->src_nid;
ev->rlength = hdr->payload_length;
ev->sender = msg->msg_from;
ev->mlength = msg->msg_wanted;
ev->offset = msg->msg_offset;
ev->sender = msg->msg_from;
ev->mlength = msg->msg_wanted;
ev->offset = msg->msg_offset;
}
switch (ev_type) {
......@@ -137,7 +137,7 @@ void
lnet_msg_commit(lnet_msg_t *msg, int cpt)
{
struct lnet_msg_container *container = the_lnet.ln_msg_containers[cpt];
lnet_counters_t *counters = the_lnet.ln_counters[cpt];
lnet_counters_t *counters = the_lnet.ln_counters[cpt];
/* routed message can be committed for both receiving and sending */
LASSERT(!msg->msg_tx_committed);
......@@ -170,7 +170,7 @@ static void
lnet_msg_decommit_tx(lnet_msg_t *msg, int status)
{
lnet_counters_t *counters;
lnet_event_t *ev = &msg->msg_ev;
lnet_event_t *ev = &msg->msg_ev;
LASSERT(msg->msg_tx_committed);
if (status != 0)
......@@ -219,8 +219,8 @@ lnet_msg_decommit_tx(lnet_msg_t *msg, int status)
static void
lnet_msg_decommit_rx(lnet_msg_t *msg, int status)
{
lnet_counters_t *counters;
lnet_event_t *ev = &msg->msg_ev;
lnet_counters_t *counters;
lnet_event_t *ev = &msg->msg_ev;
LASSERT(!msg->msg_tx_committed); /* decommitted or never committed */
LASSERT(msg->msg_rx_committed);
......@@ -273,7 +273,7 @@ lnet_msg_decommit_rx(lnet_msg_t *msg, int status)
void
lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status)
{
int cpt2 = cpt;
int cpt2 = cpt;
LASSERT(msg->msg_tx_committed || msg->msg_rx_committed);
LASSERT(msg->msg_onactivelist);
......@@ -335,8 +335,8 @@ lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md,
void
lnet_msg_detach_md(lnet_msg_t *msg, int status)
{
lnet_libmd_t *md = msg->msg_md;
int unlink;
lnet_libmd_t *md = msg->msg_md;
int unlink;
/* Now it's safe to drop my caller's ref */
md->md_refcount--;
......@@ -359,8 +359,8 @@ static int
lnet_complete_msg_locked(lnet_msg_t *msg, int cpt)
{
lnet_handle_wire_t ack_wmd;
int rc;
int status = msg->msg_ev.status;
int rc;
int status = msg->msg_ev.status;
LASSERT(msg->msg_onactivelist);
......@@ -434,11 +434,11 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt)
void
lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status)
{
struct lnet_msg_container *container;
int my_slot;
int cpt;
int rc;
int i;
struct lnet_msg_container *container;
int my_slot;
int cpt;
int rc;
int i;
LASSERT(!in_interrupt());
......@@ -534,7 +534,7 @@ EXPORT_SYMBOL(lnet_finalize);
void
lnet_msg_container_cleanup(struct lnet_msg_container *container)
{
int count = 0;
int count = 0;
if (container->msc_init == 0)
return;
......@@ -568,7 +568,7 @@ lnet_msg_container_cleanup(struct lnet_msg_container *container)
int
lnet_msg_container_setup(struct lnet_msg_container *container, int cpt)
{
int rc;
int rc;
container->msc_init = 1;
......@@ -608,7 +608,7 @@ void
lnet_msg_containers_destroy(void)
{
struct lnet_msg_container *container;
int i;
int i;
if (the_lnet.ln_msg_containers == NULL)
return;
......@@ -624,8 +624,8 @@ int
lnet_msg_containers_create(void)
{
struct lnet_msg_container *container;
int rc;
int i;
int rc;
int i;
the_lnet.ln_msg_containers = cfs_percpt_alloc(lnet_cpt_table(),
sizeof(*container));
......
......@@ -39,7 +39,7 @@
#include "../../include/linux/lnet/lib-lnet.h"
/* NB: add /proc interfaces in upcoming patches */
int portal_rotor = LNET_PTL_ROTOR_HASH_RT;
int portal_rotor = LNET_PTL_ROTOR_HASH_RT;
module_param(portal_rotor, int, 0644);
MODULE_PARM_DESC(portal_rotor, "redirect PUTs to different cpu-partitions");
......@@ -47,8 +47,8 @@ static int
lnet_ptl_match_type(unsigned int index, lnet_process_id_t match_id,
__u64 mbits, __u64 ignore_bits)
{
struct lnet_portal *ptl = the_lnet.ln_portals[index];
int unique;
struct lnet_portal *ptl = the_lnet.ln_portals[index];
int unique;
unique = ignore_bits == 0 &&
match_id.nid != LNET_NID_ANY &&
......@@ -89,7 +89,7 @@ static void
lnet_ptl_enable_mt(struct lnet_portal *ptl, int cpt)
{
struct lnet_match_table *mtable = ptl->ptl_mtables[cpt];
int i;
int i;
/* with hold of both lnet_res_lock(cpt) and lnet_ptl_lock */
LASSERT(lnet_ptl_is_wildcard(ptl));
......@@ -114,7 +114,7 @@ static void
lnet_ptl_disable_mt(struct lnet_portal *ptl, int cpt)
{
struct lnet_match_table *mtable = ptl->ptl_mtables[cpt];
int i;
int i;
/* with hold of both lnet_res_lock(cpt) and lnet_ptl_lock */
LASSERT(lnet_ptl_is_wildcard(ptl));
......@@ -141,9 +141,9 @@ lnet_try_match_md(lnet_libmd_t *md,
{
/* ALWAYS called holding the lnet_res_lock, and can't lnet_res_unlock;
* lnet_match_blocked_msg() relies on this to avoid races */
unsigned int offset;
unsigned int mlength;
lnet_me_t *me = md->md_me;
unsigned int offset;
unsigned int mlength;
lnet_me_t *me = md->md_me;
/* MD exhausted */
if (lnet_md_exhausted(md))
......@@ -227,7 +227,7 @@ struct lnet_match_table *
lnet_mt_of_attach(unsigned int index, lnet_process_id_t id,
__u64 mbits, __u64 ignore_bits, lnet_ins_pos_t pos)
{
struct lnet_portal *ptl;
struct lnet_portal *ptl;
struct lnet_match_table *mtable;
/* NB: called w/o lock */
......@@ -261,11 +261,11 @@ static struct lnet_match_table *
lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg)
{
struct lnet_match_table *mtable;
struct lnet_portal *ptl;
unsigned int nmaps;
unsigned int rotor;
unsigned int cpt;
bool routed;
struct lnet_portal *ptl;
unsigned int nmaps;
unsigned int rotor;
unsigned int cpt;
bool routed;
/* NB: called w/o lock */
LASSERT(info->mi_portal < the_lnet.ln_nportals);
......@@ -312,8 +312,8 @@ lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg)
static int
lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos)
{
__u64 *bmap;
int i;
__u64 *bmap;
int i;
if (!lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal]))
return 0;
......@@ -337,7 +337,7 @@ lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos)
static void
lnet_mt_set_exhausted(struct lnet_match_table *mtable, int pos, int exhausted)
{
__u64 *bmap;
__u64 *bmap;
LASSERT(lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal]));
LASSERT(pos <= LNET_MT_HASH_IGNORE);
......@@ -373,11 +373,11 @@ int
lnet_mt_match_md(struct lnet_match_table *mtable,
struct lnet_match_info *info, struct lnet_msg *msg)
{
struct list_head *head;
lnet_me_t *me;
lnet_me_t *tmp;
int exhausted = 0;
int rc;
struct list_head *head;
lnet_me_t *me;
lnet_me_t *tmp;
int exhausted = 0;
int rc;
/* any ME with ignore bits? */
if (!list_empty(&mtable->mt_mhash[LNET_MT_HASH_IGNORE]))
......@@ -428,7 +428,7 @@ lnet_mt_match_md(struct lnet_match_table *mtable,
static int
lnet_ptl_match_early(struct lnet_portal *ptl, struct lnet_msg *msg)
{
int rc;
int rc;
/* message arrived before any buffer posting on this portal,
* simply delay or drop this message */
......@@ -461,9 +461,9 @@ static int
lnet_ptl_match_delay(struct lnet_portal *ptl,
struct lnet_match_info *info, struct lnet_msg *msg)
{
int first = ptl->ptl_mt_maps[0]; /* read w/o lock */
int rc = 0;
int i;
int first = ptl->ptl_mt_maps[0]; /* read w/o lock */
int rc = 0;
int i;
/* steal buffer from other CPTs, and delay it if nothing to steal,
* this function is more expensive than a regular match, but we
......@@ -472,7 +472,7 @@ lnet_ptl_match_delay(struct lnet_portal *ptl,
for (i = 0; i < LNET_CPT_NUMBER; i++) {
struct lnet_match_table *mtable;
int cpt;
int cpt;
cpt = (first + i) % LNET_CPT_NUMBER;
mtable = ptl->ptl_mtables[cpt];
......@@ -536,8 +536,8 @@ int
lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg)
{
struct lnet_match_table *mtable;
struct lnet_portal *ptl;
int rc;
struct lnet_portal *ptl;
int rc;
CDEBUG(D_NET, "Request from %s of length %d into portal %d MB=%#llx\n",
libcfs_id2str(info->mi_id), info->mi_rlength, info->mi_portal,
......@@ -622,13 +622,13 @@ void
lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,
struct list_head *matches, struct list_head *drops)
{
struct lnet_portal *ptl = the_lnet.ln_portals[me->me_portal];
struct lnet_portal *ptl = the_lnet.ln_portals[me->me_portal];
struct lnet_match_table *mtable;
struct list_head *head;
lnet_msg_t *tmp;
lnet_msg_t *msg;
int exhausted = 0;
int cpt;
struct list_head *head;
lnet_msg_t *tmp;
lnet_msg_t *msg;
int exhausted = 0;
int cpt;
LASSERT(md->md_refcount == 0); /* a brand new MD */
......@@ -647,20 +647,20 @@ lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,
head = &ptl->ptl_msg_stealing;
again:
list_for_each_entry_safe(msg, tmp, head, msg_list) {
struct lnet_match_info info;
lnet_hdr_t *hdr;
int rc;
struct lnet_match_info info;
lnet_hdr_t *hdr;
int rc;
LASSERT(msg->msg_rx_delayed || head == &ptl->ptl_msg_stealing);
hdr = &msg->msg_hdr;
info.mi_id.nid = hdr->src_nid;
info.mi_id.pid = hdr->src_pid;
info.mi_opc = LNET_MD_OP_PUT;
info.mi_portal = hdr->msg.put.ptl_index;
info.mi_rlength = hdr->payload_length;
info.mi_roffset = hdr->msg.put.offset;
info.mi_mbits = hdr->msg.put.match_bits;
hdr = &msg->msg_hdr;
info.mi_id.nid = hdr->src_nid;
info.mi_id.pid = hdr->src_pid;
info.mi_opc = LNET_MD_OP_PUT;
info.mi_portal = hdr->msg.put.ptl_index;
info.mi_rlength = hdr->payload_length;
info.mi_roffset = hdr->msg.put.offset;
info.mi_mbits = hdr->msg.put.match_bits;
rc = lnet_try_match_md(md, &info, msg);
......@@ -715,7 +715,7 @@ static void
lnet_ptl_cleanup(struct lnet_portal *ptl)
{
struct lnet_match_table *mtable;
int i;
int i;
if (ptl->ptl_mtables == NULL) /* uninitialized portal */
return;
......@@ -723,9 +723,9 @@ lnet_ptl_cleanup(struct lnet_portal *ptl)
LASSERT(list_empty(&ptl->ptl_msg_delayed));
LASSERT(list_empty(&ptl->ptl_msg_stealing));
cfs_percpt_for_each(mtable, i, ptl->ptl_mtables) {
struct list_head *mhash;
lnet_me_t *me;
int j;
struct list_head *mhash;
lnet_me_t *me;
int j;
if (mtable->mt_mhash == NULL) /* uninitialized match-table */
continue;
......@@ -753,9 +753,9 @@ static int
lnet_ptl_setup(struct lnet_portal *ptl, int index)
{
struct lnet_match_table *mtable;
struct list_head *mhash;
int i;
int j;
struct list_head *mhash;
int i;
int j;
ptl->ptl_mtables = cfs_percpt_alloc(lnet_cpt_table(),
sizeof(struct lnet_match_table));
......@@ -798,7 +798,7 @@ lnet_ptl_setup(struct lnet_portal *ptl, int index)
void
lnet_portals_destroy(void)
{
int i;
int i;
if (the_lnet.ln_portals == NULL)
return;
......@@ -813,8 +813,8 @@ lnet_portals_destroy(void)
int
lnet_portals_create(void)
{
int size;
int i;
int size;
int i;
size = offsetof(struct lnet_portal, ptl_mt_maps[LNET_CPT_NUMBER]);
......@@ -898,8 +898,8 @@ EXPORT_SYMBOL(LNetSetLazyPortal);
int
LNetClearLazyPortal(int portal)
{
struct lnet_portal *ptl;
LIST_HEAD (zombies);
struct lnet_portal *ptl;
LIST_HEAD(zombies);
if (portal < 0 || portal >= the_lnet.ln_nportals)
return -EINVAL;
......
......@@ -111,7 +111,7 @@ lnd_t the_lolnd = {
/* .lnd_type = */ LOLND,
/* .lnd_startup = */ lolnd_startup,
/* .lnd_shutdown = */ lolnd_shutdown,
/* .lnt_ctl = */ NULL,
/* .lnt_ctl = */ NULL,
/* .lnd_send = */ lolnd_send,
/* .lnd_recv = */ lolnd_recv,
/* .lnd_eager_recv = */ NULL,
......
......@@ -47,7 +47,7 @@ static int
lnet_configure(void *arg)
{
/* 'arg' only there so I can be passed to cfs_create_thread() */
int rc = 0;
int rc = 0;
LNET_MUTEX_LOCK(&lnet_config_mutex);
......@@ -66,7 +66,7 @@ lnet_configure(void *arg)
static int
lnet_unconfigure(void)
{
int refcount;
int refcount;
LNET_MUTEX_LOCK(&lnet_config_mutex);
......@@ -86,7 +86,7 @@ lnet_unconfigure(void)
static int
lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_data *data)
{
int rc;
int rc;
switch (cmd) {
case IOC_LIBCFS_CONFIGURE:
......@@ -113,7 +113,7 @@ static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl);
static int __init
init_lnet(void)
{
int rc;
int rc;
mutex_init(&lnet_config_mutex);
......
......@@ -43,10 +43,10 @@
int
lnet_peer_tables_create(void)
{
struct lnet_peer_table *ptable;
struct list_head *hash;
int i;
int j;
struct lnet_peer_table *ptable;
struct list_head *hash;
int i;
int j;
the_lnet.ln_peer_tables = cfs_percpt_alloc(lnet_cpt_table(),
sizeof(*ptable));
......@@ -77,10 +77,10 @@ lnet_peer_tables_create(void)
void
lnet_peer_tables_destroy(void)
{
struct lnet_peer_table *ptable;
struct list_head *hash;
int i;
int j;
struct lnet_peer_table *ptable;
struct list_head *hash;
int i;
int j;
if (the_lnet.ln_peer_tables == NULL)
return;
......@@ -106,9 +106,9 @@ lnet_peer_tables_destroy(void)
void
lnet_peer_tables_cleanup(void)
{
struct lnet_peer_table *ptable;
int i;
int j;
struct lnet_peer_table *ptable;
int i;
int j;
LASSERT(the_lnet.ln_shutdown); /* i.e. no new peers */
......@@ -133,7 +133,7 @@ lnet_peer_tables_cleanup(void)
cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
LIST_HEAD(deathrow);
lnet_peer_t *lp;
lnet_peer_t *lp;
lnet_net_lock(i);
......@@ -186,8 +186,8 @@ lnet_destroy_peer_locked(lnet_peer_t *lp)
lnet_peer_t *
lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
{
struct list_head *peers;
lnet_peer_t *lp;
struct list_head *peers;
lnet_peer_t *lp;
LASSERT(!the_lnet.ln_shutdown);
......@@ -205,11 +205,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
int
lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
{
struct lnet_peer_table *ptable;
lnet_peer_t *lp = NULL;
lnet_peer_t *lp2;
int cpt2;
int rc = 0;
struct lnet_peer_table *ptable;
lnet_peer_t *lp = NULL;
lnet_peer_t *lp2;
int cpt2;
int rc = 0;
*lpp = NULL;
if (the_lnet.ln_shutdown) /* it's shutting down */
......@@ -287,8 +287,8 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
goto out;
}
lp->lp_txcredits =
lp->lp_mintxcredits = lp->lp_ni->ni_peertxcredits;
lp->lp_txcredits =
lp->lp_mintxcredits = lp->lp_ni->ni_peertxcredits;
lp->lp_rtrcredits =
lp->lp_minrtrcredits = lnet_peer_buffer_credits(lp->lp_ni);
......@@ -308,10 +308,10 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
void
lnet_debug_peer(lnet_nid_t nid)
{
char *aliveness = "NA";
lnet_peer_t *lp;
int rc;
int cpt;
char *aliveness = "NA";
lnet_peer_t *lp;
int rc;
int cpt;
cpt = lnet_cpt_of_nid(nid);
lnet_net_lock(cpt);
......
This diff is collapsed.
......@@ -112,11 +112,11 @@ static int proc_call_handler(void *data, int write, loff_t *ppos,
static int __proc_lnet_stats(void *data, int write,
loff_t pos, void __user *buffer, int nob)
{
int rc;
int rc;
lnet_counters_t *ctrs;
int len;
char *tmpstr;
const int tmpsiz = 256; /* 7 %u and 4 %llu */
int len;
char *tmpstr;
const int tmpsiz = 256; /* 7 %u and 4 %llu */
if (write) {
lnet_counters_reset();
......@@ -167,13 +167,13 @@ static int proc_lnet_stats(struct ctl_table *table, int write,
static int proc_lnet_routes(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
const int tmpsiz = 256;
char *tmpstr;
char *s;
int rc = 0;
int len;
int ver;
int off;
const int tmpsiz = 256;
char *tmpstr;
char *s;
int rc = 0;
int len;
int ver;
int off;
CLASSERT(sizeof(loff_t) >= 4);
......@@ -205,13 +205,13 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
lnet_net_unlock(0);
*ppos = LNET_PROC_POS_MAKE(0, ver, 0, off);
} else {
struct list_head *n;
struct list_head *r;
lnet_route_t *route = NULL;
lnet_remotenet_t *rnet = NULL;
int skip = off - 1;
struct list_head *rn_list;
int i;
struct list_head *n;
struct list_head *r;
lnet_route_t *route = NULL;
lnet_remotenet_t *rnet = NULL;
int skip = off - 1;
struct list_head *rn_list;
int i;
lnet_net_lock(0);
......@@ -251,11 +251,11 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
}
if (route != NULL) {
__u32 net = rnet->lrn_net;
unsigned int hops = route->lr_hops;
unsigned int priority = route->lr_priority;
lnet_nid_t nid = route->lr_gateway->lp_nid;
int alive = route->lr_gateway->lp_alive;
__u32 net = rnet->lrn_net;
unsigned int hops = route->lr_hops;
unsigned int priority = route->lr_priority;
lnet_nid_t nid = route->lr_gateway->lp_nid;
int alive = route->lr_gateway->lp_alive;
s += snprintf(s, tmpstr + tmpsiz - s,
"%-8s %4u %8u %7s %s\n",
......@@ -293,13 +293,13 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
static int proc_lnet_routers(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int rc = 0;
char *tmpstr;
char *s;
const int tmpsiz = 256;
int len;
int ver;
int off;
int rc = 0;
char *tmpstr;
char *s;
const int tmpsiz = 256;
int len;
int ver;
int off;
off = LNET_PROC_HOFF_GET(*ppos);
ver = LNET_PROC_VER_GET(*ppos);
......@@ -328,9 +328,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
lnet_net_unlock(0);
*ppos = LNET_PROC_POS_MAKE(0, ver, 0, off);
} else {
struct list_head *r;
struct lnet_peer *peer = NULL;
int skip = off - 1;
struct list_head *r;
struct lnet_peer *peer = NULL;
int skip = off - 1;
lnet_net_lock(0);
......@@ -360,14 +360,14 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
lnet_nid_t nid = peer->lp_nid;
unsigned long now = cfs_time_current();
unsigned long deadline = peer->lp_ping_deadline;
int nrefs = peer->lp_refcount;
int nrtrrefs = peer->lp_rtr_refcount;
int nrefs = peer->lp_refcount;
int nrtrrefs = peer->lp_rtr_refcount;
int alive_cnt = peer->lp_alive_count;
int alive = peer->lp_alive;
int pingsent = !peer->lp_ping_notsent;
int alive = peer->lp_alive;
int pingsent = !peer->lp_ping_notsent;
int last_ping = cfs_duration_sec(cfs_time_sub(now,
peer->lp_ping_timestamp));
int down_ni = 0;
int down_ni = 0;
lnet_route_t *rtr;
if ((peer->lp_ping_feats &
......@@ -428,16 +428,16 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
static int proc_lnet_peers(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
const int tmpsiz = 256;
struct lnet_peer_table *ptable;
char *tmpstr;
char *s;
int cpt = LNET_PROC_CPT_GET(*ppos);
int ver = LNET_PROC_VER_GET(*ppos);
int hash = LNET_PROC_HASH_GET(*ppos);
int hoff = LNET_PROC_HOFF_GET(*ppos);
int rc = 0;
int len;
const int tmpsiz = 256;
struct lnet_peer_table *ptable;
char *tmpstr;
char *s;
int cpt = LNET_PROC_CPT_GET(*ppos);
int ver = LNET_PROC_VER_GET(*ppos);
int hash = LNET_PROC_HASH_GET(*ppos);
int hoff = LNET_PROC_HOFF_GET(*ppos);
int rc = 0;
int len;
CLASSERT(LNET_PROC_HASH_BITS >= LNET_PEER_HASH_BITS);
LASSERT(!write);
......@@ -465,9 +465,9 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
hoff++;
} else {
struct lnet_peer *peer;
struct list_head *p;
int skip;
struct lnet_peer *peer;
struct list_head *p;
int skip;
again:
p = NULL;
peer = NULL;
......@@ -521,23 +521,23 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
}
if (peer != NULL) {
lnet_nid_t nid = peer->lp_nid;
int nrefs = peer->lp_refcount;
int lastalive = -1;
char *aliveness = "NA";
int maxcr = peer->lp_ni->ni_peertxcredits;
int txcr = peer->lp_txcredits;
int mintxcr = peer->lp_mintxcredits;
int rtrcr = peer->lp_rtrcredits;
int minrtrcr = peer->lp_minrtrcredits;
int txqnob = peer->lp_txqnob;
lnet_nid_t nid = peer->lp_nid;
int nrefs = peer->lp_refcount;
int lastalive = -1;
char *aliveness = "NA";
int maxcr = peer->lp_ni->ni_peertxcredits;
int txcr = peer->lp_txcredits;
int mintxcr = peer->lp_mintxcredits;
int rtrcr = peer->lp_rtrcredits;
int minrtrcr = peer->lp_minrtrcredits;
int txqnob = peer->lp_txqnob;
if (lnet_isrouter(peer) ||
lnet_peer_aliveness_enabled(peer))
aliveness = peer->lp_alive ? "up" : "down";
if (lnet_peer_aliveness_enabled(peer)) {
unsigned long now = cfs_time_current();
unsigned long now = cfs_time_current();
long delta;
delta = cfs_time_sub(now, peer->lp_last_alive);
......@@ -595,13 +595,13 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
static int __proc_lnet_buffers(void *data, int write,
loff_t pos, void __user *buffer, int nob)
{
char *s;
char *tmpstr;
int tmpsiz;
int idx;
int len;
int rc;
int i;
char *s;
char *tmpstr;
int tmpsiz;
int idx;
int len;
int rc;
int i;
LASSERT(!write);
......@@ -660,11 +660,11 @@ static int proc_lnet_buffers(struct ctl_table *table, int write,
static int proc_lnet_nis(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int tmpsiz = 128 * LNET_CPT_NUMBER;
int rc = 0;
char *tmpstr;
char *s;
int len;
int tmpsiz = 128 * LNET_CPT_NUMBER;
int rc = 0;
char *tmpstr;
char *s;
int len;
LASSERT(!write);
......@@ -684,9 +684,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write,
"rtr", "max", "tx", "min");
LASSERT(tmpstr + tmpsiz - s > 0);
} else {
struct list_head *n;
lnet_ni_t *ni = NULL;
int skip = *ppos - 1;
struct list_head *n;
lnet_ni_t *ni = NULL;
int skip = *ppos - 1;
lnet_net_lock(0);
......@@ -705,12 +705,12 @@ static int proc_lnet_nis(struct ctl_table *table, int write,
}
if (ni != NULL) {
struct lnet_tx_queue *tq;
char *stat;
long now = get_seconds();
int last_alive = -1;
int i;
int j;
struct lnet_tx_queue *tq;
char *stat;
long now = get_seconds();
int last_alive = -1;
int i;
int j;
if (the_lnet.ln_routing)
last_alive = now - ni->ni_last_alive;
......@@ -777,9 +777,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write,
}
struct lnet_portal_rotors {
int pr_value;
const char *pr_name;
const char *pr_desc;
int pr_value;
const char *pr_name;
const char *pr_desc;
};
static struct lnet_portal_rotors portal_rotors[] = {
......@@ -815,11 +815,11 @@ extern int portal_rotor;
static int __proc_lnet_portal_rotor(void *data, int write,
loff_t pos, void __user *buffer, int nob)
{
const int buf_len = 128;
char *buf;
char *tmp;
int rc;
int i;
const int buf_len = 128;
char *buf;
char *tmp;
int rc;
int i;
LIBCFS_ALLOC(buf, buf_len);
if (buf == NULL)
......@@ -887,38 +887,38 @@ static struct ctl_table lnet_table[] = {
* to go via /proc for portability.
*/
{
.procname = "stats",
.mode = 0644,
.procname = "stats",
.mode = 0644,
.proc_handler = &proc_lnet_stats,
},
{
.procname = "routes",
.mode = 0444,
.procname = "routes",
.mode = 0444,
.proc_handler = &proc_lnet_routes,
},
{
.procname = "routers",
.mode = 0444,
.procname = "routers",
.mode = 0444,
.proc_handler = &proc_lnet_routers,
},
{
.procname = "peers",
.mode = 0444,
.procname = "peers",
.mode = 0444,
.proc_handler = &proc_lnet_peers,
},
{
.procname = "buffers",
.mode = 0444,
.procname = "buffers",
.mode = 0444,
.proc_handler = &proc_lnet_buffers,
},
{
.procname = "nis",
.mode = 0444,
.procname = "nis",
.mode = 0444,
.proc_handler = &proc_lnet_nis,
},
{
.procname = "portal_rotor",
.mode = 0644,
.procname = "portal_rotor",
.mode = 0644,
.proc_handler = &proc_lnet_portal_rotor,
},
{
......
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