Lines Matching refs:msg
528 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; in ceph_tcp_recvmsg() local
531 r = kernel_recvmsg(sock, &msg, &iov, 1, len, msg.msg_flags); in ceph_tcp_recvmsg()
560 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; in ceph_tcp_sendmsg() local
564 msg.msg_flags |= MSG_MORE; in ceph_tcp_sendmsg()
566 msg.msg_flags |= MSG_EOR; /* superfluous, but what the hell */ in ceph_tcp_sendmsg()
568 r = kernel_sendmsg(sock, &msg, iov, kvlen, len); in ceph_tcp_sendmsg()
636 static void ceph_msg_remove(struct ceph_msg *msg) in ceph_msg_remove() argument
638 list_del_init(&msg->list_head); in ceph_msg_remove()
639 BUG_ON(msg->con == NULL); in ceph_msg_remove()
640 msg->con->ops->put(msg->con); in ceph_msg_remove()
641 msg->con = NULL; in ceph_msg_remove()
643 ceph_msg_put(msg); in ceph_msg_remove()
648 struct ceph_msg *msg = list_first_entry(head, struct ceph_msg, in ceph_msg_remove_list() local
650 ceph_msg_remove(msg); in ceph_msg_remove_list()
1111 static void ceph_msg_data_cursor_init(struct ceph_msg *msg, size_t length) in ceph_msg_data_cursor_init() argument
1113 struct ceph_msg_data_cursor *cursor = &msg->cursor; in ceph_msg_data_cursor_init()
1117 BUG_ON(length > msg->data_length); in ceph_msg_data_cursor_init()
1118 BUG_ON(list_empty(&msg->data)); in ceph_msg_data_cursor_init()
1120 cursor->data_head = &msg->data; in ceph_msg_data_cursor_init()
1122 data = list_first_entry(&msg->data, struct ceph_msg_data, links); in ceph_msg_data_cursor_init()
1213 static void prepare_message_data(struct ceph_msg *msg, u32 data_len) in prepare_message_data() argument
1215 BUG_ON(!msg); in prepare_message_data()
1220 ceph_msg_data_cursor_init(msg, (size_t)data_len); in prepare_message_data()
1549 struct ceph_msg *msg = con->out_msg; in write_partial_message_data() local
1550 struct ceph_msg_data_cursor *cursor = &msg->cursor; in write_partial_message_data()
1554 dout("%s %p msg %p\n", __func__, con, msg); in write_partial_message_data()
1556 if (list_empty(&msg->data)) in write_partial_message_data()
1567 crc = do_datacrc ? le32_to_cpu(msg->footer.data_crc) : 0; in write_partial_message_data()
1576 page = ceph_msg_data_next(&msg->cursor, &page_offset, &length, in write_partial_message_data()
1582 msg->footer.data_crc = cpu_to_le32(crc); in write_partial_message_data()
1588 need_crc = ceph_msg_data_advance(&msg->cursor, (size_t)ret); in write_partial_message_data()
1591 dout("%s %p msg %p done\n", __func__, con, msg); in write_partial_message_data()
1595 msg->footer.data_crc = cpu_to_le32(crc); in write_partial_message_data()
1597 msg->footer.flags |= CEPH_MSG_FOOTER_NOCRC; in write_partial_message_data()
2249 struct ceph_msg *msg = con->in_msg; in read_partial_msg_data() local
2250 struct ceph_msg_data_cursor *cursor = &msg->cursor; in read_partial_msg_data()
2258 BUG_ON(!msg); in read_partial_msg_data()
2259 if (list_empty(&msg->data)) in read_partial_msg_data()
2265 page = ceph_msg_data_next(&msg->cursor, &page_offset, &length, in read_partial_msg_data()
2277 (void) ceph_msg_data_advance(&msg->cursor, (size_t)ret); in read_partial_msg_data()
2464 struct ceph_msg *msg; in process_message() local
2468 msg = con->in_msg; in process_message()
2474 con->peer_name = msg->hdr.src; in process_message()
2480 msg, le64_to_cpu(msg->hdr.seq), in process_message()
2481 ENTITY_NAME(msg->hdr.src), in process_message()
2482 le16_to_cpu(msg->hdr.type), in process_message()
2483 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), in process_message()
2484 le32_to_cpu(msg->hdr.front_len), in process_message()
2485 le32_to_cpu(msg->hdr.data_len), in process_message()
2487 con->ops->dispatch(con, msg); in process_message()
3000 void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg) in ceph_con_send() argument
3003 msg->hdr.src = con->msgr->inst.name; in ceph_con_send()
3004 BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len)); in ceph_con_send()
3005 msg->needs_out_seq = true; in ceph_con_send()
3010 dout("con_send %p closed, dropping %p\n", con, msg); in ceph_con_send()
3011 ceph_msg_put(msg); in ceph_con_send()
3016 BUG_ON(msg->con != NULL); in ceph_con_send()
3017 msg->con = con->ops->get(con); in ceph_con_send()
3018 BUG_ON(msg->con == NULL); in ceph_con_send()
3020 BUG_ON(!list_empty(&msg->list_head)); in ceph_con_send()
3021 list_add_tail(&msg->list_head, &con->out_queue); in ceph_con_send()
3022 dout("----- %p to %s%lld %d=%s len %d+%d+%d -----\n", msg, in ceph_con_send()
3023 ENTITY_NAME(con->peer_name), le16_to_cpu(msg->hdr.type), in ceph_con_send()
3024 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), in ceph_con_send()
3025 le32_to_cpu(msg->hdr.front_len), in ceph_con_send()
3026 le32_to_cpu(msg->hdr.middle_len), in ceph_con_send()
3027 le32_to_cpu(msg->hdr.data_len)); in ceph_con_send()
3042 void ceph_msg_revoke(struct ceph_msg *msg) in ceph_msg_revoke() argument
3044 struct ceph_connection *con = msg->con; in ceph_msg_revoke()
3050 if (!list_empty(&msg->list_head)) { in ceph_msg_revoke()
3051 dout("%s %p msg %p - was on queue\n", __func__, con, msg); in ceph_msg_revoke()
3052 list_del_init(&msg->list_head); in ceph_msg_revoke()
3053 BUG_ON(msg->con == NULL); in ceph_msg_revoke()
3054 msg->con->ops->put(msg->con); in ceph_msg_revoke()
3055 msg->con = NULL; in ceph_msg_revoke()
3056 msg->hdr.seq = 0; in ceph_msg_revoke()
3058 ceph_msg_put(msg); in ceph_msg_revoke()
3060 if (con->out_msg == msg) { in ceph_msg_revoke()
3066 BUG_ON(!msg->data_length); in ceph_msg_revoke()
3068 con->out_skip += sizeof(msg->footer); in ceph_msg_revoke()
3070 con->out_skip += sizeof(msg->old_footer); in ceph_msg_revoke()
3073 if (msg->data_length) in ceph_msg_revoke()
3074 con->out_skip += msg->cursor.total_resid; in ceph_msg_revoke()
3075 if (msg->middle) in ceph_msg_revoke()
3080 __func__, con, msg, con->out_kvec_bytes, con->out_skip); in ceph_msg_revoke()
3081 msg->hdr.seq = 0; in ceph_msg_revoke()
3083 ceph_msg_put(msg); in ceph_msg_revoke()
3092 void ceph_msg_revoke_incoming(struct ceph_msg *msg) in ceph_msg_revoke_incoming() argument
3096 BUG_ON(msg == NULL); in ceph_msg_revoke_incoming()
3097 if (!msg->con) { in ceph_msg_revoke_incoming()
3098 dout("%s msg %p null con\n", __func__, msg); in ceph_msg_revoke_incoming()
3103 con = msg->con; in ceph_msg_revoke_incoming()
3105 if (con->in_msg == msg) { in ceph_msg_revoke_incoming()
3111 dout("%s %p msg %p revoked\n", __func__, con, msg); in ceph_msg_revoke_incoming()
3124 __func__, con, con->in_msg, msg); in ceph_msg_revoke_incoming()
3170 void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, in ceph_msg_data_add_pages() argument
3184 list_add_tail(&data->links, &msg->data); in ceph_msg_data_add_pages()
3185 msg->data_length += length; in ceph_msg_data_add_pages()
3189 void ceph_msg_data_add_pagelist(struct ceph_msg *msg, in ceph_msg_data_add_pagelist() argument
3201 list_add_tail(&data->links, &msg->data); in ceph_msg_data_add_pagelist()
3202 msg->data_length += pagelist->length; in ceph_msg_data_add_pagelist()
3207 void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio, in ceph_msg_data_add_bio() argument
3219 list_add_tail(&data->links, &msg->data); in ceph_msg_data_add_bio()
3220 msg->data_length += length; in ceph_msg_data_add_bio()
3284 static int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg) in ceph_alloc_middle() argument
3286 int type = le16_to_cpu(msg->hdr.type); in ceph_alloc_middle()
3287 int middle_len = le32_to_cpu(msg->hdr.middle_len); in ceph_alloc_middle()
3289 dout("alloc_middle %p type %d %s middle_len %d\n", msg, type, in ceph_alloc_middle()
3292 BUG_ON(msg->middle); in ceph_alloc_middle()
3294 msg->middle = ceph_buffer_new(middle_len, GFP_NOFS); in ceph_alloc_middle()
3295 if (!msg->middle) in ceph_alloc_middle()
3319 struct ceph_msg *msg; in ceph_con_in_msg_alloc() local
3326 msg = con->ops->alloc_msg(con, hdr, skip); in ceph_con_in_msg_alloc()
3329 if (msg) in ceph_con_in_msg_alloc()
3330 ceph_msg_put(msg); in ceph_con_in_msg_alloc()
3333 if (msg) { in ceph_con_in_msg_alloc()
3335 con->in_msg = msg; in ceph_con_in_msg_alloc()
3406 struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) in ceph_msg_get() argument
3408 dout("%s %p (was %d)\n", __func__, msg, in ceph_msg_get()
3409 atomic_read(&msg->kref.refcount)); in ceph_msg_get()
3410 kref_get(&msg->kref); in ceph_msg_get()
3411 return msg; in ceph_msg_get()
3415 void ceph_msg_put(struct ceph_msg *msg) in ceph_msg_put() argument
3417 dout("%s %p (was %d)\n", __func__, msg, in ceph_msg_put()
3418 atomic_read(&msg->kref.refcount)); in ceph_msg_put()
3419 kref_put(&msg->kref, ceph_msg_release); in ceph_msg_put()
3423 void ceph_msg_dump(struct ceph_msg *msg) in ceph_msg_dump() argument
3425 pr_debug("msg_dump %p (front_alloc_len %d length %zd)\n", msg, in ceph_msg_dump()
3426 msg->front_alloc_len, msg->data_length); in ceph_msg_dump()
3429 &msg->hdr, sizeof(msg->hdr), true); in ceph_msg_dump()
3432 msg->front.iov_base, msg->front.iov_len, true); in ceph_msg_dump()
3433 if (msg->middle) in ceph_msg_dump()
3436 msg->middle->vec.iov_base, in ceph_msg_dump()
3437 msg->middle->vec.iov_len, true); in ceph_msg_dump()
3440 &msg->footer, sizeof(msg->footer), true); in ceph_msg_dump()