Loading drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +7 −23 Original line number Original line Diff line number Diff line Loading @@ -215,15 +215,8 @@ ksocknal_lib_recv_iov (ksock_conn_t *conn) #endif #endif struct iovec *iov = conn->ksnc_rx_iov; struct iovec *iov = conn->ksnc_rx_iov; struct msghdr msg = { struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = scratchiov, .msg_iovlen = niov, .msg_control = NULL, .msg_controllen = 0, .msg_flags = 0 .msg_flags = 0 }; }; mm_segment_t oldmm = get_fs(); int nob; int nob; int i; int i; int rc; int rc; Loading @@ -241,10 +234,8 @@ ksocknal_lib_recv_iov (ksock_conn_t *conn) } } LASSERT (nob <= conn->ksnc_rx_nob_wanted); LASSERT (nob <= conn->ksnc_rx_nob_wanted); set_fs (KERNEL_DS); rc = kernel_recvmsg(conn->ksnc_sock, &msg, rc = sock_recvmsg (conn->ksnc_sock, &msg, nob, MSG_DONTWAIT); (struct kvec *)scratchiov, niov, nob, MSG_DONTWAIT); /* NB this is just a boolean..........................^ */ set_fs (oldmm); saved_csum = 0; saved_csum = 0; if (conn->ksnc_proto == &ksocknal_protocol_v2x) { if (conn->ksnc_proto == &ksocknal_protocol_v2x) { Loading Loading @@ -333,14 +324,8 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) #endif #endif lnet_kiov_t *kiov = conn->ksnc_rx_kiov; lnet_kiov_t *kiov = conn->ksnc_rx_kiov; struct msghdr msg = { struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = scratchiov, .msg_control = NULL, .msg_controllen = 0, .msg_flags = 0 .msg_flags = 0 }; }; mm_segment_t oldmm = get_fs(); int nob; int nob; int i; int i; int rc; int rc; Loading @@ -348,12 +333,13 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) void *addr; void *addr; int sum; int sum; int fragnob; int fragnob; int n; /* NB we can't trust socket ops to either consume our iovs /* NB we can't trust socket ops to either consume our iovs * or leave them alone. */ * or leave them alone. */ if ((addr = ksocknal_lib_kiov_vmap(kiov, niov, scratchiov, pages)) != NULL) { if ((addr = ksocknal_lib_kiov_vmap(kiov, niov, scratchiov, pages)) != NULL) { nob = scratchiov[0].iov_len; nob = scratchiov[0].iov_len; msg.msg_iovlen = 1; n = 1; } else { } else { for (nob = i = 0; i < niov; i++) { for (nob = i = 0; i < niov; i++) { Loading @@ -361,15 +347,13 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) scratchiov[i].iov_base = kmap(kiov[i].kiov_page) + scratchiov[i].iov_base = kmap(kiov[i].kiov_page) + kiov[i].kiov_offset; kiov[i].kiov_offset; } } msg.msg_iovlen = niov; n = niov; } } LASSERT (nob <= conn->ksnc_rx_nob_wanted); LASSERT (nob <= conn->ksnc_rx_nob_wanted); set_fs (KERNEL_DS); rc = kernel_recvmsg(conn->ksnc_sock, &msg, rc = sock_recvmsg (conn->ksnc_sock, &msg, nob, MSG_DONTWAIT); (struct kvec *)scratchiov, n, nob, MSG_DONTWAIT); /* NB this is just a boolean.......................^ */ set_fs (oldmm); if (conn->ksnc_msg.ksm_csum != 0) { if (conn->ksnc_msg.ksm_csum != 0) { for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { Loading drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +2 −10 Original line number Original line Diff line number Diff line Loading @@ -330,17 +330,11 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) LASSERT (ticks > 0); LASSERT (ticks > 0); for (;;) { for (;;) { struct iovec iov = { struct kvec iov = { .iov_base = buffer, .iov_base = buffer, .iov_len = nob .iov_len = nob }; }; struct msghdr msg = { struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1, .msg_control = NULL, .msg_controllen = 0, .msg_flags = 0 .msg_flags = 0 }; }; Loading @@ -359,11 +353,9 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) return rc; return rc; } } set_fs(KERNEL_DS); then = jiffies; then = jiffies; rc = sock_recvmsg(sock, &msg, iov.iov_len, 0); rc = kernel_recvmsg(sock, &msg, &iov, 1, nob, 0); ticks -= jiffies - then; ticks -= jiffies - then; set_fs(oldmm); if (rc < 0) if (rc < 0) return rc; return rc; Loading Loading
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +7 −23 Original line number Original line Diff line number Diff line Loading @@ -215,15 +215,8 @@ ksocknal_lib_recv_iov (ksock_conn_t *conn) #endif #endif struct iovec *iov = conn->ksnc_rx_iov; struct iovec *iov = conn->ksnc_rx_iov; struct msghdr msg = { struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = scratchiov, .msg_iovlen = niov, .msg_control = NULL, .msg_controllen = 0, .msg_flags = 0 .msg_flags = 0 }; }; mm_segment_t oldmm = get_fs(); int nob; int nob; int i; int i; int rc; int rc; Loading @@ -241,10 +234,8 @@ ksocknal_lib_recv_iov (ksock_conn_t *conn) } } LASSERT (nob <= conn->ksnc_rx_nob_wanted); LASSERT (nob <= conn->ksnc_rx_nob_wanted); set_fs (KERNEL_DS); rc = kernel_recvmsg(conn->ksnc_sock, &msg, rc = sock_recvmsg (conn->ksnc_sock, &msg, nob, MSG_DONTWAIT); (struct kvec *)scratchiov, niov, nob, MSG_DONTWAIT); /* NB this is just a boolean..........................^ */ set_fs (oldmm); saved_csum = 0; saved_csum = 0; if (conn->ksnc_proto == &ksocknal_protocol_v2x) { if (conn->ksnc_proto == &ksocknal_protocol_v2x) { Loading Loading @@ -333,14 +324,8 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) #endif #endif lnet_kiov_t *kiov = conn->ksnc_rx_kiov; lnet_kiov_t *kiov = conn->ksnc_rx_kiov; struct msghdr msg = { struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = scratchiov, .msg_control = NULL, .msg_controllen = 0, .msg_flags = 0 .msg_flags = 0 }; }; mm_segment_t oldmm = get_fs(); int nob; int nob; int i; int i; int rc; int rc; Loading @@ -348,12 +333,13 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) void *addr; void *addr; int sum; int sum; int fragnob; int fragnob; int n; /* NB we can't trust socket ops to either consume our iovs /* NB we can't trust socket ops to either consume our iovs * or leave them alone. */ * or leave them alone. */ if ((addr = ksocknal_lib_kiov_vmap(kiov, niov, scratchiov, pages)) != NULL) { if ((addr = ksocknal_lib_kiov_vmap(kiov, niov, scratchiov, pages)) != NULL) { nob = scratchiov[0].iov_len; nob = scratchiov[0].iov_len; msg.msg_iovlen = 1; n = 1; } else { } else { for (nob = i = 0; i < niov; i++) { for (nob = i = 0; i < niov; i++) { Loading @@ -361,15 +347,13 @@ ksocknal_lib_recv_kiov (ksock_conn_t *conn) scratchiov[i].iov_base = kmap(kiov[i].kiov_page) + scratchiov[i].iov_base = kmap(kiov[i].kiov_page) + kiov[i].kiov_offset; kiov[i].kiov_offset; } } msg.msg_iovlen = niov; n = niov; } } LASSERT (nob <= conn->ksnc_rx_nob_wanted); LASSERT (nob <= conn->ksnc_rx_nob_wanted); set_fs (KERNEL_DS); rc = kernel_recvmsg(conn->ksnc_sock, &msg, rc = sock_recvmsg (conn->ksnc_sock, &msg, nob, MSG_DONTWAIT); (struct kvec *)scratchiov, n, nob, MSG_DONTWAIT); /* NB this is just a boolean.......................^ */ set_fs (oldmm); if (conn->ksnc_msg.ksm_csum != 0) { if (conn->ksnc_msg.ksm_csum != 0) { for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { for (i = 0, sum = rc; sum > 0; i++, sum -= fragnob) { Loading
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +2 −10 Original line number Original line Diff line number Diff line Loading @@ -330,17 +330,11 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) LASSERT (ticks > 0); LASSERT (ticks > 0); for (;;) { for (;;) { struct iovec iov = { struct kvec iov = { .iov_base = buffer, .iov_base = buffer, .iov_len = nob .iov_len = nob }; }; struct msghdr msg = { struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1, .msg_control = NULL, .msg_controllen = 0, .msg_flags = 0 .msg_flags = 0 }; }; Loading @@ -359,11 +353,9 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) return rc; return rc; } } set_fs(KERNEL_DS); then = jiffies; then = jiffies; rc = sock_recvmsg(sock, &msg, iov.iov_len, 0); rc = kernel_recvmsg(sock, &msg, &iov, 1, nob, 0); ticks -= jiffies - then; ticks -= jiffies - then; set_fs(oldmm); if (rc < 0) if (rc < 0) return rc; return rc; Loading