ocfs2: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage()
authorDavid Howells <dhowells@redhat.com>
Fri, 23 Jun 2023 22:55:11 +0000 (23:55 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 24 Jun 2023 22:50:13 +0000 (15:50 -0700)
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>
fs/ocfs2/cluster/tcp.c

index 929a1133bc1804441e68e893e5306c6a76cc9be8..960080753d3bda79fa1dbe72e1cb09198570cf18 100644 (file)
@@ -930,19 +930,22 @@ out:
 }
 
 static void o2net_sendpage(struct o2net_sock_container *sc,
-                          void *kmalloced_virt,
-                          size_t size)
+                          void *virt, size_t size)
 {
        struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
+       struct msghdr msg = {};
+       struct bio_vec bv;
        ssize_t ret;
 
+       bvec_set_virt(&bv, virt, size);
+       iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bv, 1, size);
+
        while (1) {
+               msg.msg_flags = MSG_DONTWAIT | MSG_SPLICE_PAGES;
                mutex_lock(&sc->sc_send_lock);
-               ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
-                                                virt_to_page(kmalloced_virt),
-                                                offset_in_page(kmalloced_virt),
-                                                size, MSG_DONTWAIT);
+               ret = sock_sendmsg(sc->sc_sock, &msg);
                mutex_unlock(&sc->sc_send_lock);
+
                if (ret == size)
                        break;
                if (ret == (ssize_t)-EAGAIN) {