Skip to content

Commit e52828c

Browse files
dhowellskuba-moo
authored andcommitted
ocfs2: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage()
Switch ocfs2 from using sendpage() to using sendmsg() + MSG_SPLICE_PAGES so that sendpage can be phased out. Signed-off-by: David Howells <dhowells@redhat.com> cc: Mark Fasheh <mark@fasheh.com> cc: Joel Becker <jlbec@evilplan.org> cc: Joseph Qi <joseph.qi@linux.alibaba.com> cc: ocfs2-devel@oss.oracle.com Link: https://lore.kernel.org/r/20230623225513.2732256-15-dhowells@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 86d7bd6 commit e52828c

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

fs/ocfs2/cluster/tcp.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -930,19 +930,22 @@ static int o2net_send_tcp_msg(struct socket *sock, struct kvec *vec,
930930
}
931931

932932
static void o2net_sendpage(struct o2net_sock_container *sc,
933-
void *kmalloced_virt,
934-
size_t size)
933+
void *virt, size_t size)
935934
{
936935
struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
936+
struct msghdr msg = {};
937+
struct bio_vec bv;
937938
ssize_t ret;
938939

940+
bvec_set_virt(&bv, virt, size);
941+
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bv, 1, size);
942+
939943
while (1) {
944+
msg.msg_flags = MSG_DONTWAIT | MSG_SPLICE_PAGES;
940945
mutex_lock(&sc->sc_send_lock);
941-
ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
942-
virt_to_page(kmalloced_virt),
943-
offset_in_page(kmalloced_virt),
944-
size, MSG_DONTWAIT);
946+
ret = sock_sendmsg(sc->sc_sock, &msg);
945947
mutex_unlock(&sc->sc_send_lock);
948+
946949
if (ret == size)
947950
break;
948951
if (ret == (ssize_t)-EAGAIN) {

0 commit comments

Comments
 (0)