Commit 480f40de authored by Al Viro's avatar Al Viro
Browse files

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 66f5dcef
......@@ -99,16 +99,7 @@ ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = tx->tx_niov;
#endif
struct msghdr msg = {
.msg_name = NULL,
.msg_namelen = 0,
.msg_iov = scratchiov,
.msg_iovlen = niov,
.msg_control = NULL,
.msg_controllen = 0,
.msg_flags = MSG_DONTWAIT
};
mm_segment_t oldmm = get_fs();
struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i;
for (nob = i = 0; i < niov; i++) {
......@@ -120,9 +111,7 @@ ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
nob < tx->tx_resid)
msg.msg_flags |= MSG_MORE;
set_fs (KERNEL_DS);
rc = sock_sendmsg(sock, &msg, nob);
set_fs (oldmm);
rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, niov, nob);
}
return rc;
}
......@@ -174,16 +163,7 @@ ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = tx->tx_nkiov;
#endif
struct msghdr msg = {
.msg_name = NULL,
.msg_namelen = 0,
.msg_iov = scratchiov,
.msg_iovlen = niov,
.msg_control = NULL,
.msg_controllen = 0,
.msg_flags = MSG_DONTWAIT
};
mm_segment_t oldmm = get_fs();
struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i;
for (nob = i = 0; i < niov; i++) {
......@@ -196,9 +176,7 @@ ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
nob < tx->tx_resid)
msg.msg_flags |= MSG_MORE;
set_fs (KERNEL_DS);
rc = sock_sendmsg(sock, &msg, nob);
set_fs (oldmm);
rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, niov, nob);
for (i = 0; i < niov; i++)
kunmap(kiov[i].kiov_page);
......
......@@ -265,17 +265,11 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
* empty enough to take the whole message immediately */
for (;;) {
struct iovec iov = {
struct kvec iov = {
.iov_base = buffer,
.iov_len = nob
};
struct msghdr msg = {
.msg_name = NULL,
.msg_namelen = 0,
.msg_iov = &iov,
.msg_iovlen = 1,
.msg_control = NULL,
.msg_controllen = 0,
.msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0
};
......@@ -297,11 +291,9 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
}
}
set_fs (KERNEL_DS);
then = jiffies;
rc = sock_sendmsg (sock, &msg, iov.iov_len);
rc = kernel_sendmsg(sock, &msg, &iov, 1, nob);
ticks -= jiffies - then;
set_fs (oldmm);
if (rc == nob)
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment