Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+4 −26
Original line number Original line Diff line number Diff line
@@ -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;
		struct iovec   *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
		unsigned int    niov = tx->tx_niov;
		unsigned int    niov = tx->tx_niov;
#endif
#endif
		struct msghdr msg = {
		struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
			.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();
		int  i;
		int  i;


		for (nob = i = 0; i < niov; 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)
		    nob < tx->tx_resid)
			msg.msg_flags |= MSG_MORE;
			msg.msg_flags |= MSG_MORE;


		set_fs (KERNEL_DS);
		rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, niov, nob);
		rc = sock_sendmsg(sock, &msg, nob);
		set_fs (oldmm);
	}
	}
	return rc;
	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;
		struct iovec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
		unsigned int  niov = tx->tx_nkiov;
		unsigned int  niov = tx->tx_nkiov;
#endif
#endif
		struct msghdr msg = {
		struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
			.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();
		int	   i;
		int	   i;


		for (nob = i = 0; i < niov; 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)
		    nob < tx->tx_resid)
			msg.msg_flags |= MSG_MORE;
			msg.msg_flags |= MSG_MORE;


		set_fs (KERNEL_DS);
		rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, niov, nob);
		rc = sock_sendmsg(sock, &msg, nob);
		set_fs (oldmm);


		for (i = 0; i < niov; i++)
		for (i = 0; i < niov; i++)
			kunmap(kiov[i].kiov_page);
			kunmap(kiov[i].kiov_page);
+2 −10
Original line number Original line Diff line number Diff line
@@ -265,17 +265,11 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
	 * empty enough to take the whole message immediately */
	 * empty enough to take the whole message immediately */


	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      = (timeout == 0) ? MSG_DONTWAIT : 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;
		then = jiffies;
		rc = sock_sendmsg (sock, &msg, iov.iov_len);
		rc = kernel_sendmsg(sock, &msg, &iov, 1, nob);
		ticks -= jiffies - then;
		ticks -= jiffies - then;
		set_fs (oldmm);


		if (rc == nob)
		if (rc == nob)
			return 0;
			return 0;