aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-01-05 16:58:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-05 16:58:08 -0500
commitc7eaf342ecb164d79275a6c1c93aef19293a4aaf (patch)
tree87df401e3a7ccf2263f569b90937170b231a2647 /net
parent35004f2e55807a1a1491db24ab512dd2f770a130 (diff)
parent5ccedf1ccd710ba32f36986b49eeb764e53e7ef1 (diff)
Merge tag 'ceph-for-4.21-rc1' of git://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "A fairly quiet round: a couple of messenger performance improvements from myself and a few cap handling fixes from Zheng" * tag 'ceph-for-4.21-rc1' of git://github.com/ceph/ceph-client: ceph: don't encode inode pathes into reconnect message ceph: update wanted caps after resuming stale session ceph: skip updating 'wanted' caps if caps are already issued ceph: don't request excl caps when mount is readonly ceph: don't update importing cap's mseq when handing cap export libceph: switch more to bool in ceph_tcp_sendmsg() libceph: use MSG_SENDPAGE_NOTLAST with ceph_tcp_sendpage() libceph: use sock_no_sendpage() as a fallback in ceph_tcp_sendpage() libceph: drop last_piece logic from write_partial_message_data() ceph: remove redundant assignment ceph: cleanup splice_dentry()
Diffstat (limited to 'net')
-rw-r--r--net/ceph/messenger.c55
1 files changed, 21 insertions, 34 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 2f126eff275d..d5718284db57 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -544,7 +544,7 @@ static int ceph_tcp_recvpage(struct socket *sock, struct page *page,
544 * shortly. 544 * shortly.
545 */ 545 */
546static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov, 546static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov,
547 size_t kvlen, size_t len, int more) 547 size_t kvlen, size_t len, bool more)
548{ 548{
549 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; 549 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL };
550 int r; 550 int r;
@@ -560,24 +560,15 @@ static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov,
560 return r; 560 return r;
561} 561}
562 562
563static int __ceph_tcp_sendpage(struct socket *sock, struct page *page, 563/*
564 int offset, size_t size, bool more) 564 * @more: either or both of MSG_MORE and MSG_SENDPAGE_NOTLAST
565{ 565 */
566 int flags = MSG_DONTWAIT | MSG_NOSIGNAL | (more ? MSG_MORE : MSG_EOR);
567 int ret;
568
569 ret = kernel_sendpage(sock, page, offset, size, flags);
570 if (ret == -EAGAIN)
571 ret = 0;
572
573 return ret;
574}
575
576static int ceph_tcp_sendpage(struct socket *sock, struct page *page, 566static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
577 int offset, size_t size, bool more) 567 int offset, size_t size, int more)
578{ 568{
579 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; 569 ssize_t (*sendpage)(struct socket *sock, struct page *page,
580 struct bio_vec bvec; 570 int offset, size_t size, int flags);
571 int flags = MSG_DONTWAIT | MSG_NOSIGNAL | more;
581 int ret; 572 int ret;
582 573
583 /* 574 /*
@@ -589,19 +580,11 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
589 * triggers one of hardened usercopy checks. 580 * triggers one of hardened usercopy checks.
590 */ 581 */
591 if (page_count(page) >= 1 && !PageSlab(page)) 582 if (page_count(page) >= 1 && !PageSlab(page))
592 return __ceph_tcp_sendpage(sock, page, offset, size, more); 583 sendpage = sock->ops->sendpage;
593
594 bvec.bv_page = page;
595 bvec.bv_offset = offset;
596 bvec.bv_len = size;
597
598 if (more)
599 msg.msg_flags |= MSG_MORE;
600 else 584 else
601 msg.msg_flags |= MSG_EOR; /* superfluous, but what the hell */ 585 sendpage = sock_no_sendpage;
602 586
603 iov_iter_bvec(&msg.msg_iter, WRITE, &bvec, 1, size); 587 ret = sendpage(sock, page, offset, size, flags);
604 ret = sock_sendmsg(sock, &msg);
605 if (ret == -EAGAIN) 588 if (ret == -EAGAIN)
606 ret = 0; 589 ret = 0;
607 590
@@ -1572,6 +1555,7 @@ static int write_partial_message_data(struct ceph_connection *con)
1572 struct ceph_msg *msg = con->out_msg; 1555 struct ceph_msg *msg = con->out_msg;
1573 struct ceph_msg_data_cursor *cursor = &msg->cursor; 1556 struct ceph_msg_data_cursor *cursor = &msg->cursor;
1574 bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC); 1557 bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC);
1558 int more = MSG_MORE | MSG_SENDPAGE_NOTLAST;
1575 u32 crc; 1559 u32 crc;
1576 1560
1577 dout("%s %p msg %p\n", __func__, con, msg); 1561 dout("%s %p msg %p\n", __func__, con, msg);
@@ -1592,7 +1576,6 @@ static int write_partial_message_data(struct ceph_connection *con)
1592 struct page *page; 1576 struct page *page;
1593 size_t page_offset; 1577 size_t page_offset;
1594 size_t length; 1578 size_t length;
1595 bool last_piece;
1596 int ret; 1579 int ret;
1597 1580
1598 if (!cursor->resid) { 1581 if (!cursor->resid) {
@@ -1600,10 +1583,11 @@ static int write_partial_message_data(struct ceph_connection *con)
1600 continue; 1583 continue;
1601 } 1584 }
1602 1585
1603 page = ceph_msg_data_next(cursor, &page_offset, &length, 1586 page = ceph_msg_data_next(cursor, &page_offset, &length, NULL);
1604 &last_piece); 1587 if (length == cursor->total_resid)
1605 ret = ceph_tcp_sendpage(con->sock, page, page_offset, 1588 more = MSG_MORE;
1606 length, !last_piece); 1589 ret = ceph_tcp_sendpage(con->sock, page, page_offset, length,
1590 more);
1607 if (ret <= 0) { 1591 if (ret <= 0) {
1608 if (do_datacrc) 1592 if (do_datacrc)
1609 msg->footer.data_crc = cpu_to_le32(crc); 1593 msg->footer.data_crc = cpu_to_le32(crc);
@@ -1633,13 +1617,16 @@ static int write_partial_message_data(struct ceph_connection *con)
1633 */ 1617 */
1634static int write_partial_skip(struct ceph_connection *con) 1618static int write_partial_skip(struct ceph_connection *con)
1635{ 1619{
1620 int more = MSG_MORE | MSG_SENDPAGE_NOTLAST;
1636 int ret; 1621 int ret;
1637 1622
1638 dout("%s %p %d left\n", __func__, con, con->out_skip); 1623 dout("%s %p %d left\n", __func__, con, con->out_skip);
1639 while (con->out_skip > 0) { 1624 while (con->out_skip > 0) {
1640 size_t size = min(con->out_skip, (int) PAGE_SIZE); 1625 size_t size = min(con->out_skip, (int) PAGE_SIZE);
1641 1626
1642 ret = ceph_tcp_sendpage(con->sock, zero_page, 0, size, true); 1627 if (size == con->out_skip)
1628 more = MSG_MORE;
1629 ret = ceph_tcp_sendpage(con->sock, zero_page, 0, size, more);
1643 if (ret <= 0) 1630 if (ret <= 0)
1644 goto out; 1631 goto out;
1645 con->out_skip -= ret; 1632 con->out_skip -= ret;