Commit 859a35d5 authored by Alex Elder's avatar Alex Elder Committed by Sage Weil

libceph: kill most of ceph_msg_pos

All but one of the fields in the ceph_msg_pos structure are now
never used (only assigned), so get rid of them.  This allows
several small blocks of code to go away.

This is cleanup of old code 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 643c68a4
...@@ -157,8 +157,6 @@ struct ceph_msg { ...@@ -157,8 +157,6 @@ struct ceph_msg {
}; };
struct ceph_msg_pos { struct ceph_msg_pos {
int page, page_pos; /* which page; offset in page */
int data_pos; /* offset in data payload */
bool did_page_crc; /* true if we've calculated crc for current page */ bool did_page_crc; /* true if we've calculated crc for current page */
}; };
......
...@@ -1083,14 +1083,6 @@ static void prepare_message_data(struct ceph_msg *msg, ...@@ -1083,14 +1083,6 @@ static void prepare_message_data(struct ceph_msg *msg,
data_len = le32_to_cpu(msg->hdr.data_len); data_len = le32_to_cpu(msg->hdr.data_len);
BUG_ON(!data_len); BUG_ON(!data_len);
/* initialize page iterator */
msg_pos->page = 0;
if (ceph_msg_has_data(msg))
msg_pos->page_pos = msg->data.alignment;
else
msg_pos->page_pos = 0;
msg_pos->data_pos = 0;
/* Initialize data cursor */ /* Initialize data cursor */
ceph_msg_data_cursor_init(&msg->data, data_len); ceph_msg_data_cursor_init(&msg->data, data_len);
...@@ -1402,8 +1394,6 @@ static void out_msg_pos_next(struct ceph_connection *con, struct page *page, ...@@ -1402,8 +1394,6 @@ static void out_msg_pos_next(struct ceph_connection *con, struct page *page,
BUG_ON(!msg); BUG_ON(!msg);
BUG_ON(!sent); BUG_ON(!sent);
msg_pos->data_pos += sent;
msg_pos->page_pos += sent;
need_crc = ceph_msg_data_advance(&msg->data, sent); need_crc = ceph_msg_data_advance(&msg->data, sent);
BUG_ON(need_crc && sent != len); BUG_ON(need_crc && sent != len);
...@@ -1411,8 +1401,6 @@ static void out_msg_pos_next(struct ceph_connection *con, struct page *page, ...@@ -1411,8 +1401,6 @@ static void out_msg_pos_next(struct ceph_connection *con, struct page *page,
return; return;
BUG_ON(sent != len); BUG_ON(sent != len);
msg_pos->page_pos = 0;
msg_pos->page++;
msg_pos->did_page_crc = false; msg_pos->did_page_crc = false;
} }
...@@ -1420,21 +1408,16 @@ static void in_msg_pos_next(struct ceph_connection *con, size_t len, ...@@ -1420,21 +1408,16 @@ static void in_msg_pos_next(struct ceph_connection *con, size_t len,
size_t received) size_t received)
{ {
struct ceph_msg *msg = con->in_msg; struct ceph_msg *msg = con->in_msg;
struct ceph_msg_pos *msg_pos = &con->in_msg_pos;
BUG_ON(!msg); BUG_ON(!msg);
BUG_ON(!received); BUG_ON(!received);
msg_pos->data_pos += received;
msg_pos->page_pos += received;
(void) ceph_msg_data_advance(&msg->data, received); (void) ceph_msg_data_advance(&msg->data, received);
if (received < len) if (received < len)
return; return;
BUG_ON(received != len); BUG_ON(received != len);
msg_pos->page_pos = 0;
msg_pos->page++;
} }
static u32 ceph_crc32c_page(u32 crc, struct page *page, static u32 ceph_crc32c_page(u32 crc, struct page *page,
...@@ -1465,8 +1448,7 @@ static int write_partial_message_data(struct ceph_connection *con) ...@@ -1465,8 +1448,7 @@ static int write_partial_message_data(struct ceph_connection *con)
bool do_datacrc = !con->msgr->nocrc; bool do_datacrc = !con->msgr->nocrc;
int ret; int ret;
dout("%s %p msg %p page %d offset %d\n", __func__, dout("%s %p msg %p\n", __func__, con, msg);
con, msg, msg_pos->page, msg_pos->page_pos);
if (WARN_ON(!ceph_msg_has_data(msg))) if (WARN_ON(!ceph_msg_has_data(msg)))
return -EINVAL; return -EINVAL;
...@@ -2159,7 +2141,6 @@ static int read_partial_msg_data(struct ceph_connection *con) ...@@ -2159,7 +2141,6 @@ static int read_partial_msg_data(struct ceph_connection *con)
struct ceph_msg *msg = con->in_msg; struct ceph_msg *msg = con->in_msg;
struct ceph_msg_data_cursor *cursor = &msg->data.cursor; struct ceph_msg_data_cursor *cursor = &msg->data.cursor;
const bool do_datacrc = !con->msgr->nocrc; const bool do_datacrc = !con->msgr->nocrc;
unsigned int data_len;
struct page *page; struct page *page;
size_t page_offset; size_t page_offset;
size_t length; size_t length;
...@@ -2169,7 +2150,6 @@ static int read_partial_msg_data(struct ceph_connection *con) ...@@ -2169,7 +2150,6 @@ static int read_partial_msg_data(struct ceph_connection *con)
if (WARN_ON(!ceph_msg_has_data(msg))) if (WARN_ON(!ceph_msg_has_data(msg)))
return -EIO; return -EIO;
data_len = le32_to_cpu(con->in_hdr.data_len);
while (cursor->resid) { while (cursor->resid) {
page = ceph_msg_data_next(&msg->data, &page_offset, &length, page = ceph_msg_data_next(&msg->data, &page_offset, &length,
NULL); NULL);
......
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