Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1466873
| From | Oleg Drokin <green@linuxhacker.ru> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 02/13] ksocknal_lib_send_iov(): sendmsg doesn't bugger iovec... |
| Date | 2016-08-20 23:40 +0200 |
| Message-ID | <s8m9I-8ms-17@gated-at.bofh.it> (permalink) |
| References | <s8m9H-8ms-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
.../lustre/lnet/klnds/socklnd/socklnd_lib.c | 38 ++++++----------------
1 file changed, 10 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 77bb29ff..8eb4a68 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -73,9 +73,9 @@ ksocknal_lib_zc_capable(struct ksock_conn *conn)
int
ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx)
{
+ struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
struct socket *sock = conn->ksnc_sock;
- int nob;
- int rc;
+ int nob, i;
if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */
conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */
@@ -83,34 +83,16 @@ ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx)
!tx->tx_msg.ksm_csum) /* not checksummed */
ksocknal_lib_csum_tx(tx);
- /*
- * NB we can't trust socket ops to either consume our iovs
- * or leave them alone.
- */
- {
-#if SOCKNAL_SINGLE_FRAG_TX
- struct kvec scratch;
- struct kvec *scratchiov = &scratch;
- unsigned int niov = 1;
-#else
- struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
- unsigned int niov = tx->tx_niov;
-#endif
- struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
- int i;
-
- for (nob = i = 0; i < niov; i++) {
- scratchiov[i] = tx->tx_iov[i];
- nob += scratchiov[i].iov_len;
- }
+ for (nob = i = 0; i < tx->tx_niov; i++)
+ nob += tx->tx_iov[i].iov_len;
- if (!list_empty(&conn->ksnc_tx_queue) ||
- nob < tx->tx_resid)
- msg.msg_flags |= MSG_MORE;
+ if (!list_empty(&conn->ksnc_tx_queue) ||
+ nob < tx->tx_resid)
+ msg.msg_flags |= MSG_MORE;
- rc = kernel_sendmsg(sock, &msg, scratchiov, niov, nob);
- }
- return rc;
+ iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC,
+ tx->tx_iov, tx->tx_niov, nob);
+ return sock_sendmsg(sock, &msg);
}
int
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/13] Lustre patches Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 04/13] lustre: ->kss_scratch... are unused now Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 01/13] ksocknal_lib_recv_iov(): recvmsg doesn't bugger iovec anymore... Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 02/13] ksocknal_lib_send_iov(): sendmsg doesn't bugger iovec... Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 07/13] lustre: introduce lnet_copy_{k,}iov2iter(), kill lnet_copy_{k,}iov2{k,}iov() Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 09/13] staging/lustre: Add spaces preferred around that '{+,-,*,/,|,<<,>>,&}' Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
Re: [PATCH 09/13] staging/lustre: Add spaces preferred around that '{+, -, *, /, |, <<, >>, &}' Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-21 23:20 +0200
[PATCH 05/13] lustre: constify lib-move.c stuff Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 10/13] staging/lustre: Fix unnecessary parentheses around variables Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
[PATCH 08/13] staging/lustre: Always return EEXIST on mkdir for existing names Oleg Drokin <green@linuxhacker.ru> - 2016-08-20 23:40 +0200
Re: [PATCH 11/13] staging/lustre: Make alignment match open parenthesis Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-21 23:20 +0200
csiph-web