aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-02-08 13:44:43 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-04-01 23:19:31 -0400
commit480f40de91e74190281309fd0ecb2d0414603c2e (patch)
treeb62c48384df08ebfdb4994a2a53f65755e7bdc0c /drivers
parent66f5dcef137beef14560f1f6eba6717028b89089 (diff)
lustre: switch to kernel_sendmsg()
(casts are due to misannotations in lustre; it uses iovec where kvec would be correct type; too much noise to properly annotate right now). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c30
-rw-r--r--drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c12
2 files changed, 6 insertions, 36 deletions
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
index 80141aa32c21..c3b67165883b 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
@@ -99,16 +99,7 @@ ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
99 struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov; 99 struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
100 unsigned int niov = tx->tx_niov; 100 unsigned int niov = tx->tx_niov;
101#endif 101#endif
102 struct msghdr msg = { 102 struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
103 .msg_name = NULL,
104 .msg_namelen = 0,
105 .msg_iov = scratchiov,
106 .msg_iovlen = niov,
107 .msg_control = NULL,
108 .msg_controllen = 0,
109 .msg_flags = MSG_DONTWAIT
110 };
111 mm_segment_t oldmm = get_fs();
112 int i; 103 int i;
113 104
114 for (nob = i = 0; i < niov; i++) { 105 for (nob = i = 0; i < niov; i++) {
@@ -120,9 +111,7 @@ ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
120 nob < tx->tx_resid) 111 nob < tx->tx_resid)
121 msg.msg_flags |= MSG_MORE; 112 msg.msg_flags |= MSG_MORE;
122 113
123 set_fs (KERNEL_DS); 114 rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, niov, nob);
124 rc = sock_sendmsg(sock, &msg, nob);
125 set_fs (oldmm);
126 } 115 }
127 return rc; 116 return rc;
128} 117}
@@ -174,16 +163,7 @@ ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
174 struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov; 163 struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
175 unsigned int niov = tx->tx_nkiov; 164 unsigned int niov = tx->tx_nkiov;
176#endif 165#endif
177 struct msghdr msg = { 166 struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
178 .msg_name = NULL,
179 .msg_namelen = 0,
180 .msg_iov = scratchiov,
181 .msg_iovlen = niov,
182 .msg_control = NULL,
183 .msg_controllen = 0,
184 .msg_flags = MSG_DONTWAIT
185 };
186 mm_segment_t oldmm = get_fs();
187 int i; 167 int i;
188 168
189 for (nob = i = 0; i < niov; i++) { 169 for (nob = i = 0; i < niov; i++) {
@@ -196,9 +176,7 @@ ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
196 nob < tx->tx_resid) 176 nob < tx->tx_resid)
197 msg.msg_flags |= MSG_MORE; 177 msg.msg_flags |= MSG_MORE;
198 178
199 set_fs (KERNEL_DS); 179 rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, niov, nob);
200 rc = sock_sendmsg(sock, &msg, nob);
201 set_fs (oldmm);
202 180
203 for (i = 0; i < niov; i++) 181 for (i = 0; i < niov; i++)
204 kunmap(kiov[i].kiov_page); 182 kunmap(kiov[i].kiov_page);
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
index e6069d78af6b..9bd08d666413 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
@@ -265,17 +265,11 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
265 * empty enough to take the whole message immediately */ 265 * empty enough to take the whole message immediately */
266 266
267 for (;;) { 267 for (;;) {
268 struct iovec iov = { 268 struct kvec iov = {
269 .iov_base = buffer, 269 .iov_base = buffer,
270 .iov_len = nob 270 .iov_len = nob
271 }; 271 };
272 struct msghdr msg = { 272 struct msghdr msg = {
273 .msg_name = NULL,
274 .msg_namelen = 0,
275 .msg_iov = &iov,
276 .msg_iovlen = 1,
277 .msg_control = NULL,
278 .msg_controllen = 0,
279 .msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0 273 .msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0
280 }; 274 };
281 275
@@ -297,11 +291,9 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
297 } 291 }
298 } 292 }
299 293
300 set_fs (KERNEL_DS);
301 then = jiffies; 294 then = jiffies;
302 rc = sock_sendmsg (sock, &msg, iov.iov_len); 295 rc = kernel_sendmsg(sock, &msg, &iov, 1, nob);
303 ticks -= jiffies - then; 296 ticks -= jiffies - then;
304 set_fs (oldmm);
305 297
306 if (rc == nob) 298 if (rc == nob)
307 return 0; 299 return 0;