diff options
author | Alex Elder <elder@inktank.com> | 2013-03-08 14:35:36 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:17:05 -0400 |
commit | 9d2a06c2750177dca5f8d0e89884c1d409d64bbc (patch) | |
tree | 0423695d2b76161c2c537b331464a207ea25d832 /net | |
parent | 95e072eb38f99c724739d91a1f12bb8bfe1619b5 (diff) |
libceph: kill message trail
The wart that is the ceph message trail can now be removed, because
its only user was the osd client, and the previous patch made that
no longer the case.
The result allows write_partial_msg_pages() to be simplified
considerably.
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.c | 44 |
1 files changed, 5 insertions, 39 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index d611156808b3..ff58d3182754 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -1115,8 +1115,6 @@ static void prepare_message_data(struct ceph_msg *msg, | |||
1115 | ceph_msg_data_cursor_init(&msg->p); | 1115 | ceph_msg_data_cursor_init(&msg->p); |
1116 | if (ceph_msg_has_pagelist(msg)) | 1116 | if (ceph_msg_has_pagelist(msg)) |
1117 | ceph_msg_data_cursor_init(&msg->l); | 1117 | ceph_msg_data_cursor_init(&msg->l); |
1118 | if (ceph_msg_has_trail(msg)) | ||
1119 | ceph_msg_data_cursor_init(&msg->t); | ||
1120 | 1118 | ||
1121 | msg_pos->did_page_crc = false; | 1119 | msg_pos->did_page_crc = false; |
1122 | } | 1120 | } |
@@ -1398,7 +1396,7 @@ out: | |||
1398 | } | 1396 | } |
1399 | 1397 | ||
1400 | static void out_msg_pos_next(struct ceph_connection *con, struct page *page, | 1398 | static void out_msg_pos_next(struct ceph_connection *con, struct page *page, |
1401 | size_t len, size_t sent, bool in_trail) | 1399 | size_t len, size_t sent) |
1402 | { | 1400 | { |
1403 | struct ceph_msg *msg = con->out_msg; | 1401 | struct ceph_msg *msg = con->out_msg; |
1404 | struct ceph_msg_pos *msg_pos = &con->out_msg_pos; | 1402 | struct ceph_msg_pos *msg_pos = &con->out_msg_pos; |
@@ -1409,9 +1407,7 @@ static void out_msg_pos_next(struct ceph_connection *con, struct page *page, | |||
1409 | 1407 | ||
1410 | msg_pos->data_pos += sent; | 1408 | msg_pos->data_pos += sent; |
1411 | msg_pos->page_pos += sent; | 1409 | msg_pos->page_pos += sent; |
1412 | if (in_trail) | 1410 | if (ceph_msg_has_pages(msg)) |
1413 | need_crc = ceph_msg_data_advance(&msg->t, sent); | ||
1414 | else if (ceph_msg_has_pages(msg)) | ||
1415 | need_crc = ceph_msg_data_advance(&msg->p, sent); | 1411 | need_crc = ceph_msg_data_advance(&msg->p, sent); |
1416 | else if (ceph_msg_has_pagelist(msg)) | 1412 | else if (ceph_msg_has_pagelist(msg)) |
1417 | need_crc = ceph_msg_data_advance(&msg->l, sent); | 1413 | need_crc = ceph_msg_data_advance(&msg->l, sent); |
@@ -1481,14 +1477,6 @@ static int write_partial_message_data(struct ceph_connection *con) | |||
1481 | bool do_datacrc = !con->msgr->nocrc; | 1477 | bool do_datacrc = !con->msgr->nocrc; |
1482 | int ret; | 1478 | int ret; |
1483 | int total_max_write; | 1479 | int total_max_write; |
1484 | bool in_trail = false; | ||
1485 | size_t trail_len = 0; | ||
1486 | size_t trail_off = data_len; | ||
1487 | |||
1488 | if (ceph_msg_has_trail(msg)) { | ||
1489 | trail_len = msg->t.pagelist->length; | ||
1490 | trail_off -= trail_len; | ||
1491 | } | ||
1492 | 1480 | ||
1493 | dout("%s %p msg %p page %d offset %d\n", __func__, | 1481 | dout("%s %p msg %p page %d offset %d\n", __func__, |
1494 | con, msg, msg_pos->page, msg_pos->page_pos); | 1482 | con, msg, msg_pos->page, msg_pos->page_pos); |
@@ -1508,16 +1496,9 @@ static int write_partial_message_data(struct ceph_connection *con) | |||
1508 | bool use_cursor = false; | 1496 | bool use_cursor = false; |
1509 | bool last_piece = true; /* preserve existing behavior */ | 1497 | bool last_piece = true; /* preserve existing behavior */ |
1510 | 1498 | ||
1511 | in_trail = in_trail || msg_pos->data_pos >= trail_off; | 1499 | total_max_write = data_len - msg_pos->data_pos; |
1512 | if (!in_trail) | ||
1513 | total_max_write = trail_off - msg_pos->data_pos; | ||
1514 | 1500 | ||
1515 | if (in_trail) { | 1501 | if (ceph_msg_has_pages(msg)) { |
1516 | BUG_ON(!ceph_msg_has_trail(msg)); | ||
1517 | use_cursor = true; | ||
1518 | page = ceph_msg_data_next(&msg->t, &page_offset, | ||
1519 | &length, &last_piece); | ||
1520 | } else if (ceph_msg_has_pages(msg)) { | ||
1521 | use_cursor = true; | 1502 | use_cursor = true; |
1522 | page = ceph_msg_data_next(&msg->p, &page_offset, | 1503 | page = ceph_msg_data_next(&msg->p, &page_offset, |
1523 | &length, &last_piece); | 1504 | &length, &last_piece); |
@@ -1552,7 +1533,7 @@ static int write_partial_message_data(struct ceph_connection *con) | |||
1552 | if (ret <= 0) | 1533 | if (ret <= 0) |
1553 | goto out; | 1534 | goto out; |
1554 | 1535 | ||
1555 | out_msg_pos_next(con, page, length, (size_t) ret, in_trail); | 1536 | out_msg_pos_next(con, page, length, (size_t) ret); |
1556 | } | 1537 | } |
1557 | 1538 | ||
1558 | dout("%s %p msg %p done\n", __func__, con, msg); | 1539 | dout("%s %p msg %p done\n", __func__, con, msg); |
@@ -3145,17 +3126,6 @@ void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio) | |||
3145 | } | 3126 | } |
3146 | EXPORT_SYMBOL(ceph_msg_data_set_bio); | 3127 | EXPORT_SYMBOL(ceph_msg_data_set_bio); |
3147 | 3128 | ||
3148 | void ceph_msg_data_set_trail(struct ceph_msg *msg, struct ceph_pagelist *trail) | ||
3149 | { | ||
3150 | BUG_ON(!trail); | ||
3151 | BUG_ON(!trail->length); | ||
3152 | BUG_ON(msg->b.type != CEPH_MSG_DATA_NONE); | ||
3153 | |||
3154 | msg->t.type = CEPH_MSG_DATA_PAGELIST; | ||
3155 | msg->t.pagelist = trail; | ||
3156 | } | ||
3157 | EXPORT_SYMBOL(ceph_msg_data_set_trail); | ||
3158 | |||
3159 | /* | 3129 | /* |
3160 | * construct a new message with given type, size | 3130 | * construct a new message with given type, size |
3161 | * the new msg has a ref count of 1. | 3131 | * the new msg has a ref count of 1. |
@@ -3179,7 +3149,6 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | |||
3179 | ceph_msg_data_init(&m->p); | 3149 | ceph_msg_data_init(&m->p); |
3180 | ceph_msg_data_init(&m->l); | 3150 | ceph_msg_data_init(&m->l); |
3181 | ceph_msg_data_init(&m->b); | 3151 | ceph_msg_data_init(&m->b); |
3182 | ceph_msg_data_init(&m->t); | ||
3183 | 3152 | ||
3184 | /* front */ | 3153 | /* front */ |
3185 | m->front_max = front_len; | 3154 | m->front_max = front_len; |
@@ -3345,9 +3314,6 @@ void ceph_msg_last_put(struct kref *kref) | |||
3345 | m->l.pagelist = NULL; | 3314 | m->l.pagelist = NULL; |
3346 | } | 3315 | } |
3347 | 3316 | ||
3348 | if (ceph_msg_has_trail(m)) | ||
3349 | m->t.pagelist = NULL; | ||
3350 | |||
3351 | if (m->pool) | 3317 | if (m->pool) |
3352 | ceph_msgpool_put(m->pool, m); | 3318 | ceph_msgpool_put(m->pool, m); |
3353 | else | 3319 | else |