From eb7541583a1e9955404beaec5361d2471b11b7ec Mon Sep 17 00:00:00 2001 From: phil Date: Fri, 28 Nov 2003 21:51:40 +0000 Subject: [PATCH] more innocent b_eq to b_devel merging: - updates to liblustre-specific files - updates to #ifdef-ed code - Makefiles et al --- lnet/ulnds/socklnd/tcplnd.c | 39 ++++++++++++++++++++++++++++++++------- lnet/ulnds/tcplnd.c | 39 ++++++++++++++++++++++++++++++++------- lnet/utils/Makefile.am | 1 - lustre/portals/unals/tcpnal.c | 39 ++++++++++++++++++++++++++++++++------- lustre/portals/utils/Makefile.am | 1 - lustre/ptlrpc/llog_net.c | 4 ++-- 6 files changed, 98 insertions(+), 25 deletions(-) diff --git a/lnet/ulnds/socklnd/tcplnd.c b/lnet/ulnds/socklnd/tcplnd.c index 012447f..1041d1d 100644 --- a/lnet/ulnds/socklnd/tcplnd.c +++ b/lnet/ulnds/socklnd/tcplnd.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef __CYGWIN__ #include #endif @@ -69,9 +70,9 @@ int tcpnal_send(nal_cb_t *n, bridge b=(bridge)n->nal_data; struct iovec tiov[257]; static pthread_mutex_t send_lock = PTHREAD_MUTEX_INITIALIZER; -#ifdef __CYGWIN__ + int rc; + int total; int i; -#endif if (!(c=force_tcp_connection((manager)b->lower, PNAL_IP(nid,b), @@ -96,13 +97,37 @@ int tcpnal_send(nal_cb_t *n, if (niov > 0) memcpy(&tiov[1], iov, niov * sizeof(struct iovec)); - pthread_mutex_lock(&send_lock); -#ifndef __CYGWIN__ - syscall(SYS_writev, c->fd, tiov, niov+1); +#if 1 + for (i = total = 0; i <= niov; i++) + total += tiov[i].iov_len; + + rc = syscall(SYS_writev, c->fd, tiov, niov+1); + if (rc != total) { + fprintf (stderr, "BAD SEND rc %d != %d, errno %d\n", + rc, total, errno); + abort(); + } #else - for (i = 0; i <= niov; i++) - send(c->fd, tiov[i].iov_base, tiov[i].iov_len, 0); + for (i = total = 0; i <= niov; i++) { + rc = send(c->fd, tiov[i].iov_base, tiov[i].iov_len, 0); + + if (rc != tiov[i].iov_len) { + fprintf (stderr, "BAD SEND rc %d != %d, errno %d\n", + rc, tiov[i].iov_len, errno); + abort(); + } + total != rc; + } +#endif +#if 0 + fprintf (stderr, "sent %s total %d in %d frags\n", + hdr->type == PTL_MSG_ACK ? "ACK" : + hdr->type == PTL_MSG_PUT ? "PUT" : + hdr->type == PTL_MSG_GET ? "GET" : + hdr->type == PTL_MSG_REPLY ? "REPLY" : + hdr->type == PTL_MSG_HELLO ? "HELLO" : "UNKNOWN", + total, niov + 1); #endif pthread_mutex_unlock(&send_lock); #endif diff --git a/lnet/ulnds/tcplnd.c b/lnet/ulnds/tcplnd.c index 012447f..1041d1d 100644 --- a/lnet/ulnds/tcplnd.c +++ b/lnet/ulnds/tcplnd.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef __CYGWIN__ #include #endif @@ -69,9 +70,9 @@ int tcpnal_send(nal_cb_t *n, bridge b=(bridge)n->nal_data; struct iovec tiov[257]; static pthread_mutex_t send_lock = PTHREAD_MUTEX_INITIALIZER; -#ifdef __CYGWIN__ + int rc; + int total; int i; -#endif if (!(c=force_tcp_connection((manager)b->lower, PNAL_IP(nid,b), @@ -96,13 +97,37 @@ int tcpnal_send(nal_cb_t *n, if (niov > 0) memcpy(&tiov[1], iov, niov * sizeof(struct iovec)); - pthread_mutex_lock(&send_lock); -#ifndef __CYGWIN__ - syscall(SYS_writev, c->fd, tiov, niov+1); +#if 1 + for (i = total = 0; i <= niov; i++) + total += tiov[i].iov_len; + + rc = syscall(SYS_writev, c->fd, tiov, niov+1); + if (rc != total) { + fprintf (stderr, "BAD SEND rc %d != %d, errno %d\n", + rc, total, errno); + abort(); + } #else - for (i = 0; i <= niov; i++) - send(c->fd, tiov[i].iov_base, tiov[i].iov_len, 0); + for (i = total = 0; i <= niov; i++) { + rc = send(c->fd, tiov[i].iov_base, tiov[i].iov_len, 0); + + if (rc != tiov[i].iov_len) { + fprintf (stderr, "BAD SEND rc %d != %d, errno %d\n", + rc, tiov[i].iov_len, errno); + abort(); + } + total != rc; + } +#endif +#if 0 + fprintf (stderr, "sent %s total %d in %d frags\n", + hdr->type == PTL_MSG_ACK ? "ACK" : + hdr->type == PTL_MSG_PUT ? "PUT" : + hdr->type == PTL_MSG_GET ? "GET" : + hdr->type == PTL_MSG_REPLY ? "REPLY" : + hdr->type == PTL_MSG_HELLO ? "HELLO" : "UNKNOWN", + total, niov + 1); #endif pthread_mutex_unlock(&send_lock); #endif diff --git a/lnet/utils/Makefile.am b/lnet/utils/Makefile.am index 31c2a87..f1878df 100644 --- a/lnet/utils/Makefile.am +++ b/lnet/utils/Makefile.am @@ -7,7 +7,6 @@ COMPILE = $(CC) -Wall -g -I$(srcdir)/../include LINK = $(CC) -o $@ - if LIBLUSTRE tmp= else diff --git a/lustre/portals/unals/tcpnal.c b/lustre/portals/unals/tcpnal.c index 012447f..1041d1d 100644 --- a/lustre/portals/unals/tcpnal.c +++ b/lustre/portals/unals/tcpnal.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef __CYGWIN__ #include #endif @@ -69,9 +70,9 @@ int tcpnal_send(nal_cb_t *n, bridge b=(bridge)n->nal_data; struct iovec tiov[257]; static pthread_mutex_t send_lock = PTHREAD_MUTEX_INITIALIZER; -#ifdef __CYGWIN__ + int rc; + int total; int i; -#endif if (!(c=force_tcp_connection((manager)b->lower, PNAL_IP(nid,b), @@ -96,13 +97,37 @@ int tcpnal_send(nal_cb_t *n, if (niov > 0) memcpy(&tiov[1], iov, niov * sizeof(struct iovec)); - pthread_mutex_lock(&send_lock); -#ifndef __CYGWIN__ - syscall(SYS_writev, c->fd, tiov, niov+1); +#if 1 + for (i = total = 0; i <= niov; i++) + total += tiov[i].iov_len; + + rc = syscall(SYS_writev, c->fd, tiov, niov+1); + if (rc != total) { + fprintf (stderr, "BAD SEND rc %d != %d, errno %d\n", + rc, total, errno); + abort(); + } #else - for (i = 0; i <= niov; i++) - send(c->fd, tiov[i].iov_base, tiov[i].iov_len, 0); + for (i = total = 0; i <= niov; i++) { + rc = send(c->fd, tiov[i].iov_base, tiov[i].iov_len, 0); + + if (rc != tiov[i].iov_len) { + fprintf (stderr, "BAD SEND rc %d != %d, errno %d\n", + rc, tiov[i].iov_len, errno); + abort(); + } + total != rc; + } +#endif +#if 0 + fprintf (stderr, "sent %s total %d in %d frags\n", + hdr->type == PTL_MSG_ACK ? "ACK" : + hdr->type == PTL_MSG_PUT ? "PUT" : + hdr->type == PTL_MSG_GET ? "GET" : + hdr->type == PTL_MSG_REPLY ? "REPLY" : + hdr->type == PTL_MSG_HELLO ? "HELLO" : "UNKNOWN", + total, niov + 1); #endif pthread_mutex_unlock(&send_lock); #endif diff --git a/lustre/portals/utils/Makefile.am b/lustre/portals/utils/Makefile.am index 31c2a87..f1878df 100644 --- a/lustre/portals/utils/Makefile.am +++ b/lustre/portals/utils/Makefile.am @@ -7,7 +7,6 @@ COMPILE = $(CC) -Wall -g -I$(srcdir)/../include LINK = $(CC) -o $@ - if LIBLUSTRE tmp= else diff --git a/lustre/ptlrpc/llog_net.c b/lustre/ptlrpc/llog_net.c index 845257d..1dd2f9a 100644 --- a/lustre/ptlrpc/llog_net.c +++ b/lustre/ptlrpc/llog_net.c @@ -83,9 +83,9 @@ int llog_handle_connect(struct ptlrpc_request *req) struct llog_ctxt *ctxt; int rc; ENTRY; - + req_body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*req_body)); - + ctxt = llog_get_context(obd, req_body->lgdc_ctxt_idx); rc = llog_connect(ctxt, 1, &req_body->lgdc_logid, &req_body->lgdc_gen); -- 1.8.3.1