From 03ff4ee6484faf914cadbbffedbcd0057708625a Mon Sep 17 00:00:00 2001 From: isaac Date: Thu, 3 Jul 2008 04:42:07 +0000 Subject: [PATCH 1/1] - removed trailing spaces and converted tabs. --- lnet/include/lnet/lib-types.h | 2 +- lnet/klnds/o2iblnd/o2iblnd.c | 8 ++-- lnet/klnds/o2iblnd/o2iblnd.h | 4 +- lnet/klnds/o2iblnd/o2iblnd_cb.c | 22 +++++------ lnet/lnet/lib-eq.c | 34 ++++++++--------- lnet/lnet/router.c | 83 ++++++++++++++++++++--------------------- lnet/selftest/rpc.c | 4 +- 7 files changed, 78 insertions(+), 79 deletions(-) diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index c03810e..7a06a28 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -320,7 +320,7 @@ typedef struct lnet_lnd * for success and do NOT give back a receive credit; that has to wait * until lnd_recv() gets called. On failure return < 0 and * release resources; lnd_recv() will not be called. */ - int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, + int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, void **new_privatep); /* notification of peer health */ diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index f4bc290..5d40010 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -191,14 +191,14 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob) __swab32s(&msg->ibm_u.putack.ibpam_rd.rd_key); __swab32s(&msg->ibm_u.putack.ibpam_rd.rd_nfrags); } - + n = msg->ibm_u.putack.ibpam_rd.rd_nfrags; if (n <= 0 || n > IBLND_MAX_RDMA_FRAGS) { CERROR("Bad PUT_ACK nfrags: %d, should be 0 < n <= %d\n", n, IBLND_MAX_RDMA_FRAGS); return -EPROTO; } - + if (msg_nob < offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[n])) { CERROR("Short PUT_ACK: %d(%d)\n", msg_nob, (int)offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[n])); @@ -314,7 +314,7 @@ kiblnd_create_peer (lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) /* always called with a ref on ni, which prevents ni being shutdown */ LASSERT (net->ibn_shutdown == 0); - + /* npeers only grows with the global lock held */ atomic_inc(&net->ibn_npeers); @@ -742,7 +742,7 @@ kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, int state) CERROR("Can't request completion notificiation: %d\n", rc); goto failed_2; } - + memset(init_qp_attr, 0, sizeof(*init_qp_attr)); init_qp_attr->event_handler = kiblnd_qp_event; init_qp_attr->qp_context = conn; diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index f7926c7..7da4289 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -497,13 +497,13 @@ static inline kib_conn_t * kiblnd_get_conn_locked (kib_peer_t *peer) { LASSERT (!list_empty(&peer->ibp_conns)); - + /* just return the first connection */ return list_entry(peer->ibp_conns.next, kib_conn_t, ibc_list); } static inline int -kiblnd_send_keepalive(kib_conn_t *conn) +kiblnd_send_keepalive(kib_conn_t *conn) { return (*kiblnd_tunables.kib_keepalive > 0) && time_after(jiffies, conn->ibc_last_send + diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c index dfe6919..7881b49 100644 --- a/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -505,7 +505,7 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob) LASSERT (net != NULL); LASSERT (rx->rx_nob < 0); /* was posted */ rx->rx_nob = 0; /* isn't now */ - + if (conn->ibc_state > IBLND_CONN_ESTABLISHED) goto ignore; @@ -1258,7 +1258,7 @@ kiblnd_init_rdma (lnet_ni_t *ni, kib_tx_t *tx, int type, dstfrag++; dstidx++; } - + tx->tx_nwrq++; } @@ -1872,7 +1872,7 @@ kiblnd_peer_notify (kib_peer_t *peer) time_t last_alive = 0; int error = 0; unsigned long flags; - + read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); if (list_empty(&peer->ibp_conns) && @@ -1881,14 +1881,14 @@ kiblnd_peer_notify (kib_peer_t *peer) peer->ibp_error != 0) { error = peer->ibp_error; peer->ibp_error = 0; - + last_alive = cfs_time_current_sec() - cfs_duration_sec(cfs_time_current() - peer->ibp_last_alive); } - + read_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags); - + if (error != 0) lnet_notify(peer->ibp_ni, peer->ibp_nid, 0, last_alive); @@ -2780,14 +2780,14 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) kiblnd_conn_decref(conn); return 0; - case RDMA_CM_EVENT_DEVICE_REMOVAL: - LCONSOLE_ERROR_MSG(0x131, + case RDMA_CM_EVENT_DEVICE_REMOVAL: + LCONSOLE_ERROR_MSG(0x131, "Received notification of device removal\n" "Please shutdown LNET to allow this to proceed\n"); /* Can't remove network from underneath LNET for now, so I have * to ignore this */ - return 0; - } + return 0; + } } int @@ -2807,7 +2807,7 @@ kiblnd_check_txs (kib_conn_t *conn, struct list_head *txs) } else { LASSERT (!tx->tx_queued); LASSERT (tx->tx_waiting || tx->tx_sending != 0); - } + } if (time_after_eq (jiffies, tx->tx_deadline)) { timed_out = 1; diff --git a/lnet/lnet/lib-eq.c b/lnet/lnet/lib-eq.c index 5bae602..35801a4 100644 --- a/lnet/lnet/lib-eq.c +++ b/lnet/lnet/lib-eq.c @@ -26,14 +26,14 @@ #include int -LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, +LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, lnet_handle_eq_t *handle) { lnet_eq_t *eq; LASSERT (the_lnet.ln_init); LASSERT (the_lnet.ln_refcount > 0); - + /* We need count to be a power of 2 so that when eq_{enq,deq}_seq * overflow, they don't skip entries, so the queue has the same * apparant capacity at all times */ @@ -48,7 +48,7 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, if (count == 0) /* catch bad parameter / overflow on roundup */ return (-EINVAL); - + eq = lnet_eq_alloc(); if (eq == NULL) return (-ENOMEM); @@ -92,7 +92,7 @@ LNetEQFree(lnet_handle_eq_t eqh) LASSERT (the_lnet.ln_init); LASSERT (the_lnet.ln_refcount > 0); - + LNET_LOCK(); eq = lnet_handle2eq(&eqh); @@ -160,7 +160,7 @@ LNetEQGet (lnet_handle_eq_t eventq, lnet_event_t *event) { int which; - return LNetEQPoll(&eventq, 1, 0, + return LNetEQPoll(&eventq, 1, 0, event, &which); } @@ -216,10 +216,10 @@ LNetEQPoll (lnet_handle_eq_t *eventqs, int neq, int timeout_ms, RETURN(rc); } } - + #ifdef __KERNEL__ if (timeout_ms == 0) { - LNET_UNLOCK (); + LNET_UNLOCK(); RETURN (0); } @@ -231,19 +231,19 @@ LNetEQPoll (lnet_handle_eq_t *eventqs, int neq, int timeout_ms, if (timeout_ms < 0) { cfs_waitq_wait (&wl, CFS_TASK_INTERRUPTIBLE); - } else { + } else { struct timeval tv; now = cfs_time_current(); cfs_waitq_timedwait(&wl, CFS_TASK_INTERRUPTIBLE, cfs_time_seconds(timeout_ms)/1000); - cfs_duration_usec(cfs_time_sub(cfs_time_current(), now), - &tv); + cfs_duration_usec(cfs_time_sub(cfs_time_current(), now), + &tv); timeout_ms -= tv.tv_sec * 1000 + tv.tv_usec / 1000; if (timeout_ms < 0) timeout_ms = 0; } - + LNET_LOCK(); cfs_waitq_del(&the_lnet.ln_waitq, &wl); #else @@ -259,7 +259,7 @@ LNetEQPoll (lnet_handle_eq_t *eventqs, int neq, int timeout_ms, gettimeofday(&then, NULL); (eqwaitni->ni_lnd->lnd_wait)(eqwaitni, timeout_ms); - + gettimeofday(&now, NULL); timeout_ms -= (now.tv_sec - then.tv_sec) * 1000 + (now.tv_usec - then.tv_usec) / 1000; @@ -289,11 +289,11 @@ LNetEQPoll (lnet_handle_eq_t *eventqs, int neq, int timeout_ms, LBUG(); # else if (timeout_ms < 0) { - pthread_cond_wait(&the_lnet.ln_cond, + pthread_cond_wait(&the_lnet.ln_cond, &the_lnet.ln_lock); } else { gettimeofday(&then, NULL); - + ts.tv_sec = then.tv_sec + timeout_ms/1000; ts.tv_nsec = then.tv_usec * 1000 + (timeout_ms%1000) * 1000000; @@ -301,14 +301,14 @@ LNetEQPoll (lnet_handle_eq_t *eventqs, int neq, int timeout_ms, ts.tv_sec++; ts.tv_nsec -= 1000000000; } - + pthread_cond_timedwait(&the_lnet.ln_cond, &the_lnet.ln_lock, &ts); - + gettimeofday(&now, NULL); timeout_ms -= (now.tv_sec - then.tv_sec) * 1000 + (now.tv_usec - then.tv_usec) / 1000; - + if (timeout_ms < 0) timeout_ms = 0; } diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index 938a4d6..881f4ad 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -94,14 +94,14 @@ lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, time_t when) } void -lnet_do_notify (lnet_peer_t *lp) +lnet_do_notify (lnet_peer_t *lp) { lnet_ni_t *ni = lp->lp_ni; int alive; int notifylnd; - + LNET_LOCK(); - + /* Notify only in 1 thread at any time to ensure ordered notification. * NB individual events can be missed; the only guarantee is that you * always get the most recent news */ @@ -112,7 +112,7 @@ lnet_do_notify (lnet_peer_t *lp) } lp->lp_notifying = 1; - + while (lp->lp_notify) { alive = lp->lp_alive; notifylnd = lp->lp_notifylnd; @@ -173,7 +173,7 @@ lnet_notify (lnet_ni_t *ni, lnet_nid_t nid, int alive, time_t when) CDEBUG(D_NET, "Auto-down disabled\n"); return 0; } - + LNET_LOCK(); lp = lnet_find_peer_locked(nid); @@ -187,9 +187,9 @@ lnet_notify (lnet_ni_t *ni, lnet_nid_t nid, int alive, time_t when) lnet_notify_locked(lp, ni == NULL, alive, when); LNET_UNLOCK(); - + lnet_do_notify(lp); - + LNET_LOCK(); lnet_peer_decref_locked(lp); @@ -427,7 +427,7 @@ lnet_check_routes (void) else if (route->lr_gateway->lp_ni != route2->lr_gateway->lp_ni) { LNET_UNLOCK(); - + CERROR("Routes to %s via %s and %s not supported\n", libcfs_net2str(rnet->lrn_net), libcfs_nid2str(route->lr_gateway->lp_nid), @@ -436,7 +436,7 @@ lnet_check_routes (void) } } } - + LNET_UNLOCK(); return 0; } @@ -551,14 +551,14 @@ lnet_router_checker_event (lnet_event_t *event) /* The router checker thread has unlinked the rc_md * and exited. */ LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_UNLINKING); - the_lnet.ln_rc_state = LNET_RC_STATE_UNLINKED; - mutex_up(&the_lnet.ln_rc_signal); + the_lnet.ln_rc_state = LNET_RC_STATE_UNLINKED; + mutex_up(&the_lnet.ln_rc_signal); return; } - LASSERT (event->type == LNET_EVENT_SEND || + LASSERT (event->type == LNET_EVENT_SEND || event->type == LNET_EVENT_REPLY); - + nid = (event->type == LNET_EVENT_SEND) ? event->target.nid : event->initiator.nid; @@ -575,7 +575,7 @@ lnet_router_checker_event (lnet_event_t *event) if (lnet_isrouter(lp) && /* ignore if no longer a router */ (event->status != 0 || event->type == LNET_EVENT_REPLY)) { - + /* A successful REPLY means the router is up. If _any_ comms * to the router fail I assume it's down (this will happen if * we ping alive routers to try to detect router death before @@ -611,8 +611,8 @@ lnet_router_checker(void *arg) lnet_process_id_t rtr_id; int secs; - cfs_daemonize("router_checker"); - cfs_block_allsigs(); + cfs_daemonize("router_checker"); + cfs_block_allsigs(); rtr_id.pid = LUSTRE_SRV_LNET_PID; @@ -638,7 +638,7 @@ lnet_router_checker(void *arg) the_lnet.ln_rc_state = LNET_RC_STATE_RUNNING; mutex_up(&the_lnet.ln_rc_signal); /* let my parent go */ - while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) { + while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) { __u64 version; LNET_LOCK(); @@ -668,7 +668,7 @@ rescan: } if (secs <= 0) secs = 0; - + if (secs != 0 && !rtr->lp_ping_notsent && now > rtr->lp_ping_timestamp + secs) { @@ -690,7 +690,7 @@ rescan: LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0); } - + LNET_LOCK(); lnet_peer_decref_locked(rtr); @@ -708,17 +708,16 @@ rescan: set_current_state(CFS_TASK_INTERRUPTIBLE); cfs_schedule_timeout(CFS_TASK_INTERRUPTIBLE, cfs_time_seconds(1)); - } + } LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_STOPTHREAD); the_lnet.ln_rc_state = LNET_RC_STATE_UNLINKING; - + rc = LNetMDUnlink(mdh); LASSERT (rc == 0); /* The unlink event callback will signal final completion */ - - return 0; + return 0; } @@ -731,11 +730,11 @@ lnet_wait_known_routerstate(void) for (;;) { LNET_LOCK(); - + all_known = 1; list_for_each (entry, &the_lnet.ln_routers) { rtr = list_entry(entry, lnet_peer_t, lp_rtr_list); - + if (rtr->lp_alive_count == 0) { all_known = 0; break; @@ -763,14 +762,14 @@ lnet_router_checker_stop(void) return; the_lnet.ln_rc_state = LNET_RC_STATE_STOPTHREAD; - /* block until event callback signals exit */ - mutex_down(&the_lnet.ln_rc_signal); + /* block until event callback signals exit */ + mutex_down(&the_lnet.ln_rc_signal); LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_UNLINKED); rc = LNetEQFree(the_lnet.ln_rc_eqh); LASSERT (rc == 0); - + the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN; } @@ -788,12 +787,12 @@ lnet_router_checker_start(void) "\n"); return -EINVAL; } - + if (live_router_check_interval <= 0 && dead_router_check_interval <= 0) return 0; - init_mutex_locked(&the_lnet.ln_rc_signal); + init_mutex_locked(&the_lnet.ln_rc_signal); /* EQ size doesn't matter; the callback is guaranteed to get every * event */ @@ -804,20 +803,20 @@ lnet_router_checker_start(void) return -ENOMEM; } - rc = (int)cfs_kernel_thread(lnet_router_checker, NULL, 0); - if (rc < 0) { - CERROR("Can't start router checker thread: %d\n", rc); + rc = (int)cfs_kernel_thread(lnet_router_checker, NULL, 0); + if (rc < 0) { + CERROR("Can't start router checker thread: %d\n", rc); goto failed; - } + } - mutex_down(&the_lnet.ln_rc_signal); /* wait for checker to startup */ + mutex_down(&the_lnet.ln_rc_signal); /* wait for checker to startup */ rc = the_lnet.ln_rc_state; if (rc < 0) { the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN; goto failed; } - + LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); if (check_routers_before_use) { @@ -826,9 +825,9 @@ lnet_router_checker_start(void) * may have to a previous instance of me. */ lnet_wait_known_routerstate(); } - + return 0; - + failed: rc = LNetEQFree(the_lnet.ln_rc_eqh); LASSERT (rc == 0); @@ -915,7 +914,7 @@ lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs) LASSERT (rbp->rbp_nbuffers == nbufs); return 0; } - + for (i = 0; i < nbufs; i++) { rb = lnet_new_rtrbuf(rbp); @@ -974,7 +973,7 @@ int lnet_alloc_rtrpools(int im_a_router) { int rc; - + if (!strcmp(forwarding, "")) { /* not set either way */ if (!im_a_router) @@ -989,7 +988,7 @@ lnet_alloc_rtrpools(int im_a_router) "'enabled' or 'disabled'\n"); return -EINVAL; } - + if (tiny_router_buffers <= 0) { LCONSOLE_ERROR_MSG(0x10c, "tiny_router_buffers=%d invalid when " "routing enabled\n", tiny_router_buffers); @@ -1029,7 +1028,7 @@ lnet_alloc_rtrpools(int im_a_router) LNET_LOCK(); the_lnet.ln_routing = 1; LNET_UNLOCK(); - + return 0; failed: diff --git a/lnet/selftest/rpc.c b/lnet/selftest/rpc.c index 1010e29..ac5a8fe 100644 --- a/lnet/selftest/rpc.c +++ b/lnet/selftest/rpc.c @@ -402,11 +402,11 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, /* this is kind of an abuse of the LNET_MD_OP_{PUT,GET} options. * they're only meaningful for MDs attached to an ME (i.e. passive * buffers... */ - if ((options & LNET_MD_OP_PUT) != 0) { + if ((options & LNET_MD_OP_PUT) != 0) { rc = LNetPut(self, *mdh, LNET_NOACK_REQ, peer, portal, matchbits, 0, 0); } else { - LASSERT ((options & LNET_MD_OP_GET) != 0); + LASSERT ((options & LNET_MD_OP_GET) != 0); rc = LNetGet(self, *mdh, peer, portal, matchbits, 0); } -- 1.8.3.1