diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2018-01-22 09:20:15 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-04-02 04:12:40 -0400 |
commit | 45a267dbb40f5cf15efa23ce815c4fe0b4674aa2 (patch) | |
tree | 41bdddb64fbfda0b14c935ab9e047211fcdc2a43 /net | |
parent | 7e07efb12db96c2f7c5fafeccada327d1f869e60 (diff) |
libceph: handle zero-length data items
rbd needs this for null copyups -- if copyup data is all zeroes, we
want to save some I/O and network bandwidth. See rbd_obj_issue_copyup()
in the next commit.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/messenger.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 91a57857cf11..cee4b3d307de 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -1605,13 +1605,18 @@ static int write_partial_message_data(struct ceph_connection *con) | |||
1605 | * been revoked, so use the zero page. | 1605 | * been revoked, so use the zero page. |
1606 | */ | 1606 | */ |
1607 | crc = do_datacrc ? le32_to_cpu(msg->footer.data_crc) : 0; | 1607 | crc = do_datacrc ? le32_to_cpu(msg->footer.data_crc) : 0; |
1608 | while (cursor->resid) { | 1608 | while (cursor->total_resid) { |
1609 | struct page *page; | 1609 | struct page *page; |
1610 | size_t page_offset; | 1610 | size_t page_offset; |
1611 | size_t length; | 1611 | size_t length; |
1612 | bool last_piece; | 1612 | bool last_piece; |
1613 | int ret; | 1613 | int ret; |
1614 | 1614 | ||
1615 | if (!cursor->resid) { | ||
1616 | ceph_msg_data_advance(cursor, 0); | ||
1617 | continue; | ||
1618 | } | ||
1619 | |||
1615 | page = ceph_msg_data_next(cursor, &page_offset, &length, | 1620 | page = ceph_msg_data_next(cursor, &page_offset, &length, |
1616 | &last_piece); | 1621 | &last_piece); |
1617 | ret = ceph_tcp_sendpage(con->sock, page, page_offset, | 1622 | ret = ceph_tcp_sendpage(con->sock, page, page_offset, |
@@ -2327,7 +2332,12 @@ static int read_partial_msg_data(struct ceph_connection *con) | |||
2327 | 2332 | ||
2328 | if (do_datacrc) | 2333 | if (do_datacrc) |
2329 | crc = con->in_data_crc; | 2334 | crc = con->in_data_crc; |
2330 | while (cursor->resid) { | 2335 | while (cursor->total_resid) { |
2336 | if (!cursor->resid) { | ||
2337 | ceph_msg_data_advance(cursor, 0); | ||
2338 | continue; | ||
2339 | } | ||
2340 | |||
2331 | page = ceph_msg_data_next(cursor, &page_offset, &length, NULL); | 2341 | page = ceph_msg_data_next(cursor, &page_offset, &length, NULL); |
2332 | ret = ceph_tcp_recvpage(con->sock, page, page_offset, length); | 2342 | ret = ceph_tcp_recvpage(con->sock, page, page_offset, length); |
2333 | if (ret <= 0) { | 2343 | if (ret <= 0) { |