aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-12 00:34:23 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:17:36 -0400
commit8ea299bcbc85aeaf5348d99614b35433287bec6b (patch)
treee6a0c2d656d96af9b0adb963b63a19bed812c9dc /net
parent143334ff446d634fcd3145919b5cddcc9148a74a (diff)
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/4428 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/messenger.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index cb8b571ce79a..dd4b8226a48a 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1383,40 +1383,6 @@ out:
1383 return ret; /* done! */ 1383 return ret; /* done! */
1384} 1384}
1385 1385
1386static void out_msg_pos_next(struct ceph_connection *con, struct page *page,
1387 size_t len, size_t sent)
1388{
1389 struct ceph_msg *msg = con->out_msg;
1390 bool need_crc;
1391
1392 BUG_ON(!msg);
1393 BUG_ON(!sent);
1394
1395 need_crc = ceph_msg_data_advance(&msg->data, sent);
1396 BUG_ON(need_crc && sent != len);
1397
1398 if (sent < len)
1399 return;
1400
1401 BUG_ON(sent != len);
1402}
1403
1404static void in_msg_pos_next(struct ceph_connection *con, size_t len,
1405 size_t received)
1406{
1407 struct ceph_msg *msg = con->in_msg;
1408
1409 BUG_ON(!msg);
1410 BUG_ON(!received);
1411
1412 (void) ceph_msg_data_advance(&msg->data, received);
1413
1414 if (received < len)
1415 return;
1416
1417 BUG_ON(received != len);
1418}
1419
1420static u32 ceph_crc32c_page(u32 crc, struct page *page, 1386static u32 ceph_crc32c_page(u32 crc, struct page *page,
1421 unsigned int page_offset, 1387 unsigned int page_offset,
1422 unsigned int length) 1388 unsigned int length)
@@ -1463,6 +1429,7 @@ static int write_partial_message_data(struct ceph_connection *con)
1463 size_t page_offset; 1429 size_t page_offset;
1464 size_t length; 1430 size_t length;
1465 bool last_piece; 1431 bool last_piece;
1432 bool need_crc;
1466 int ret; 1433 int ret;
1467 1434
1468 page = ceph_msg_data_next(&msg->data, &page_offset, &length, 1435 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 } 1444 }
1478 if (do_datacrc && cursor->need_crc) 1445 if (do_datacrc && cursor->need_crc)
1479 crc = ceph_crc32c_page(crc, page, page_offset, length); 1446 crc = ceph_crc32c_page(crc, page, page_offset, length);
1480 out_msg_pos_next(con, page, length, (size_t) ret); 1447 need_crc = ceph_msg_data_advance(&msg->data, (size_t) ret);
1481 } 1448 }
1482 1449
1483 dout("%s %p msg %p done\n", __func__, con, msg); 1450 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 2131
2165 if (do_datacrc) 2132 if (do_datacrc)
2166 crc = ceph_crc32c_page(crc, page, page_offset, ret); 2133 crc = ceph_crc32c_page(crc, page, page_offset, ret);
2167 in_msg_pos_next(con, length, ret); 2134 (void) ceph_msg_data_advance(&msg->data, (size_t) ret);
2168 } 2135 }
2169 if (do_datacrc) 2136 if (do_datacrc)
2170 con->in_data_crc = crc; 2137 con->in_data_crc = crc;