Skip to content

Commit

Permalink
libceph: handle zero-length data items
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ilya Dryomov committed Apr 2, 2018
1 parent 7e07efb commit 45a267d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,13 +1605,18 @@ static int write_partial_message_data(struct ceph_connection *con)
* been revoked, so use the zero page.
*/
crc = do_datacrc ? le32_to_cpu(msg->footer.data_crc) : 0;
while (cursor->resid) {
while (cursor->total_resid) {
struct page *page;
size_t page_offset;
size_t length;
bool last_piece;
int ret;

if (!cursor->resid) {
ceph_msg_data_advance(cursor, 0);
continue;
}

page = ceph_msg_data_next(cursor, &page_offset, &length,
&last_piece);
ret = ceph_tcp_sendpage(con->sock, page, page_offset,
Expand Down Expand Up @@ -2327,7 +2332,12 @@ static int read_partial_msg_data(struct ceph_connection *con)

if (do_datacrc)
crc = con->in_data_crc;
while (cursor->resid) {
while (cursor->total_resid) {
if (!cursor->resid) {
ceph_msg_data_advance(cursor, 0);
continue;
}

page = ceph_msg_data_next(cursor, &page_offset, &length, NULL);
ret = ceph_tcp_recvpage(con->sock, page, page_offset, length);
if (ret <= 0) {
Expand Down

0 comments on commit 45a267d

Please sign in to comment.