diff options
| -rw-r--r-- | include/linux/ceph/messenger.h | 4 | ||||
| -rw-r--r-- | net/ceph/messenger.c | 44 |
2 files changed, 5 insertions, 43 deletions
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index b53b9ef65009..0e4536cc46f0 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
| @@ -69,7 +69,6 @@ struct ceph_messenger { | |||
| 69 | #ifdef CONFIG_BLOCK | 69 | #ifdef CONFIG_BLOCK |
| 70 | #define ceph_msg_has_bio(m) ((m)->b.type == CEPH_MSG_DATA_BIO) | 70 | #define ceph_msg_has_bio(m) ((m)->b.type == CEPH_MSG_DATA_BIO) |
| 71 | #endif /* CONFIG_BLOCK */ | 71 | #endif /* CONFIG_BLOCK */ |
| 72 | #define ceph_msg_has_trail(m) ((m)->t.type == CEPH_MSG_DATA_PAGELIST) | ||
| 73 | 72 | ||
| 74 | enum ceph_msg_data_type { | 73 | enum ceph_msg_data_type { |
| 75 | CEPH_MSG_DATA_NONE, /* message contains no data payload */ | 74 | CEPH_MSG_DATA_NONE, /* message contains no data payload */ |
| @@ -155,7 +154,6 @@ struct ceph_msg { | |||
| 155 | #ifdef CONFIG_BLOCK | 154 | #ifdef CONFIG_BLOCK |
| 156 | struct ceph_msg_data b; /* bio */ | 155 | struct ceph_msg_data b; /* bio */ |
| 157 | #endif /* CONFIG_BLOCK */ | 156 | #endif /* CONFIG_BLOCK */ |
| 158 | struct ceph_msg_data t; /* trail */ | ||
| 159 | 157 | ||
| 160 | struct ceph_connection *con; | 158 | struct ceph_connection *con; |
| 161 | struct list_head list_head; /* links for connection lists */ | 159 | struct list_head list_head; /* links for connection lists */ |
| @@ -295,8 +293,6 @@ extern void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, | |||
| 295 | extern void ceph_msg_data_set_pagelist(struct ceph_msg *msg, | 293 | extern void ceph_msg_data_set_pagelist(struct ceph_msg *msg, |
| 296 | struct ceph_pagelist *pagelist); | 294 | struct ceph_pagelist *pagelist); |
| 297 | extern void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio); | 295 | extern void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio); |
| 298 | extern void ceph_msg_data_set_trail(struct ceph_msg *msg, | ||
| 299 | struct ceph_pagelist *trail); | ||
| 300 | 296 | ||
| 301 | extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | 297 | extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, |
| 302 | bool can_fail); | 298 | bool can_fail); |
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 |
