SUNRPC: Use MSG_SENDPAGE_NOTLAST in xs_send_pagedata()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 6 Oct 2015 19:59:20 +0000 (15:59 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 8 Oct 2015 13:12:35 +0000 (09:12 -0400)
If we're sending more than one page via kernel_sendpage(), then set
MSG_SENDPAGE_NOTLAST between the pages so that we don't send suboptimal
frames (see commit 2f5338442425 and commit 35f9c09fe9c7).

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
net/sunrpc/xprtsock.c

index 1471ecceabf9ba4f14a85b3d4cf5a7b36d866a50..e71aff251ac107275327e9457a3d56f9c7b407bc 100644 (file)
@@ -360,8 +360,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
                int flags = XS_SENDMSG_FLAGS;
 
                remainder -= len;
-               if (remainder != 0 || more)
+               if (more)
                        flags |= MSG_MORE;
+               if (remainder != 0)
+                       flags |= MSG_SENDPAGE_NOTLAST | MSG_MORE;
                err = do_sendpage(sock, *ppage, base, len, flags);
                if (remainder == 0 || err != len)
                        break;