Commit 1f6b821a authored by Ilya Dryomov's avatar Ilya Dryomov

libceph: drop last_piece logic from write_partial_message_data()

last_piece is for the last piece in the current data item, not in the
entire data payload of the message.  This is harmful for messages with
multiple data items.  On top of that, we don't need to signal the end
of a data payload either because it is always followed by a footer.

We used to signal "more" unconditionally, until commit fe38a2b6
("libceph: start defining message data cursor").  Part of a large
series, it introduced cursor->last_piece and also mistakenly inverted
the hint by passing last_piece for "more".  This was corrected with
commit c2cfa194 ("libceph: Fix ceph_tcp_sendpage()'s more boolean
usage").

As it is, last_piece is not helping at all: because Nagle algorithm is
disabled, for a simple message with two 512-byte data items we end up
emitting three packets: front + first data item, second data item and
footer.  Go back to the original pre-fe38a2b6 behavior -- a single
packet in most cases.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 0cab9f33
......@@ -1592,7 +1592,6 @@ static int write_partial_message_data(struct ceph_connection *con)
struct page *page;
size_t page_offset;
size_t length;
bool last_piece;
int ret;
if (!cursor->resid) {
......@@ -1600,10 +1599,9 @@ static int write_partial_message_data(struct ceph_connection *con)
continue;
}
page = ceph_msg_data_next(cursor, &page_offset, &length,
&last_piece);
ret = ceph_tcp_sendpage(con->sock, page, page_offset,
length, !last_piece);
page = ceph_msg_data_next(cursor, &page_offset, &length, NULL);
ret = ceph_tcp_sendpage(con->sock, page, page_offset, length,
true);
if (ret <= 0) {
if (do_datacrc)
msg->footer.data_crc = cpu_to_le32(crc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment