Lines Matching refs:msg

529 	struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL };  in ceph_tcp_recvmsg()  local
532 r = kernel_recvmsg(sock, &msg, &iov, 1, len, msg.msg_flags); in ceph_tcp_recvmsg()
561 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; in ceph_tcp_sendmsg() local
565 msg.msg_flags |= MSG_MORE; in ceph_tcp_sendmsg()
567 msg.msg_flags |= MSG_EOR; /* superfluous, but what the hell */ in ceph_tcp_sendmsg()
569 r = kernel_sendmsg(sock, &msg, iov, kvlen, len); in ceph_tcp_sendmsg()
637 static void ceph_msg_remove(struct ceph_msg *msg) in ceph_msg_remove() argument
639 list_del_init(&msg->list_head); in ceph_msg_remove()
641 ceph_msg_put(msg); in ceph_msg_remove()
646 struct ceph_msg *msg = list_first_entry(head, struct ceph_msg, in ceph_msg_remove_list() local
648 ceph_msg_remove(msg); in ceph_msg_remove_list()
1108 static void ceph_msg_data_cursor_init(struct ceph_msg *msg, size_t length) in ceph_msg_data_cursor_init() argument
1110 struct ceph_msg_data_cursor *cursor = &msg->cursor; in ceph_msg_data_cursor_init()
1114 BUG_ON(length > msg->data_length); in ceph_msg_data_cursor_init()
1115 BUG_ON(list_empty(&msg->data)); in ceph_msg_data_cursor_init()
1117 cursor->data_head = &msg->data; in ceph_msg_data_cursor_init()
1119 data = list_first_entry(&msg->data, struct ceph_msg_data, links); in ceph_msg_data_cursor_init()
1210 static void prepare_message_data(struct ceph_msg *msg, u32 data_len) in prepare_message_data() argument
1212 BUG_ON(!msg); in prepare_message_data()
1217 ceph_msg_data_cursor_init(msg, (size_t)data_len); in prepare_message_data()
1556 struct ceph_msg *msg = con->out_msg; in write_partial_message_data() local
1557 struct ceph_msg_data_cursor *cursor = &msg->cursor; in write_partial_message_data()
1561 dout("%s %p msg %p\n", __func__, con, msg); in write_partial_message_data()
1563 if (list_empty(&msg->data)) in write_partial_message_data()
1574 crc = do_datacrc ? le32_to_cpu(msg->footer.data_crc) : 0; in write_partial_message_data()
1589 msg->footer.data_crc = cpu_to_le32(crc); in write_partial_message_data()
1598 dout("%s %p msg %p done\n", __func__, con, msg); in write_partial_message_data()
1602 msg->footer.data_crc = cpu_to_le32(crc); in write_partial_message_data()
1604 msg->footer.flags |= CEPH_MSG_FOOTER_NOCRC; in write_partial_message_data()
2262 struct ceph_msg *msg = con->in_msg; in read_partial_msg_data() local
2263 struct ceph_msg_data_cursor *cursor = &msg->cursor; in read_partial_msg_data()
2271 BUG_ON(!msg); in read_partial_msg_data()
2272 if (list_empty(&msg->data)) in read_partial_msg_data()
2469 struct ceph_msg *msg = con->in_msg; in process_message() local
2476 con->peer_name = msg->hdr.src; in process_message()
2482 msg, le64_to_cpu(msg->hdr.seq), in process_message()
2483 ENTITY_NAME(msg->hdr.src), in process_message()
2484 le16_to_cpu(msg->hdr.type), in process_message()
2485 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), in process_message()
2486 le32_to_cpu(msg->hdr.front_len), in process_message()
2487 le32_to_cpu(msg->hdr.data_len), in process_message()
2489 con->ops->dispatch(con, msg); in process_message()
3003 static void msg_con_set(struct ceph_msg *msg, struct ceph_connection *con) in msg_con_set() argument
3005 if (msg->con) in msg_con_set()
3006 msg->con->ops->put(msg->con); in msg_con_set()
3008 msg->con = con ? con->ops->get(con) : NULL; in msg_con_set()
3009 BUG_ON(msg->con != con); in msg_con_set()
3027 void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg) in ceph_con_send() argument
3030 msg->hdr.src = con->msgr->inst.name; in ceph_con_send()
3031 BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len)); in ceph_con_send()
3032 msg->needs_out_seq = true; in ceph_con_send()
3037 dout("con_send %p closed, dropping %p\n", con, msg); in ceph_con_send()
3038 ceph_msg_put(msg); in ceph_con_send()
3043 msg_con_set(msg, con); in ceph_con_send()
3045 BUG_ON(!list_empty(&msg->list_head)); in ceph_con_send()
3046 list_add_tail(&msg->list_head, &con->out_queue); in ceph_con_send()
3047 dout("----- %p to %s%lld %d=%s len %d+%d+%d -----\n", msg, in ceph_con_send()
3048 ENTITY_NAME(con->peer_name), le16_to_cpu(msg->hdr.type), in ceph_con_send()
3049 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), in ceph_con_send()
3050 le32_to_cpu(msg->hdr.front_len), in ceph_con_send()
3051 le32_to_cpu(msg->hdr.middle_len), in ceph_con_send()
3052 le32_to_cpu(msg->hdr.data_len)); in ceph_con_send()
3067 void ceph_msg_revoke(struct ceph_msg *msg) in ceph_msg_revoke() argument
3069 struct ceph_connection *con = msg->con; in ceph_msg_revoke()
3072 dout("%s msg %p null con\n", __func__, msg); in ceph_msg_revoke()
3077 if (!list_empty(&msg->list_head)) { in ceph_msg_revoke()
3078 dout("%s %p msg %p - was on queue\n", __func__, con, msg); in ceph_msg_revoke()
3079 list_del_init(&msg->list_head); in ceph_msg_revoke()
3080 msg->hdr.seq = 0; in ceph_msg_revoke()
3082 ceph_msg_put(msg); in ceph_msg_revoke()
3084 if (con->out_msg == msg) { in ceph_msg_revoke()
3090 BUG_ON(!msg->data_length); in ceph_msg_revoke()
3092 con->out_skip += sizeof(msg->footer); in ceph_msg_revoke()
3094 con->out_skip += sizeof(msg->old_footer); in ceph_msg_revoke()
3097 if (msg->data_length) in ceph_msg_revoke()
3098 con->out_skip += msg->cursor.total_resid; in ceph_msg_revoke()
3099 if (msg->middle) in ceph_msg_revoke()
3104 __func__, con, msg, con->out_kvec_bytes, con->out_skip); in ceph_msg_revoke()
3105 msg->hdr.seq = 0; in ceph_msg_revoke()
3107 ceph_msg_put(msg); in ceph_msg_revoke()
3116 void ceph_msg_revoke_incoming(struct ceph_msg *msg) in ceph_msg_revoke_incoming() argument
3118 struct ceph_connection *con = msg->con; in ceph_msg_revoke_incoming()
3121 dout("%s msg %p null con\n", __func__, msg); in ceph_msg_revoke_incoming()
3126 if (con->in_msg == msg) { in ceph_msg_revoke_incoming()
3132 dout("%s %p msg %p revoked\n", __func__, con, msg); in ceph_msg_revoke_incoming()
3145 __func__, con, con->in_msg, msg); in ceph_msg_revoke_incoming()
3205 void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, in ceph_msg_data_add_pages() argument
3219 list_add_tail(&data->links, &msg->data); in ceph_msg_data_add_pages()
3220 msg->data_length += length; in ceph_msg_data_add_pages()
3224 void ceph_msg_data_add_pagelist(struct ceph_msg *msg, in ceph_msg_data_add_pagelist() argument
3236 list_add_tail(&data->links, &msg->data); in ceph_msg_data_add_pagelist()
3237 msg->data_length += pagelist->length; in ceph_msg_data_add_pagelist()
3242 void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio, in ceph_msg_data_add_bio() argument
3254 list_add_tail(&data->links, &msg->data); in ceph_msg_data_add_bio()
3255 msg->data_length += length; in ceph_msg_data_add_bio()
3319 static int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg) in ceph_alloc_middle() argument
3321 int type = le16_to_cpu(msg->hdr.type); in ceph_alloc_middle()
3322 int middle_len = le32_to_cpu(msg->hdr.middle_len); in ceph_alloc_middle()
3324 dout("alloc_middle %p type %d %s middle_len %d\n", msg, type, in ceph_alloc_middle()
3327 BUG_ON(msg->middle); in ceph_alloc_middle()
3329 msg->middle = ceph_buffer_new(middle_len, GFP_NOFS); in ceph_alloc_middle()
3330 if (!msg->middle) in ceph_alloc_middle()
3354 struct ceph_msg *msg; in ceph_con_in_msg_alloc() local
3361 msg = con->ops->alloc_msg(con, hdr, skip); in ceph_con_in_msg_alloc()
3364 if (msg) in ceph_con_in_msg_alloc()
3365 ceph_msg_put(msg); in ceph_con_in_msg_alloc()
3368 if (msg) { in ceph_con_in_msg_alloc()
3370 msg_con_set(msg, con); in ceph_con_in_msg_alloc()
3371 con->in_msg = msg; in ceph_con_in_msg_alloc()
3442 struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) in ceph_msg_get() argument
3444 dout("%s %p (was %d)\n", __func__, msg, in ceph_msg_get()
3445 atomic_read(&msg->kref.refcount)); in ceph_msg_get()
3446 kref_get(&msg->kref); in ceph_msg_get()
3447 return msg; in ceph_msg_get()
3451 void ceph_msg_put(struct ceph_msg *msg) in ceph_msg_put() argument
3453 dout("%s %p (was %d)\n", __func__, msg, in ceph_msg_put()
3454 atomic_read(&msg->kref.refcount)); in ceph_msg_put()
3455 kref_put(&msg->kref, ceph_msg_release); in ceph_msg_put()
3459 void ceph_msg_dump(struct ceph_msg *msg) in ceph_msg_dump() argument
3461 pr_debug("msg_dump %p (front_alloc_len %d length %zd)\n", msg, in ceph_msg_dump()
3462 msg->front_alloc_len, msg->data_length); in ceph_msg_dump()
3465 &msg->hdr, sizeof(msg->hdr), true); in ceph_msg_dump()
3468 msg->front.iov_base, msg->front.iov_len, true); in ceph_msg_dump()
3469 if (msg->middle) in ceph_msg_dump()
3472 msg->middle->vec.iov_base, in ceph_msg_dump()
3473 msg->middle->vec.iov_len, true); in ceph_msg_dump()
3476 &msg->footer, sizeof(msg->footer), true); in ceph_msg_dump()