diff options
Diffstat (limited to 'drivers/staging/lustre/lnet/lnet')
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/acceptor.c | 92 | ||||
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/config.c | 102 | ||||
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/lib-move.c | 352 | ||||
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/lo.c | 20 | ||||
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/module.c | 10 | ||||
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/router_proc.c | 22 |
6 files changed, 289 insertions, 309 deletions
diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index bb15bde0704c..92c60a756644 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -53,6 +53,7 @@ lnet_acceptor_port(void) { return accept_port; } +EXPORT_SYMBOL(lnet_acceptor_port); static inline int lnet_accept_magic(__u32 magic, __u32 constant) @@ -61,9 +62,6 @@ lnet_accept_magic(__u32 magic, __u32 constant) magic == __swab32(constant)); } - -EXPORT_SYMBOL(lnet_acceptor_port); - static char *accept = "secure"; CFS_MODULE_PARM(accept, "s", charp, 0444, @@ -75,7 +73,7 @@ CFS_MODULE_PARM(accept_backlog, "i", int, 0444, CFS_MODULE_PARM(accept_timeout, "i", int, 0644, "Acceptor's timeout (seconds)"); -static char *accept_type = NULL; +static char *accept_type; int lnet_acceptor_get_tunables(void) @@ -95,57 +93,45 @@ lnet_acceptor_timeout(void) EXPORT_SYMBOL(lnet_acceptor_timeout); void -lnet_connect_console_error (int rc, lnet_nid_t peer_nid, +lnet_connect_console_error(int rc, lnet_nid_t peer_nid, __u32 peer_ip, int peer_port) { switch (rc) { /* "normal" errors */ case -ECONNREFUSED: - CNETERR("Connection to %s at host %pI4h on port %d was " - "refused: check that Lustre is running on that node.\n", + CNETERR("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n", libcfs_nid2str(peer_nid), &peer_ip, peer_port); break; case -EHOSTUNREACH: case -ENETUNREACH: - CNETERR("Connection to %s at host %pI4h " - "was unreachable: the network or that node may " - "be down, or Lustre may be misconfigured.\n", + CNETERR("Connection to %s at host %pI4h was unreachable: the network or that node may be down, or Lustre may be misconfigured.\n", libcfs_nid2str(peer_nid), &peer_ip); break; case -ETIMEDOUT: - CNETERR("Connection to %s at host %pI4h on " - "port %d took too long: that node may be hung " - "or experiencing high load.\n", + CNETERR("Connection to %s at host %pI4h on port %d took too long: that node may be hung or experiencing high load.\n", libcfs_nid2str(peer_nid), &peer_ip, peer_port); break; case -ECONNRESET: - LCONSOLE_ERROR_MSG(0x11b, "Connection to %s at host %pI4h" - " on port %d was reset: " - "is it running a compatible version of " - "Lustre and is %s one of its NIDs?\n", + LCONSOLE_ERROR_MSG(0x11b, "Connection to %s at host %pI4h on port %d was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n", libcfs_nid2str(peer_nid), &peer_ip, peer_port, libcfs_nid2str(peer_nid)); break; case -EPROTO: - LCONSOLE_ERROR_MSG(0x11c, "Protocol error connecting to %s at " - "host %pI4h on port %d: is it running " - "a compatible version of Lustre?\n", + LCONSOLE_ERROR_MSG(0x11c, "Protocol error connecting to %s at host %pI4h on port %d: is it running a compatible version of Lustre?\n", libcfs_nid2str(peer_nid), &peer_ip, peer_port); break; case -EADDRINUSE: - LCONSOLE_ERROR_MSG(0x11d, "No privileged ports available to " - "connect to %s at host %pI4h on port " - "%d\n", libcfs_nid2str(peer_nid), + LCONSOLE_ERROR_MSG(0x11d, "No privileged ports available to connect to %s at host %pI4h on port %d\n", + libcfs_nid2str(peer_nid), &peer_ip, peer_port); break; default: - LCONSOLE_ERROR_MSG(0x11e, "Unexpected error %d connecting to %s" - " at host %pI4h on port %d\n", rc, - libcfs_nid2str(peer_nid), + LCONSOLE_ERROR_MSG(0x11e, "Unexpected error %d connecting to %s at host %pI4h on port %d\n", + rc, libcfs_nid2str(peer_nid), &peer_ip, peer_port); break; } @@ -162,7 +148,7 @@ lnet_connect(socket_t **sockp, lnet_nid_t peer_nid, int port; int fatal; - CLASSERT (sizeof(cr) <= 16); /* not too big to be on the stack */ + CLASSERT(sizeof(cr) <= 16); /* not too big to be on the stack */ for (port = LNET_ACCEPTOR_MAX_RESERVED_PORT; port >= LNET_ACCEPTOR_MIN_RESERVED_PORT; @@ -178,7 +164,7 @@ lnet_connect(socket_t **sockp, lnet_nid_t peer_nid, continue; } - CLASSERT (LNET_PROTO_ACCEPTOR_VERSION == 1); + CLASSERT(LNET_PROTO_ACCEPTOR_VERSION == 1); cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; @@ -232,10 +218,10 @@ lnet_accept(socket_t *sock, __u32 magic) lnet_ni_t *ni; char *str; - LASSERT (sizeof(cr) <= 16); /* not too big for the stack */ + LASSERT(sizeof(cr) <= 16); /* not too big for the stack */ rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); - LASSERT (rc == 0); /* we succeeded before */ + LASSERT(rc == 0); /* we succeeded before */ if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) { @@ -245,15 +231,14 @@ lnet_accept(socket_t *sock, __u32 magic) * thing sent will be a version query. I send back * LNET_PROTO_ACCEPTOR_MAGIC to tell her I'm "old" */ - memset (&cr, 0, sizeof(cr)); + memset(&cr, 0, sizeof(cr)); cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; rc = libcfs_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) - CERROR("Error sending magic+version in response" - "to LNET magic from %pI4h: %d\n", + CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n", &peer_ip, rc); return -EPROTO; } @@ -265,8 +250,7 @@ lnet_accept(socket_t *sock, __u32 magic) else str = "unrecognised"; - LCONSOLE_ERROR_MSG(0x11f, "Refusing connection from %pI4h" - " magic %08x: %s acceptor protocol\n", + LCONSOLE_ERROR_MSG(0x11f, "Refusing connection from %pI4h magic %08x: %s acceptor protocol\n", &peer_ip, magic, str); return -EPROTO; } @@ -277,8 +261,8 @@ lnet_accept(socket_t *sock, __u32 magic) sizeof(cr.acr_version), accept_timeout); if (rc != 0) { - CERROR("Error %d reading connection request version from " - "%pI4h\n", rc, &peer_ip); + CERROR("Error %d reading connection request version from %pI4h\n", + rc, &peer_ip); return -EIO; } @@ -292,7 +276,7 @@ lnet_accept(socket_t *sock, __u32 magic) * "old". */ int peer_version = cr.acr_version; - memset (&cr, 0, sizeof(cr)); + memset(&cr, 0, sizeof(cr)); cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; @@ -300,8 +284,7 @@ lnet_accept(socket_t *sock, __u32 magic) accept_timeout); if (rc != 0) - CERROR("Error sending magic+version in response" - "to version %d from %pI4h: %d\n", + CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n", peer_version, &peer_ip, rc); return -EPROTO; } @@ -311,8 +294,8 @@ lnet_accept(socket_t *sock, __u32 magic) offsetof(lnet_acceptor_connreq_t, acr_nid), accept_timeout); if (rc != 0) { - CERROR("Error %d reading connection request from " - "%pI4h\n", rc, &peer_ip); + CERROR("Error %d reading connection request from %pI4h\n", + rc, &peer_ip); return -EIO; } @@ -324,8 +307,7 @@ lnet_accept(socket_t *sock, __u32 magic) ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */ if (ni != NULL) lnet_ni_decref(ni); - LCONSOLE_ERROR_MSG(0x120, "Refusing connection from %pI4h" - " for %s: No matching NI\n", + LCONSOLE_ERROR_MSG(0x120, "Refusing connection from %pI4h for %s: No matching NI\n", &peer_ip, libcfs_nid2str(cr.acr_nid)); return -EPERM; } @@ -333,8 +315,7 @@ lnet_accept(socket_t *sock, __u32 magic) if (ni->ni_lnd->lnd_accept == NULL) { /* This catches a request for the loopback LND */ lnet_ni_decref(ni); - LCONSOLE_ERROR_MSG(0x121, "Refusing connection from %pI4h" - " for %s: NI doesn not accept IP connections\n", + LCONSOLE_ERROR_MSG(0x121, "Refusing connection from %pI4h for %s: NI doesn not accept IP connections\n", &peer_ip, libcfs_nid2str(cr.acr_nid)); return -EPERM; } @@ -358,7 +339,7 @@ lnet_acceptor(void *arg) int peer_port; int secure = (int)((long_ptr_t)arg); - LASSERT (lnet_acceptor_state.pta_sock == NULL); + LASSERT(lnet_acceptor_state.pta_sock == NULL); cfs_block_allsigs(); @@ -366,12 +347,10 @@ lnet_acceptor(void *arg) 0, accept_port, accept_backlog); if (rc != 0) { if (rc == -EADDRINUSE) - LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port" - " %d: port already in use\n", + LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n", accept_port); else - LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port " - "%d: unexpected error %d\n", + LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port %d: unexpected error %d\n", accept_port, rc); lnet_acceptor_state.pta_sock = NULL; @@ -410,8 +389,7 @@ lnet_acceptor(void *arg) } if (secure && peer_port > LNET_ACCEPTOR_MAX_RESERVED_PORT) { - CERROR("Refusing connection from %pI4h: " - "insecure port %d\n", + CERROR("Refusing connection from %pI4h: insecure port %d\n", &peer_ip, peer_port); goto failed; } @@ -419,8 +397,8 @@ lnet_acceptor(void *arg) rc = libcfs_sock_read(newsock, &magic, sizeof(magic), accept_timeout); if (rc != 0) { - CERROR("Error %d reading connection request from " - "%pI4h\n", rc, &peer_ip); + CERROR("Error %d reading connection request from %pI4h\n", + rc, &peer_ip); goto failed; } @@ -430,7 +408,7 @@ lnet_acceptor(void *arg) continue; - failed: +failed: libcfs_sock_release(newsock); } @@ -469,7 +447,7 @@ lnet_acceptor_start(void) long rc2; long secure; - LASSERT (lnet_acceptor_state.pta_sock == NULL); + LASSERT(lnet_acceptor_state.pta_sock == NULL); rc = lnet_acceptor_get_tunables(); if (rc != 0) diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 28711e6e8b03..de323f779db8 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -43,7 +43,7 @@ typedef struct { /* tmp struct for parsing routes */ char ltb_text[0]; /* text buffer */ } lnet_text_buf_t; -static int lnet_tbnob = 0; /* track text buf allocation */ +static int lnet_tbnob; /* track text buf allocation */ #define LNET_MAX_TEXTBUF_NOB (64<<10) /* bound allocation */ #define LNET_SINGLE_TEXTBUF_NOB (4<<10) @@ -65,7 +65,7 @@ lnet_syntax(char *name, char *str, int offset, int width) } int -lnet_issep (char c) +lnet_issep(char c) { switch (c) { case '\n': @@ -83,7 +83,7 @@ lnet_net_unique(__u32 net, struct list_head *nilist) struct list_head *tmp; lnet_ni_t *ni; - list_for_each (tmp, nilist) { + list_for_each(tmp, nilist) { ni = list_entry(tmp, lnet_ni_t, ni_list); if (LNET_NIDNET(ni->ni_nid) == net) @@ -188,8 +188,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks) if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) { /* _WAY_ conservative */ - LCONSOLE_ERROR_MSG(0x112, "Can't parse networks: string too " - "long\n"); + LCONSOLE_ERROR_MSG(0x112, + "Can't parse networks: string too long\n"); return -EINVAL; } @@ -201,7 +201,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks) the_lnet.ln_network_tokens = tokens; the_lnet.ln_network_tokens_nob = tokensize; - memcpy (tokens, networks, tokensize); + memcpy(tokens, networks, tokensize); str = tmp = tokens; /* Add in the loopback network */ @@ -255,8 +255,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks) net = libcfs_str2net(cfs_trimwhite(str)); if (net == LNET_NIDNET(LNET_NID_ANY)) { - LCONSOLE_ERROR_MSG(0x113, "Unrecognised network" - " type\n"); + LCONSOLE_ERROR_MSG(0x113, + "Unrecognised network type\n"); tmp = str; goto failed_syntax; } @@ -313,8 +313,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks) } if (niface == LNET_MAX_INTERFACES) { - LCONSOLE_ERROR_MSG(0x115, "Too many interfaces " - "for net %s\n", + LCONSOLE_ERROR_MSG(0x115, + "Too many interfaces for net %s\n", libcfs_net2str(net)); goto failed; } @@ -366,7 +366,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks) } lnet_text_buf_t * -lnet_new_text_buf (int str_len) +lnet_new_text_buf(int str_len) { lnet_text_buf_t *ltb; int nob; @@ -395,7 +395,7 @@ lnet_new_text_buf (int str_len) } void -lnet_free_text_buf (lnet_text_buf_t *ltb) +lnet_free_text_buf(lnet_text_buf_t *ltb) { lnet_tbnob -= ltb->ltb_size; LIBCFS_FREE(ltb, ltb->ltb_size); @@ -420,7 +420,7 @@ lnet_print_text_bufs(struct list_head *tbs) struct list_head *tmp; lnet_text_buf_t *ltb; - list_for_each (tmp, tbs) { + list_for_each(tmp, tbs) { ltb = list_entry(tmp, lnet_text_buf_t, ltb_list); CDEBUG(D_WARNING, "%s\n", ltb->ltb_text); @@ -430,7 +430,7 @@ lnet_print_text_bufs(struct list_head *tbs) } int -lnet_str2tbs_sep (struct list_head *tbs, char *str) +lnet_str2tbs_sep(struct list_head *tbs, char *str) { struct list_head pending; char *sep; @@ -488,7 +488,7 @@ lnet_str2tbs_sep (struct list_head *tbs, char *str) } int -lnet_expand1tb (struct list_head *list, +lnet_expand1tb(struct list_head *list, char *str, char *sep1, char *sep2, char *item, int itemlen) { @@ -496,8 +496,8 @@ lnet_expand1tb (struct list_head *list, int len2 = strlen(sep2 + 1); lnet_text_buf_t *ltb; - LASSERT (*sep1 == '['); - LASSERT (*sep2 == ']'); + LASSERT(*sep1 == '['); + LASSERT(*sep2 == ']'); ltb = lnet_new_text_buf(len1 + itemlen + len2); if (ltb == NULL) @@ -513,7 +513,7 @@ lnet_expand1tb (struct list_head *list, } int -lnet_str2tbs_expand (struct list_head *tbs, char *str) +lnet_str2tbs_expand(struct list_head *tbs, char *str) { char num[16]; struct list_head pending; @@ -593,7 +593,7 @@ lnet_str2tbs_expand (struct list_head *tbs, char *str) } int -lnet_parse_hops (char *str, unsigned int *hops) +lnet_parse_hops(char *str, unsigned int *hops) { int len = strlen(str); int nob = len; @@ -605,7 +605,7 @@ lnet_parse_hops (char *str, unsigned int *hops) int -lnet_parse_route (char *str, int *im_a_router) +lnet_parse_route(char *str, int *im_a_router) { /* static scratch buffer OK (single threaded) */ static char cmd[LNET_SINGLE_TEXTBUF_NOB]; @@ -702,28 +702,27 @@ lnet_parse_route (char *str, int *im_a_router) if (!got_hops) hops = 1; - LASSERT (!list_empty(&nets)); - LASSERT (!list_empty(&gateways)); + LASSERT(!list_empty(&nets)); + LASSERT(!list_empty(&gateways)); - list_for_each (tmp1, &nets) { + list_for_each(tmp1, &nets) { ltb = list_entry(tmp1, lnet_text_buf_t, ltb_list); net = libcfs_str2net(ltb->ltb_text); - LASSERT (net != LNET_NIDNET(LNET_NID_ANY)); + LASSERT(net != LNET_NIDNET(LNET_NID_ANY)); - list_for_each (tmp2, &gateways) { + list_for_each(tmp2, &gateways) { ltb = list_entry(tmp2, lnet_text_buf_t, ltb_list); nid = libcfs_str2nid(ltb->ltb_text); - LASSERT (nid != LNET_NID_ANY); + LASSERT(nid != LNET_NID_ANY); if (lnet_islocalnid(nid)) { *im_a_router = 1; continue; } - rc = lnet_add_route (net, hops, nid); + rc = lnet_add_route(net, hops, nid); if (rc != 0) { - CERROR("Can't create route " - "to %s via %s\n", + CERROR("Can't create route to %s via %s\n", libcfs_net2str(net), libcfs_nid2str(nid)); goto out; @@ -763,7 +762,7 @@ lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router) } int -lnet_parse_routes (char *routes, int *im_a_router) +lnet_parse_routes(char *routes, int *im_a_router) { struct list_head tbs; int rc = 0; @@ -779,14 +778,14 @@ lnet_parse_routes (char *routes, int *im_a_router) rc = lnet_parse_route_tbs(&tbs, im_a_router); } - LASSERT (lnet_tbnob == 0); + LASSERT(lnet_tbnob == 0); return rc; } int lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip) { - LIST_HEAD (list); + LIST_HEAD(list); int rc; int i; @@ -815,7 +814,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) char *token; int rc; - LASSERT (strlen(net_entry) < sizeof(tokens)); + LASSERT(strlen(net_entry) < sizeof(tokens)); /* work on a copy of the string */ strcpy(tokens, net_entry); @@ -889,8 +888,8 @@ lnet_splitnets(char *source, struct list_head *nets) char *bracket; __u32 net; - LASSERT (!list_empty(nets)); - LASSERT (nets->next == nets->prev); /* single entry */ + LASSERT(!list_empty(nets)); + LASSERT(nets->next == nets->prev); /* single entry */ tb = list_entry(nets->next, lnet_text_buf_t, ltb_list); @@ -957,7 +956,7 @@ lnet_splitnets(char *source, struct list_head *nets) } int -lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) +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]; @@ -979,7 +978,7 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) INIT_LIST_HEAD(&raw_entries); if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) { CERROR("Error parsing ip2nets\n"); - LASSERT (lnet_tbnob == 0); + LASSERT(lnet_tbnob == 0); return -EINVAL; } @@ -1017,16 +1016,16 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) break; dup = 0; - list_for_each (t, ¤t_nets) { + list_for_each(t, ¤t_nets) { tb = list_entry(t, lnet_text_buf_t, ltb_list); net1 = lnet_netspec2net(tb->ltb_text); - LASSERT (net1 != LNET_NIDNET(LNET_NID_ANY)); + LASSERT(net1 != LNET_NIDNET(LNET_NID_ANY)); list_for_each(t2, &matched_nets) { tb2 = list_entry(t2, lnet_text_buf_t, ltb_list); net2 = lnet_netspec2net(tb2->ltb_text); - LASSERT (net2 != LNET_NIDNET(LNET_NID_ANY)); + LASSERT(net2 != LNET_NIDNET(LNET_NID_ANY)); if (net1 == net2) { dup = 1; @@ -1067,7 +1066,7 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) lnet_free_text_bufs(&raw_entries); lnet_free_text_bufs(&matched_nets); lnet_free_text_bufs(¤t_nets); - LASSERT (lnet_tbnob == 0); + LASSERT(lnet_tbnob == 0); if (rc < 0) return rc; @@ -1083,7 +1082,7 @@ lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip) } int -lnet_ipaddr_enumerate (__u32 **ipaddrsp) +lnet_ipaddr_enumerate(__u32 **ipaddrsp) { int up; __u32 netmask; @@ -1149,21 +1148,22 @@ lnet_ipaddr_enumerate (__u32 **ipaddrsp) } int -lnet_parse_ip2nets (char **networksp, char *ip2nets) +lnet_parse_ip2nets(char **networksp, char *ip2nets) { __u32 *ipaddrs; int nip = lnet_ipaddr_enumerate(&ipaddrs); int rc; if (nip < 0) { - LCONSOLE_ERROR_MSG(0x117, "Error %d enumerating local IP " - "interfaces for ip2nets to match\n", nip); + LCONSOLE_ERROR_MSG(0x117, + "Error %d enumerating local IP interfaces for ip2nets to match\n", + nip); return nip; } if (nip == 0) { - LCONSOLE_ERROR_MSG(0x118, "No local IP interfaces " - "for ip2nets to match\n"); + LCONSOLE_ERROR_MSG(0x118, + "No local IP interfaces for ip2nets to match\n"); return -ENOENT; } @@ -1176,8 +1176,8 @@ lnet_parse_ip2nets (char **networksp, char *ip2nets) } if (rc == 0) { - LCONSOLE_ERROR_MSG(0x11a, "ip2nets does not match " - "any local IP interfaces\n"); + LCONSOLE_ERROR_MSG(0x11a, + "ip2nets does not match any local IP interfaces\n"); return -ENOENT; } @@ -1185,7 +1185,7 @@ lnet_parse_ip2nets (char **networksp, char *ip2nets) } int -lnet_set_ip_niaddr (lnet_ni_t *ni) +lnet_set_ip_niaddr(lnet_ni_t *ni) { __u32 net = LNET_NIDNET(ni->ni_nid); char **names; @@ -1201,7 +1201,7 @@ lnet_set_ip_niaddr (lnet_ni_t *ni) if (ni->ni_interfaces[0] != NULL) { - CLASSERT (LNET_MAX_INTERFACES > 1); + CLASSERT(LNET_MAX_INTERFACES > 1); if (ni->ni_interfaces[1] != NULL) { CERROR("Net %s doesn't support multiple interfaces\n", diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 49b0f1287a69..b6f8ad38628b 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -47,14 +47,14 @@ CFS_MODULE_PARM(local_nid_dist_zero, "i", int, 0444, "Reserved"); int -lnet_fail_nid (lnet_nid_t nid, unsigned int threshold) +lnet_fail_nid(lnet_nid_t nid, unsigned int threshold) { lnet_test_peer_t *tp; struct list_head *el; struct list_head *next; struct list_head cull; - LASSERT (the_lnet.ln_init); + LASSERT(the_lnet.ln_init); /* NB: use lnet_net_lock(0) to serialize operations on test peers */ if (threshold != 0) { @@ -77,31 +77,30 @@ lnet_fail_nid (lnet_nid_t nid, unsigned int threshold) lnet_net_lock(0); - list_for_each_safe (el, next, &the_lnet.ln_test_peers) { - tp = list_entry (el, lnet_test_peer_t, tp_list); + list_for_each_safe(el, next, &the_lnet.ln_test_peers) { + tp = list_entry(el, lnet_test_peer_t, tp_list); if (tp->tp_threshold == 0 || /* needs culling anyway */ nid == LNET_NID_ANY || /* removing all entries */ - tp->tp_nid == nid) /* matched this one */ - { - list_del (&tp->tp_list); - list_add (&tp->tp_list, &cull); + tp->tp_nid == nid) { /* matched this one */ + list_del(&tp->tp_list); + list_add(&tp->tp_list, &cull); } } lnet_net_unlock(0); - while (!list_empty (&cull)) { - tp = list_entry (cull.next, lnet_test_peer_t, tp_list); + while (!list_empty(&cull)) { + tp = list_entry(cull.next, lnet_test_peer_t, tp_list); - list_del (&tp->tp_list); - LIBCFS_FREE(tp, sizeof (*tp)); + list_del(&tp->tp_list); + LIBCFS_FREE(tp, sizeof(*tp)); } return 0; } static int -fail_peer (lnet_nid_t nid, int outgoing) +fail_peer(lnet_nid_t nid, int outgoing) { lnet_test_peer_t *tp; struct list_head *el; @@ -109,13 +108,13 @@ fail_peer (lnet_nid_t nid, int outgoing) struct list_head cull; int fail = 0; - INIT_LIST_HEAD (&cull); + INIT_LIST_HEAD(&cull); /* NB: use lnet_net_lock(0) to serialize operations on test peers */ lnet_net_lock(0); - list_for_each_safe (el, next, &the_lnet.ln_test_peers) { - tp = list_entry (el, lnet_test_peer_t, tp_list); + list_for_each_safe(el, next, &the_lnet.ln_test_peers) { + tp = list_entry(el, lnet_test_peer_t, tp_list); if (tp->tp_threshold == 0) { /* zombie entry */ @@ -123,8 +122,8 @@ fail_peer (lnet_nid_t nid, int outgoing) /* only cull zombies on outgoing tests, * since we may be at interrupt priority on * incoming messages. */ - list_del (&tp->tp_list); - list_add (&tp->tp_list, &cull); + list_del(&tp->tp_list); + list_add(&tp->tp_list, &cull); } continue; } @@ -138,8 +137,8 @@ fail_peer (lnet_nid_t nid, int outgoing) if (outgoing && tp->tp_threshold == 0) { /* see above */ - list_del (&tp->tp_list); - list_add (&tp->tp_list, &cull); + list_del(&tp->tp_list); + list_add(&tp->tp_list, &cull); } } break; @@ -148,30 +147,30 @@ fail_peer (lnet_nid_t nid, int outgoing) lnet_net_unlock(0); - while (!list_empty (&cull)) { - tp = list_entry (cull.next, lnet_test_peer_t, tp_list); - list_del (&tp->tp_list); + while (!list_empty(&cull)) { + tp = list_entry(cull.next, lnet_test_peer_t, tp_list); + list_del(&tp->tp_list); - LIBCFS_FREE(tp, sizeof (*tp)); + LIBCFS_FREE(tp, sizeof(*tp)); } - return (fail); + return fail; } unsigned int -lnet_iov_nob (unsigned int niov, struct iovec *iov) +lnet_iov_nob(unsigned int niov, struct iovec *iov) { unsigned int nob = 0; while (niov-- > 0) nob += (iov++)->iov_len; - return (nob); + return nob; } EXPORT_SYMBOL(lnet_iov_nob); void -lnet_copy_iov2iov (unsigned int ndiov, struct iovec *diov, unsigned int doffset, +lnet_copy_iov2iov(unsigned int ndiov, struct iovec *diov, unsigned int doffset, unsigned int nsiov, struct iovec *siov, unsigned int soffset, unsigned int nob) { @@ -182,31 +181,31 @@ lnet_copy_iov2iov (unsigned int ndiov, struct iovec *diov, unsigned int doffset, return; /* skip complete frags before 'doffset' */ - LASSERT (ndiov > 0); + LASSERT(ndiov > 0); while (doffset >= diov->iov_len) { doffset -= diov->iov_len; diov++; ndiov--; - LASSERT (ndiov > 0); + LASSERT(ndiov > 0); } /* skip complete frags before 'soffset' */ - LASSERT (nsiov > 0); + LASSERT(nsiov > 0); while (soffset >= siov->iov_len) { soffset -= siov->iov_len; siov++; nsiov--; - LASSERT (nsiov > 0); + LASSERT(nsiov > 0); } do { - LASSERT (ndiov > 0); - LASSERT (nsiov > 0); + LASSERT(ndiov > 0); + LASSERT(nsiov > 0); this_nob = MIN(diov->iov_len - doffset, siov->iov_len - soffset); this_nob = MIN(this_nob, nob); - memcpy ((char *)diov->iov_base + doffset, + memcpy((char *)diov->iov_base + doffset, (char *)siov->iov_base + soffset, this_nob); nob -= this_nob; @@ -230,7 +229,7 @@ lnet_copy_iov2iov (unsigned int ndiov, struct iovec *diov, unsigned int doffset, EXPORT_SYMBOL(lnet_copy_iov2iov); int -lnet_extract_iov (int dst_niov, struct iovec *dst, +lnet_extract_iov(int dst_niov, struct iovec *dst, int src_niov, struct iovec *src, unsigned int offset, unsigned int len) { @@ -241,27 +240,27 @@ lnet_extract_iov (int dst_niov, struct iovec *dst, unsigned int niov; if (len == 0) /* no data => */ - return (0); /* no frags */ + return 0; /* no frags */ - LASSERT (src_niov > 0); + LASSERT(src_niov > 0); while (offset >= src->iov_len) { /* skip initial frags */ offset -= src->iov_len; src_niov--; src++; - LASSERT (src_niov > 0); + LASSERT(src_niov > 0); } niov = 1; for (;;) { - LASSERT (src_niov > 0); - LASSERT ((int)niov <= dst_niov); + LASSERT(src_niov > 0); + LASSERT((int)niov <= dst_niov); frag_len = src->iov_len - offset; dst->iov_base = ((char *)src->iov_base) + offset; if (len <= frag_len) { dst->iov_len = len; - return (niov); + return niov; } dst->iov_len = frag_len; @@ -278,21 +277,21 @@ EXPORT_SYMBOL(lnet_extract_iov); unsigned int -lnet_kiov_nob (unsigned int niov, lnet_kiov_t *kiov) +lnet_kiov_nob(unsigned int niov, lnet_kiov_t *kiov) { unsigned int nob = 0; while (niov-- > 0) nob += (kiov++)->kiov_len; - return (nob); + return nob; } EXPORT_SYMBOL(lnet_kiov_nob); void -lnet_copy_kiov2kiov (unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset, - unsigned int nsiov, lnet_kiov_t *siov, unsigned int soffset, - unsigned int nob) +lnet_copy_kiov2kiov(unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset, + unsigned int nsiov, lnet_kiov_t *siov, unsigned int soffset, + unsigned int nob) { /* NB diov, siov are READ-ONLY */ unsigned int this_nob; @@ -302,27 +301,27 @@ lnet_copy_kiov2kiov (unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset if (nob == 0) return; - LASSERT (!in_interrupt ()); + LASSERT(!in_interrupt()); - LASSERT (ndiov > 0); + LASSERT(ndiov > 0); while (doffset >= diov->kiov_len) { doffset -= diov->kiov_len; diov++; ndiov--; - LASSERT (ndiov > 0); + LASSERT(ndiov > 0); } - LASSERT (nsiov > 0); + LASSERT(nsiov > 0); while (soffset >= siov->kiov_len) { soffset -= siov->kiov_len; siov++; nsiov--; - LASSERT (nsiov > 0); + LASSERT(nsiov > 0); } do { - LASSERT (ndiov > 0); - LASSERT (nsiov > 0); + LASSERT(ndiov > 0); + LASSERT(nsiov > 0); this_nob = MIN(diov->kiov_len - doffset, siov->kiov_len - soffset); this_nob = MIN(this_nob, nob); @@ -338,7 +337,7 @@ lnet_copy_kiov2kiov (unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset * However in practice at least one of the kiovs will be mapped * kernel pages and the map/unmap will be NOOPs */ - memcpy (daddr, saddr, this_nob); + memcpy(daddr, saddr, this_nob); nob -= this_nob; if (diov->kiov_len > doffset + this_nob) { @@ -372,9 +371,9 @@ lnet_copy_kiov2kiov (unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset EXPORT_SYMBOL(lnet_copy_kiov2kiov); void -lnet_copy_kiov2iov (unsigned int niov, struct iovec *iov, unsigned int iovoffset, - unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffset, - unsigned int nob) +lnet_copy_kiov2iov(unsigned int niov, struct iovec *iov, unsigned int iovoffset, + unsigned int nkiov, lnet_kiov_t *kiov, + unsigned int kiovoffset, unsigned int nob) { /* NB iov, kiov are READ-ONLY */ unsigned int this_nob; @@ -383,27 +382,27 @@ lnet_copy_kiov2iov (unsigned int niov, struct iovec *iov, unsigned int iovoffset if (nob == 0) return; - LASSERT (!in_interrupt ()); + LASSERT(!in_interrupt()); - LASSERT (niov > 0); + LASSERT(niov > 0); while (iovoffset >= iov->iov_len) { iovoffset -= iov->iov_len; iov++; niov--; - LASSERT (niov > 0); + LASSERT(niov > 0); } - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); while (kiovoffset >= kiov->kiov_len) { kiovoffset -= kiov->kiov_len; kiov++; nkiov--; - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); } do { - LASSERT (niov > 0); - LASSERT (nkiov > 0); + LASSERT(niov > 0); + LASSERT(nkiov > 0); this_nob = MIN(iov->iov_len - iovoffset, kiov->kiov_len - kiovoffset); this_nob = MIN(this_nob, nob); @@ -412,7 +411,7 @@ lnet_copy_kiov2iov (unsigned int niov, struct iovec *iov, unsigned int iovoffset addr = ((char *)kmap(kiov->kiov_page)) + kiov->kiov_offset + kiovoffset; - memcpy ((char *)iov->iov_base + iovoffset, addr, this_nob); + memcpy((char *)iov->iov_base + iovoffset, addr, this_nob); nob -= this_nob; if (iov->iov_len > iovoffset + this_nob) { @@ -442,9 +441,10 @@ lnet_copy_kiov2iov (unsigned int niov, struct iovec *iov, unsigned int iovoffset EXPORT_SYMBOL(lnet_copy_kiov2iov); void -lnet_copy_iov2kiov (unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffset, - unsigned int niov, struct iovec *iov, unsigned int iovoffset, - unsigned int nob) +lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov, + unsigned int kiovoffset, unsigned int niov, + struct iovec *iov, unsigned int iovoffset, + unsigned int nob) { /* NB kiov, iov are READ-ONLY */ unsigned int this_nob; @@ -453,27 +453,27 @@ lnet_copy_iov2kiov (unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffs if (nob == 0) return; - LASSERT (!in_interrupt ()); + LASSERT(!in_interrupt()); - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); while (kiovoffset >= kiov->kiov_len) { kiovoffset -= kiov->kiov_len; kiov++; nkiov--; - LASSERT (nkiov > 0); + LASSERT(nkiov > 0); } - LASSERT (niov > 0); + LASSERT(niov > 0); while (iovoffset >= iov->iov_len) { iovoffset -= iov->iov_len; iov++; niov--; - LASSERT (niov > 0); + LASSERT(niov > 0); } do { - LASSERT (nkiov > 0); - LASSERT (niov > 0); + LASSERT(nkiov > 0); + LASSERT(niov > 0); this_nob = MIN(kiov->kiov_len - kiovoffset, iov->iov_len - iovoffset); this_nob = MIN(this_nob, nob); @@ -482,7 +482,7 @@ lnet_copy_iov2kiov (unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffs addr = ((char *)kmap(kiov->kiov_page)) + kiov->kiov_offset + kiovoffset; - memcpy (addr, (char *)iov->iov_base + iovoffset, this_nob); + memcpy(addr, (char *)iov->iov_base + iovoffset, this_nob); nob -= this_nob; if (kiov->kiov_len > kiovoffset + this_nob) { @@ -511,7 +511,7 @@ lnet_copy_iov2kiov (unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffs EXPORT_SYMBOL(lnet_copy_iov2kiov); int -lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, +lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst, int src_niov, lnet_kiov_t *src, unsigned int offset, unsigned int len) { @@ -522,20 +522,20 @@ lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, unsigned int niov; if (len == 0) /* no data => */ - return (0); /* no frags */ + return 0; /* no frags */ - LASSERT (src_niov > 0); + LASSERT(src_niov > 0); while (offset >= src->kiov_len) { /* skip initial frags */ offset -= src->kiov_len; src_niov--; src++; - LASSERT (src_niov > 0); + LASSERT(src_niov > 0); } niov = 1; for (;;) { - LASSERT (src_niov > 0); - LASSERT ((int)niov <= dst_niov); + LASSERT(src_niov > 0); + LASSERT((int)niov <= dst_niov); frag_len = src->kiov_len - offset; dst->kiov_page = src->kiov_page; @@ -543,12 +543,13 @@ lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, if (len <= frag_len) { dst->kiov_len = len; - LASSERT (dst->kiov_offset + dst->kiov_len <= PAGE_CACHE_SIZE); - return (niov); + LASSERT(dst->kiov_offset + dst->kiov_len + <= PAGE_CACHE_SIZE); + return niov; } dst->kiov_len = frag_len; - LASSERT (dst->kiov_offset + dst->kiov_len <= PAGE_CACHE_SIZE); + LASSERT(dst->kiov_offset + dst->kiov_len <= PAGE_CACHE_SIZE); len -= frag_len; dst++; @@ -569,8 +570,8 @@ lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, lnet_kiov_t *kiov = NULL; int rc; - LASSERT (!in_interrupt ()); - LASSERT (mlen == 0 || msg != NULL); + LASSERT(!in_interrupt()); + LASSERT(mlen == 0 || msg != NULL); if (msg != NULL) { LASSERT(msg->msg_receiving); @@ -587,8 +588,8 @@ lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, iov = msg->msg_iov; kiov = msg->msg_kiov; - LASSERT (niov > 0); - LASSERT ((iov == NULL) != (kiov == NULL)); + LASSERT(niov > 0); + LASSERT((iov == NULL) != (kiov == NULL)); } } @@ -603,12 +604,12 @@ lnet_setpayloadbuffer(lnet_msg_t *msg) { lnet_libmd_t *md = msg->msg_md; - LASSERT (msg->msg_len > 0); - LASSERT (!msg->msg_routing); - LASSERT (md != NULL); - LASSERT (msg->msg_niov == 0); - LASSERT (msg->msg_iov == NULL); - LASSERT (msg->msg_kiov == NULL); + LASSERT(msg->msg_len > 0); + LASSERT(!msg->msg_routing); + LASSERT(md != NULL); + LASSERT(msg->msg_niov == 0); + LASSERT(msg->msg_iov == NULL); + LASSERT(msg->msg_kiov == NULL); msg->msg_niov = md->md_niov; if ((md->md_options & LNET_MD_KIOV) != 0) @@ -629,7 +630,7 @@ lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, if (len != 0) lnet_setpayloadbuffer(msg); - memset (&msg->msg_hdr, 0, sizeof (msg->msg_hdr)); + memset(&msg->msg_hdr, 0, sizeof(msg->msg_hdr)); msg->msg_hdr.type = cpu_to_le32(type); msg->msg_hdr.dest_nid = cpu_to_le64(target.nid); msg->msg_hdr.dest_pid = cpu_to_le32(target.pid); @@ -644,8 +645,8 @@ lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg) void *priv = msg->msg_private; int rc; - LASSERT (!in_interrupt ()); - LASSERT (LNET_NETTYP(LNET_NIDNET(ni->ni_nid)) == LOLND || + LASSERT(!in_interrupt()); + LASSERT(LNET_NETTYP(LNET_NIDNET(ni->ni_nid)) == LOLND || (msg->msg_txcredit && msg->msg_peertxcredit)); rc = (ni->ni_lnd->lnd_send)(ni, priv, msg); @@ -698,12 +699,12 @@ lnet_ni_query_locked(lnet_ni_t *ni, lnet_peer_t *lp) /* NB: always called with lnet_net_lock held */ static inline int -lnet_peer_is_alive (lnet_peer_t *lp, cfs_time_t now) +lnet_peer_is_alive(lnet_peer_t *lp, cfs_time_t now) { int alive; cfs_time_t deadline; - LASSERT (lnet_peer_aliveness_enabled(lp)); + LASSERT(lnet_peer_aliveness_enabled(lp)); /* Trust lnet_notify() if it has more recent aliveness news, but * ignore the initial assumed death (see lnet_peers_start_down()). @@ -731,7 +732,7 @@ lnet_peer_is_alive (lnet_peer_t *lp, cfs_time_t now) /* NB: returns 1 when alive, 0 when dead, negative when error; * may drop the lnet_net_lock */ int -lnet_peer_alive_locked (lnet_peer_t *lp) +lnet_peer_alive_locked(lnet_peer_t *lp) { cfs_time_t now = cfs_time_current(); @@ -809,7 +810,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send) } if (!msg->msg_peertxcredit) { - LASSERT ((lp->lp_txcredits < 0) == + LASSERT((lp->lp_txcredits < 0) == !list_empty(&lp->lp_txq)); msg->msg_peertxcredit = 1; @@ -873,7 +874,7 @@ lnet_msg2bufpool(lnet_msg_t *msg) } int -lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv) +lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) { /* lnet_parse is going to lnet_net_unlock immediately after this, so it * sets do_recv FALSE and I don't do the unlock/send/lock bit. I @@ -882,18 +883,18 @@ lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv) lnet_rtrbufpool_t *rbp; lnet_rtrbuf_t *rb; - LASSERT (msg->msg_iov == NULL); - LASSERT (msg->msg_kiov == NULL); - LASSERT (msg->msg_niov == 0); - LASSERT (msg->msg_routing); - LASSERT (msg->msg_receiving); - LASSERT (!msg->msg_sending); + LASSERT(msg->msg_iov == NULL); + LASSERT(msg->msg_kiov == NULL); + LASSERT(msg->msg_niov == 0); + LASSERT(msg->msg_routing); + LASSERT(msg->msg_receiving); + LASSERT(!msg->msg_sending); /* non-lnet_parse callers only receive delayed messages */ LASSERT(!do_recv || msg->msg_rx_delayed); if (!msg->msg_peerrtrcredit) { - LASSERT ((lp->lp_rtrcredits < 0) == + LASSERT((lp->lp_rtrcredits < 0) == !list_empty(&lp->lp_rtrq)); msg->msg_peerrtrcredit = 1; @@ -913,7 +914,7 @@ lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv) rbp = lnet_msg2bufpool(msg); if (!msg->msg_rtrcredit) { - LASSERT ((rbp->rbp_credits < 0) == + LASSERT((rbp->rbp_credits < 0) == !list_empty(&rbp->rbp_msgs)); msg->msg_rtrcredit = 1; @@ -930,7 +931,7 @@ lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv) } } - LASSERT (!list_empty(&rbp->rbp_bufs)); + LASSERT(!list_empty(&rbp->rbp_bufs)); rb = list_entry(rbp->rbp_bufs.next, lnet_rtrbuf_t, rb_list); list_del(&rb->rb_list); @@ -985,7 +986,7 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg) !list_empty(&txpeer->lp_txq)); txpeer->lp_txqnob -= msg->msg_len + sizeof(lnet_hdr_t); - LASSERT (txpeer->lp_txqnob >= 0); + LASSERT(txpeer->lp_txqnob >= 0); txpeer->lp_txcredits++; if (txpeer->lp_txcredits <= 0) { @@ -1020,11 +1021,11 @@ lnet_return_rx_credits_locked(lnet_msg_t *msg) /* NB If a msg ever blocks for a buffer in rbp_msgs, it stays * there until it gets one allocated, or aborts the wait * itself */ - LASSERT (msg->msg_kiov != NULL); + LASSERT(msg->msg_kiov != NULL); rb = list_entry(msg->msg_kiov, lnet_rtrbuf_t, rb_kiov[0]); rbp = rb->rb_pool; - LASSERT (rbp == lnet_msg2bufpool(msg)); + LASSERT(rbp == lnet_msg2bufpool(msg)); msg->msg_kiov = NULL; msg->msg_rtrcredit = 0; @@ -1172,10 +1173,10 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) * but we might want to use pre-determined router for ACK/REPLY * in the future */ /* NB: ni != NULL == interface pre-determined (ACK/REPLY) */ - LASSERT (msg->msg_txpeer == NULL); - LASSERT (!msg->msg_sending); - LASSERT (!msg->msg_target_is_router); - LASSERT (!msg->msg_receiving); + LASSERT(msg->msg_txpeer == NULL); + LASSERT(!msg->msg_sending); + LASSERT(!msg->msg_target_is_router); + LASSERT(!msg->msg_receiving); msg->msg_sending = 1; @@ -1200,7 +1201,7 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) libcfs_nid2str(src_nid)); return -EINVAL; } - LASSERT (!msg->msg_routing); + LASSERT(!msg->msg_routing); } /* Is this for someone on a local network? */ @@ -1249,7 +1250,7 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) /* ENOMEM or shutting down */ return rc; } - LASSERT (lp->lp_ni == src_ni); + LASSERT(lp->lp_ni == src_ni); } else { /* sending to a remote network */ lp = lnet_find_route_locked(src_ni, dst_nid, rtr_nid); @@ -1290,7 +1291,7 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) src_ni = lp->lp_ni; src_nid = src_ni->ni_nid; } else { - LASSERT (src_ni == lp->lp_ni); + LASSERT(src_ni == lp->lp_ni); lnet_ni_decref_locked(src_ni, cpt); } @@ -1311,9 +1312,9 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) /* 'lp' is our best choice of peer */ - LASSERT (!msg->msg_peertxcredit); - LASSERT (!msg->msg_txcredit); - LASSERT (msg->msg_txpeer == NULL); + LASSERT(!msg->msg_peertxcredit); + LASSERT(!msg->msg_txcredit); + LASSERT(msg->msg_txpeer == NULL); msg->msg_txpeer = lp; /* msg takes my ref on lp */ @@ -1509,7 +1510,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) return ENOENT; /* +ve: OK but no match */ } - LASSERT (md->md_offset == 0); + LASSERT(md->md_offset == 0); rlength = hdr->payload_length; mlength = MIN(rlength, (int)md->md_length); @@ -1614,31 +1615,31 @@ lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg) } char * -lnet_msgtyp2str (int type) +lnet_msgtyp2str(int type) { switch (type) { case LNET_MSG_ACK: - return ("ACK"); + return "ACK"; case LNET_MSG_PUT: - return ("PUT"); + return "PUT"; case LNET_MSG_GET: - return ("GET"); + return "GET"; case LNET_MSG_REPLY: - return ("REPLY"); + return "REPLY"; case LNET_MSG_HELLO: - return ("HELLO"); + return "HELLO"; default: - return ("<UNKNOWN>"); + return "<UNKNOWN>"; } } EXPORT_SYMBOL(lnet_msgtyp2str); void -lnet_print_hdr(lnet_hdr_t * hdr) +lnet_print_hdr(lnet_hdr_t *hdr) { lnet_process_id_t src = {0}; lnet_process_id_t dst = {0}; - char *type_str = lnet_msgtyp2str (hdr->type); + char *type_str = lnet_msgtyp2str(hdr->type); src.nid = hdr->src_nid; src.pid = hdr->src_pid; @@ -1709,7 +1710,7 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, __u32 payload_length; __u32 type; - LASSERT (!in_interrupt ()); + LASSERT(!in_interrupt()); type = le32_to_cpu(hdr->type); src_nid = le64_to_cpu(hdr->src_nid); @@ -1734,7 +1735,8 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, case LNET_MSG_PUT: case LNET_MSG_REPLY: - if (payload_length > (__u32)(for_me ? LNET_MAX_PAYLOAD : LNET_MTU)) { + if (payload_length > + (__u32)(for_me ? LNET_MAX_PAYLOAD : LNET_MTU)) { CERROR("%s, src %s: bad %s payload %d " "(%d max expected)\n", libcfs_nid2str(from_nid), @@ -1772,7 +1774,7 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, if (!for_me) { if (LNET_NIDNET(dest_nid) == LNET_NIDNET(ni->ni_nid)) { /* should have gone direct */ - CERROR ("%s, src %s: Bad dest nid %s " + CERROR("%s, src %s: Bad dest nid %s " "(should have been sent direct)\n", libcfs_nid2str(from_nid), libcfs_nid2str(src_nid), @@ -1783,7 +1785,7 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, if (lnet_islocalnid(dest_nid)) { /* dest is another local NI; sender should have used * this node's NID on its own network */ - CERROR ("%s, src %s: Bad dest nid %s " + CERROR("%s, src %s: Bad dest nid %s " "(it's my nid but on a different network)\n", libcfs_nid2str(from_nid), libcfs_nid2str(src_nid), @@ -1792,7 +1794,7 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, } if (rdma_req && type == LNET_MSG_GET) { - CERROR ("%s, src %s: Bad optimized GET for %s " + CERROR("%s, src %s: Bad optimized GET for %s " "(final destination must be me)\n", libcfs_nid2str(from_nid), libcfs_nid2str(src_nid), @@ -1801,7 +1803,7 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, } if (!the_lnet.ln_routing) { - CERROR ("%s, src %s: Dropping message for %s " + CERROR("%s, src %s: Dropping message for %s " "(routing not enabled)\n", libcfs_nid2str(from_nid), libcfs_nid2str(src_nid), @@ -1813,9 +1815,8 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, /* Message looks OK; we're not going to return an error, so we MUST * call back lnd_recv() come what may... */ - if (!list_empty (&the_lnet.ln_test_peers) && /* normally we don't */ - fail_peer (src_nid, 0)) /* shall we now? */ - { + if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */ + fail_peer(src_nid, 0)) { /* shall we now? */ CERROR("%s, src %s: Dropping %s to simulate failure\n", libcfs_nid2str(from_nid), libcfs_nid2str(src_nid), lnet_msgtyp2str(type)); @@ -1830,7 +1831,9 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, goto drop; } - /* msg zeroed in lnet_msg_alloc; i.e. flags all clear, pointers NULL etc */ + /* msg zeroed in lnet_msg_alloc; + * i.e. flags all clear, pointers NULL etc + */ msg->msg_type = type; msg->msg_private = private; @@ -1906,7 +1909,7 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, if (rc == 0) return 0; - LASSERT (rc == ENOENT); + LASSERT(rc == ENOENT); free_drop: LASSERT(msg->msg_md == NULL); @@ -2047,12 +2050,11 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack, int cpt; int rc; - LASSERT (the_lnet.ln_init); - LASSERT (the_lnet.ln_refcount > 0); + LASSERT(the_lnet.ln_init); + LASSERT(the_lnet.ln_refcount > 0); - if (!list_empty (&the_lnet.ln_test_peers) && /* normally we don't */ - fail_peer (target.nid, 1)) /* shall we now? */ - { + if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */ + fail_peer(target.nid, 1)) { /* shall we now? */ CERROR("Dropping PUT to %s: simulated failure\n", libcfs_id2str(target)); return -EIO; @@ -2113,9 +2115,9 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack, rc = lnet_send(self, msg, LNET_NID_ANY); if (rc != 0) { - CNETERR( "Error sending PUT to %s: %d\n", + CNETERR("Error sending PUT to %s: %d\n", libcfs_id2str(target), rc); - lnet_finalize (NULL, msg, rc); + lnet_finalize(NULL, msg, rc); } /* completion will be signalled by an event */ @@ -2124,7 +2126,7 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack, EXPORT_SYMBOL(LNetPut); lnet_msg_t * -lnet_create_reply_msg (lnet_ni_t *ni, lnet_msg_t *getmsg) +lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *getmsg) { /* The LND can DMA direct to the GET md (i.e. no REPLY msg). This * returns a msg for the LND to pass to lnet_finalize() when the sink @@ -2144,16 +2146,16 @@ lnet_create_reply_msg (lnet_ni_t *ni, lnet_msg_t *getmsg) cpt = lnet_cpt_of_cookie(getmd->md_lh.lh_cookie); lnet_res_lock(cpt); - LASSERT (getmd->md_refcount > 0); + LASSERT(getmd->md_refcount > 0); if (msg == NULL) { - CERROR ("%s: Dropping REPLY from %s: can't allocate msg\n", + CERROR("%s: Dropping REPLY from %s: can't allocate msg\n", libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id)); goto drop; } if (getmd->md_threshold == 0) { - CERROR ("%s: Dropping REPLY from %s for inactive MD %p\n", + CERROR("%s: Dropping REPLY from %s for inactive MD %p\n", libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id), getmd); lnet_res_unlock(cpt); @@ -2205,13 +2207,13 @@ lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *reply, unsigned int len) { /* Set the REPLY length, now the RDMA that elides the REPLY message has * completed and I know it. */ - LASSERT (reply != NULL); - LASSERT (reply->msg_type == LNET_MSG_GET); - LASSERT (reply->msg_ev.type == LNET_EVENT_REPLY); + LASSERT(reply != NULL); + LASSERT(reply->msg_type == LNET_MSG_GET); + LASSERT(reply->msg_ev.type == LNET_EVENT_REPLY); /* NB I trusted my peer to RDMA. If she tells me she's written beyond * the end of my buffer, I might as well be dead. */ - LASSERT (len <= reply->msg_ev.mlength); + LASSERT(len <= reply->msg_ev.mlength); reply->msg_ev.mlength = len; } @@ -2229,7 +2231,8 @@ EXPORT_SYMBOL(lnet_set_reply_msg_len); * * \param self,target,portal,match_bits,offset See the discussion in LNetPut(). * \param mdh A handle for the MD that describes the memory into which the - * requested data will be received. The MD must be "free floating" (See LNetMDBind()). + * requested data will be received. The MD must be "free floating" + * (See LNetMDBind()). * * \retval 0 Success, and only in this case events will be generated * and logged to EQ (if it exists) of the MD. @@ -2247,12 +2250,11 @@ LNetGet(lnet_nid_t self, lnet_handle_md_t mdh, int cpt; int rc; - LASSERT (the_lnet.ln_init); - LASSERT (the_lnet.ln_refcount > 0); + LASSERT(the_lnet.ln_init); + LASSERT(the_lnet.ln_refcount > 0); - if (!list_empty (&the_lnet.ln_test_peers) && /* normally we don't */ - fail_peer (target.nid, 1)) /* shall we now? */ - { + if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */ + fail_peer(target.nid, 1)) { /* shall we now? */ CERROR("Dropping GET to %s: simulated failure\n", libcfs_id2str(target)); return -EIO; @@ -2307,9 +2309,9 @@ LNetGet(lnet_nid_t self, lnet_handle_md_t mdh, rc = lnet_send(self, msg, LNET_NID_ANY); if (rc < 0) { - CNETERR( "Error sending GET to %s: %d\n", + CNETERR("Error sending GET to %s: %d\n", libcfs_id2str(target), rc); - lnet_finalize (NULL, msg, rc); + lnet_finalize(NULL, msg, rc); } /* completion will be signalled by an event */ @@ -2348,12 +2350,12 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) * keep order 0 free for 0@lo and order 1 free for a local NID * match */ - LASSERT (the_lnet.ln_init); - LASSERT (the_lnet.ln_refcount > 0); + LASSERT(the_lnet.ln_init); + LASSERT(the_lnet.ln_refcount > 0); cpt = lnet_net_lock_current(); - list_for_each (e, &the_lnet.ln_nis) { + list_for_each(e, &the_lnet.ln_nis) { ni = list_entry(e, lnet_ni_t, ni_list); if (ni->ni_nid == dstnid) { @@ -2390,7 +2392,7 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) lnet_route_t *route; lnet_route_t *shortest = NULL; - LASSERT (!list_empty(&rnet->lrn_routes)); + LASSERT(!list_empty(&rnet->lrn_routes)); list_for_each_entry(route, &rnet->lrn_routes, lr_list) { @@ -2399,7 +2401,7 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) shortest = route; } - LASSERT (shortest != NULL); + LASSERT(shortest != NULL); hops = shortest->lr_hops; if (srcnidp != NULL) *srcnidp = shortest->lr_gateway->lp_ni->ni_nid; diff --git a/drivers/staging/lustre/lnet/lnet/lo.c b/drivers/staging/lustre/lnet/lnet/lo.c index 670dae34107c..efc798e01934 100644 --- a/drivers/staging/lustre/lnet/lnet/lo.c +++ b/drivers/staging/lustre/lnet/lnet/lo.c @@ -36,16 +36,16 @@ #include <linux/lnet/lib-lnet.h> int -lolnd_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) +lolnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) { - LASSERT (!lntmsg->msg_routing); - LASSERT (!lntmsg->msg_target_is_router); + LASSERT(!lntmsg->msg_routing); + LASSERT(!lntmsg->msg_target_is_router); return lnet_parse(ni, &lntmsg->msg_hdr, ni->ni_nid, lntmsg, 0); } int -lolnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, +lolnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, unsigned int niov, struct iovec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) @@ -89,20 +89,20 @@ static int lolnd_instanced; void lolnd_shutdown(lnet_ni_t *ni) { - CDEBUG (D_NET, "shutdown\n"); - LASSERT (lolnd_instanced); + CDEBUG(D_NET, "shutdown\n"); + LASSERT(lolnd_instanced); lolnd_instanced = 0; } int -lolnd_startup (lnet_ni_t *ni) +lolnd_startup(lnet_ni_t *ni) { - LASSERT (ni->ni_lnd == &the_lolnd); - LASSERT (!lolnd_instanced); + LASSERT(ni->ni_lnd == &the_lolnd); + LASSERT(!lolnd_instanced); lolnd_instanced = 1; - return (0); + return 0; } lnd_t the_lolnd = { diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index afb81755cbad..6db8774ff7b7 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -37,14 +37,14 @@ #define DEBUG_SUBSYSTEM S_LNET #include <linux/lnet/lib-lnet.h> -static int config_on_load = 0; +static int config_on_load; CFS_MODULE_PARM(config_on_load, "i", int, 0444, "configure network at module load"); static struct mutex lnet_config_mutex; int -lnet_configure (void *arg) +lnet_configure(void *arg) { /* 'arg' only there so I can be passed to cfs_create_thread() */ int rc = 0; @@ -64,7 +64,7 @@ lnet_configure (void *arg) } int -lnet_unconfigure (void) +lnet_unconfigure(void) { int refcount; @@ -124,7 +124,7 @@ init_lnet(void) } rc = libcfs_register_ioctl(&lnet_ioctl_handler); - LASSERT (rc == 0); + LASSERT(rc == 0); if (config_on_load) { /* Have to schedule a separate thread to avoid deadlocking @@ -141,7 +141,7 @@ fini_lnet(void) int rc; rc = libcfs_deregister_ioctl(&lnet_ioctl_handler); - LASSERT (rc == 0); + LASSERT(rc == 0); LNetFini(); } diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index 931f6ca25dc7..5e47de36c184 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -30,7 +30,7 @@ /* This is really lnet_proc.c. You might need to update sanity test 215 * if any file format is changed. */ -static ctl_table_header_t *lnet_table_header = NULL; +static ctl_table_header_t *lnet_table_header; #define CTL_LNET (0x100) enum { @@ -158,7 +158,7 @@ int LL_PROC_PROTO(proc_lnet_routes) off = LNET_PROC_HOFF_GET(*ppos); ver = LNET_PROC_VER_GET(*ppos); - LASSERT (!write); + LASSERT(!write); if (*lenp == 0) return 0; @@ -172,11 +172,11 @@ int LL_PROC_PROTO(proc_lnet_routes) if (*ppos == 0) { s += snprintf(s, tmpstr + tmpsiz - s, "Routing %s\n", the_lnet.ln_routing ? "enabled" : "disabled"); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); s += snprintf(s, tmpstr + tmpsiz - s, "%-8s %4s %7s %s\n", "net", "hops", "state", "router"); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); lnet_net_lock(0); ver = (unsigned int)the_lnet.ln_remote_nets_version; @@ -281,7 +281,7 @@ int LL_PROC_PROTO(proc_lnet_routers) off = LNET_PROC_HOFF_GET(*ppos); ver = LNET_PROC_VER_GET(*ppos); - LASSERT (!write); + LASSERT(!write); if (*lenp == 0) return 0; @@ -375,7 +375,7 @@ int LL_PROC_PROTO(proc_lnet_routers) pingsent, cfs_duration_sec(cfs_time_sub(deadline, now)), down_ni, libcfs_nid2str(nid)); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); } lnet_net_unlock(0); @@ -437,7 +437,7 @@ int LL_PROC_PROTO(proc_lnet_peers) "%-24s %4s %5s %5s %5s %5s %5s %5s %5s %s\n", "nid", "refs", "state", "last", "max", "rtr", "min", "tx", "min", "queue"); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); hoff++; } else { @@ -534,7 +534,7 @@ int LL_PROC_PROTO(proc_lnet_peers) libcfs_nid2str(nid), nrefs, aliveness, lastalive, maxcr, rtrcr, minrtrcr, txcr, mintxcr, txqnob); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); } else { /* peer is NULL */ lnet_net_unlock(cpt); @@ -592,7 +592,7 @@ static int __proc_lnet_buffers(void *data, int write, s += snprintf(s, tmpstr + tmpsiz - s, "%5s %5s %7s %7s\n", "pages", "count", "credits", "min"); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); if (the_lnet.ln_rtrpools == NULL) goto out; /* I'm not a router */ @@ -638,7 +638,7 @@ int LL_PROC_PROTO(proc_lnet_nis) DECLARE_LL_PROC_PPOS_DECL; - LASSERT (!write); + LASSERT(!write); if (*lenp == 0) return 0; @@ -654,7 +654,7 @@ int LL_PROC_PROTO(proc_lnet_nis) "%-24s %6s %5s %4s %4s %4s %5s %5s %5s\n", "nid", "status", "alive", "refs", "peer", "rtr", "max", "tx", "min"); - LASSERT (tmpstr + tmpsiz - s > 0); + LASSERT(tmpstr + tmpsiz - s > 0); } else { struct list_head *n; lnet_ni_t *ni = NULL; |