From 2ae523d130599901f372f5d7b2b1df40cf5788c5 Mon Sep 17 00:00:00 2001 From: isaac Date: Wed, 11 Nov 2009 18:37:03 +0000 Subject: [PATCH] i=maxim,b=15332,b=18460: - format and style updates; avoid 64bit division on 32bit systems. --- lnet/include/lnet/lib-lnet.h | 3 --- lnet/lnet/lib-md.c | 2 +- lnet/lnet/router.c | 8 ++++---- lnet/lnet/router_proc.c | 15 +++++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index fcec6cc..f26a857 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -705,9 +705,6 @@ void lnet_get_tunables(void); int lnet_peers_start_down(void); int lnet_peer_buffer_credits(lnet_ni_t *ni); -extern int router_ping_timeout; -extern int dead_router_check_interval; -extern int live_router_check_interval; int lnet_router_checker_start(void); void lnet_router_checker_stop(void); void lnet_swap_pinginfo(lnet_ping_info_t *info); diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index db6edea..7f441aa 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -222,7 +222,7 @@ lnet_md_validate(lnet_md_t *umd) if ((umd->options & (LNET_MD_KIOV | LNET_MD_IOVEC)) != 0 && umd->length > LNET_MAX_IOV) { - CERROR("Invalid option: too many fragments %d, %d max\n", + CERROR("Invalid option: too many fragments %u, %d max\n", umd->length, LNET_MAX_IOV); return -EINVAL; } diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index 369a80b..bdb58cb 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -81,15 +81,15 @@ static int avoid_asym_router_failure = 0; CFS_MODULE_PARM(avoid_asym_router_failure, "i", int, 0444, "Avoid asymmetrical failures: reserved, use at your own risk"); -int dead_router_check_interval = 0; +static int dead_router_check_interval = 0; CFS_MODULE_PARM(dead_router_check_interval, "i", int, 0444, "Seconds between dead router health checks (<= 0 to disable)"); -int live_router_check_interval = 0; +static int live_router_check_interval = 0; CFS_MODULE_PARM(live_router_check_interval, "i", int, 0444, "Seconds between live router health checks (<= 0 to disable)"); -int router_ping_timeout = 50; +static int router_ping_timeout = 50; CFS_MODULE_PARM(router_ping_timeout, "i", int, 0444, "Seconds to wait for the reply to a router health query"); @@ -251,7 +251,7 @@ lnet_add_route_to_rnet (lnet_remotenet_t *rnet, lnet_route_t *route) /* FIXME use Lustre random function when it's moved to libcfs. * See bug 18751 */ /* len+1 positions to add a new entry, also prevents division by 0 */ - offset = lnet_create_interface_cookie() % (len + 1); + offset = ((unsigned int) lnet_create_interface_cookie()) % (len + 1); list_for_each (e, &rnet->lrn_routes) { if (offset == 0) break; diff --git a/lnet/lnet/router_proc.c b/lnet/lnet/router_proc.c index b38c5e7..76d82b3 100644 --- a/lnet/lnet/router_proc.c +++ b/lnet/lnet/router_proc.c @@ -280,8 +280,10 @@ int LL_PROC_PROTO(proc_lnet_routers) int alive_cnt = peer->lp_alive_count; int alive = peer->lp_alive; int pingsent = !peer->lp_ping_notsent; - int last_ping = cfs_duration_sec(now - peer->lp_ping_timestamp); - int down_ni = lnet_router_down_ni(peer, LNET_NIDNET(LNET_NID_ANY)); + int last_ping = cfs_duration_sec(cfs_time_sub(now, + peer->lp_ping_timestamp)); + int down_ni = lnet_router_down_ni(peer, + LNET_NIDNET(LNET_NID_ANY)); if (deadline == 0) s += snprintf(s, tmpstr + tmpsiz - s, @@ -296,7 +298,7 @@ int LL_PROC_PROTO(proc_lnet_routers) nrefs, nrtrrefs, alive_cnt, alive ? "up" : "down", last_ping, pingsent, - cfs_duration_sec(deadline - now), + cfs_duration_sec(cfs_time_sub(deadline, now)), down_ni, libcfs_nid2str(nid)); LASSERT (tmpstr + tmpsiz - s > 0); } @@ -581,6 +583,7 @@ int LL_PROC_PROTO(proc_lnet_nis) if (ni != NULL) { cfs_time_t now = cfs_time_current(); + int last_alive = -1; int maxtxcr = ni->ni_maxtxcredits; int txcr = ni->ni_txcredits; int mintxcr = ni->ni_mintxcredits; @@ -588,11 +591,11 @@ int LL_PROC_PROTO(proc_lnet_nis) int npeerrtrcr = ni->ni_peerrtrcredits; lnet_nid_t nid = ni->ni_nid; int nref = ni->ni_refcount; - int last_alive; char *stat; - last_alive = (the_lnet.ln_routing) ? - cfs_duration_sec(now - ni->ni_last_alive) : -1; + if (the_lnet.ln_routing) + last_alive = cfs_duration_sec(cfs_time_sub(now, + ni->ni_last_alive)); if (ni->ni_lnd->lnd_type == LOLND) /* @lo forever alive */ last_alive = 0; -- 1.8.3.1