Commit 8ea299bc authored by Alex Elder's avatar Alex Elder Committed by Sage Weil

libceph: use only ceph_msg_data_advance()

The *_msg_pos_next() functions do little more than call
ceph_msg_data_advance().  Replace those wrapper functions with
a simple call to ceph_msg_data_advance().

This cleanup is related to:
    http://tracker.ceph.com/issues/4428Signed-off-by: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent 143334ff
...@@ -1383,40 +1383,6 @@ static int write_partial_kvec(struct ceph_connection *con) ...@@ -1383,40 +1383,6 @@ static int write_partial_kvec(struct ceph_connection *con)
return ret; /* done! */ return ret; /* done! */
} }
static void out_msg_pos_next(struct ceph_connection *con, struct page *page,
size_t len, size_t sent)
{
struct ceph_msg *msg = con->out_msg;
bool need_crc;
BUG_ON(!msg);
BUG_ON(!sent);
need_crc = ceph_msg_data_advance(&msg->data, sent);
BUG_ON(need_crc && sent != len);
if (sent < len)
return;
BUG_ON(sent != len);
}
static void in_msg_pos_next(struct ceph_connection *con, size_t len,
size_t received)
{
struct ceph_msg *msg = con->in_msg;
BUG_ON(!msg);
BUG_ON(!received);
(void) ceph_msg_data_advance(&msg->data, received);
if (received < len)
return;
BUG_ON(received != len);
}
static u32 ceph_crc32c_page(u32 crc, struct page *page, static u32 ceph_crc32c_page(u32 crc, struct page *page,
unsigned int page_offset, unsigned int page_offset,
unsigned int length) unsigned int length)
...@@ -1463,6 +1429,7 @@ static int write_partial_message_data(struct ceph_connection *con) ...@@ -1463,6 +1429,7 @@ static int write_partial_message_data(struct ceph_connection *con)
size_t page_offset; size_t page_offset;
size_t length; size_t length;
bool last_piece; bool last_piece;
bool need_crc;
int ret; int ret;
page = ceph_msg_data_next(&msg->data, &page_offset, &length, page = ceph_msg_data_next(&msg->data, &page_offset, &length,
...@@ -1477,7 +1444,7 @@ static int write_partial_message_data(struct ceph_connection *con) ...@@ -1477,7 +1444,7 @@ static int write_partial_message_data(struct ceph_connection *con)
} }
if (do_datacrc && cursor->need_crc) if (do_datacrc && cursor->need_crc)
crc = ceph_crc32c_page(crc, page, page_offset, length); crc = ceph_crc32c_page(crc, page, page_offset, length);
out_msg_pos_next(con, page, length, (size_t) ret); need_crc = ceph_msg_data_advance(&msg->data, (size_t) ret);
} }
dout("%s %p msg %p done\n", __func__, con, msg); dout("%s %p msg %p done\n", __func__, con, msg);
...@@ -2164,7 +2131,7 @@ static int read_partial_msg_data(struct ceph_connection *con) ...@@ -2164,7 +2131,7 @@ static int read_partial_msg_data(struct ceph_connection *con)
if (do_datacrc) if (do_datacrc)
crc = ceph_crc32c_page(crc, page, page_offset, ret); crc = ceph_crc32c_page(crc, page, page_offset, ret);
in_msg_pos_next(con, length, ret); (void) ceph_msg_data_advance(&msg->data, (size_t) ret);
} }
if (do_datacrc) if (do_datacrc)
con->in_data_crc = crc; con->in_data_crc = 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