Skip to content

Commit a1a5e87

Browse files
dhowellskuba-moo
authored andcommitted
dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage
When transmitting data, call down a layer using a single sendmsg with MSG_SPLICE_PAGES to indicate that content should be spliced rather using sendpage. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. Signed-off-by: David Howells <[email protected]> cc: Christine Caulfield <[email protected]> cc: David Teigland <[email protected]> cc: Jens Axboe <[email protected]> cc: Matthew Wilcox <[email protected]> cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 572efad commit a1a5e87

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fs/dlm/lowcomms.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,8 +1395,11 @@ int dlm_lowcomms_resend_msg(struct dlm_msg *msg)
13951395
/* Send a message */
13961396
static int send_to_sock(struct connection *con)
13971397
{
1398-
const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
13991398
struct writequeue_entry *e;
1399+
struct bio_vec bvec;
1400+
struct msghdr msg = {
1401+
.msg_flags = MSG_SPLICE_PAGES | MSG_DONTWAIT | MSG_NOSIGNAL,
1402+
};
14001403
int len, offset, ret;
14011404

14021405
spin_lock_bh(&con->writequeue_lock);
@@ -1412,8 +1415,9 @@ static int send_to_sock(struct connection *con)
14121415
WARN_ON_ONCE(len == 0 && e->users == 0);
14131416
spin_unlock_bh(&con->writequeue_lock);
14141417

1415-
ret = kernel_sendpage(con->sock, e->page, offset, len,
1416-
msg_flags);
1418+
bvec_set_page(&bvec, e->page, len, offset);
1419+
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len);
1420+
ret = sock_sendmsg(con->sock, &msg);
14171421
trace_dlm_send(con->nodeid, ret);
14181422
if (ret == -EAGAIN || ret == 0) {
14191423
lock_sock(con->sock->sk);

0 commit comments

Comments
 (0)