Lines Matching refs:msg
506 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; in ceph_tcp_recvmsg() local
510 msg.msg_flags |= MSG_TRUNC; in ceph_tcp_recvmsg()
512 iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, len); in ceph_tcp_recvmsg()
513 r = sock_recvmsg(sock, &msg, msg.msg_flags); in ceph_tcp_recvmsg()
527 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; in ceph_tcp_recvpage() local
531 iov_iter_bvec(&msg.msg_iter, READ, &bvec, 1, length); in ceph_tcp_recvpage()
532 r = sock_recvmsg(sock, &msg, msg.msg_flags); in ceph_tcp_recvpage()
545 struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; in ceph_tcp_sendmsg() local
549 msg.msg_flags |= MSG_MORE; in ceph_tcp_sendmsg()
551 msg.msg_flags |= MSG_EOR; /* superfluous, but what the hell */ in ceph_tcp_sendmsg()
553 r = kernel_sendmsg(sock, &msg, iov, kvlen, len); in ceph_tcp_sendmsg()
620 static void ceph_msg_remove(struct ceph_msg *msg) in ceph_msg_remove() argument
622 list_del_init(&msg->list_head); in ceph_msg_remove()
624 ceph_msg_put(msg); in ceph_msg_remove()
629 struct ceph_msg *msg = list_first_entry(head, struct ceph_msg, in ceph_msg_remove_list() local
631 ceph_msg_remove(msg); in ceph_msg_remove_list()
1116 static void ceph_msg_data_cursor_init(struct ceph_msg *msg, size_t length) in ceph_msg_data_cursor_init() argument
1118 struct ceph_msg_data_cursor *cursor = &msg->cursor; in ceph_msg_data_cursor_init()
1121 BUG_ON(length > msg->data_length); in ceph_msg_data_cursor_init()
1122 BUG_ON(!msg->num_data_items); in ceph_msg_data_cursor_init()
1125 cursor->data = msg->data; in ceph_msg_data_cursor_init()
1220 static void prepare_message_data(struct ceph_msg *msg, u32 data_len) in prepare_message_data() argument
1224 ceph_msg_data_cursor_init(msg, (size_t)data_len); in prepare_message_data()
1554 struct ceph_msg *msg = con->out_msg; in write_partial_message_data() local
1555 struct ceph_msg_data_cursor *cursor = &msg->cursor; in write_partial_message_data()
1560 dout("%s %p msg %p\n", __func__, con, msg); in write_partial_message_data()
1562 if (!msg->num_data_items) in write_partial_message_data()
1573 crc = do_datacrc ? le32_to_cpu(msg->footer.data_crc) : 0; in write_partial_message_data()
1592 msg->footer.data_crc = cpu_to_le32(crc); in write_partial_message_data()
1601 dout("%s %p msg %p done\n", __func__, con, msg); in write_partial_message_data()
1605 msg->footer.data_crc = cpu_to_le32(crc); in write_partial_message_data()
1607 msg->footer.flags |= CEPH_MSG_FOOTER_NOCRC; in write_partial_message_data()
2312 struct ceph_msg *msg = con->in_msg; in read_partial_msg_data() local
2313 struct ceph_msg_data_cursor *cursor = &msg->cursor; in read_partial_msg_data()
2321 if (!msg->num_data_items) in read_partial_msg_data()
2519 struct ceph_msg *msg = con->in_msg; in process_message() local
2526 con->peer_name = msg->hdr.src; in process_message()
2532 msg, le64_to_cpu(msg->hdr.seq), in process_message()
2533 ENTITY_NAME(msg->hdr.src), in process_message()
2534 le16_to_cpu(msg->hdr.type), in process_message()
2535 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), in process_message()
2536 le32_to_cpu(msg->hdr.front_len), in process_message()
2537 le32_to_cpu(msg->hdr.data_len), in process_message()
2539 con->ops->dispatch(con, msg); in process_message()
3066 static void msg_con_set(struct ceph_msg *msg, struct ceph_connection *con) in msg_con_set() argument
3068 if (msg->con) in msg_con_set()
3069 msg->con->ops->put(msg->con); in msg_con_set()
3071 msg->con = con ? con->ops->get(con) : NULL; in msg_con_set()
3072 BUG_ON(msg->con != con); in msg_con_set()
3090 void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg) in ceph_con_send() argument
3093 msg->hdr.src = con->msgr->inst.name; in ceph_con_send()
3094 BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len)); in ceph_con_send()
3095 msg->needs_out_seq = true; in ceph_con_send()
3100 dout("con_send %p closed, dropping %p\n", con, msg); in ceph_con_send()
3101 ceph_msg_put(msg); in ceph_con_send()
3106 msg_con_set(msg, con); in ceph_con_send()
3108 BUG_ON(!list_empty(&msg->list_head)); in ceph_con_send()
3109 list_add_tail(&msg->list_head, &con->out_queue); in ceph_con_send()
3110 dout("----- %p to %s%lld %d=%s len %d+%d+%d -----\n", msg, in ceph_con_send()
3111 ENTITY_NAME(con->peer_name), le16_to_cpu(msg->hdr.type), in ceph_con_send()
3112 ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), in ceph_con_send()
3113 le32_to_cpu(msg->hdr.front_len), in ceph_con_send()
3114 le32_to_cpu(msg->hdr.middle_len), in ceph_con_send()
3115 le32_to_cpu(msg->hdr.data_len)); in ceph_con_send()
3130 void ceph_msg_revoke(struct ceph_msg *msg) in ceph_msg_revoke() argument
3132 struct ceph_connection *con = msg->con; in ceph_msg_revoke()
3135 dout("%s msg %p null con\n", __func__, msg); in ceph_msg_revoke()
3140 if (!list_empty(&msg->list_head)) { in ceph_msg_revoke()
3141 dout("%s %p msg %p - was on queue\n", __func__, con, msg); in ceph_msg_revoke()
3142 list_del_init(&msg->list_head); in ceph_msg_revoke()
3143 msg->hdr.seq = 0; in ceph_msg_revoke()
3145 ceph_msg_put(msg); in ceph_msg_revoke()
3147 if (con->out_msg == msg) { in ceph_msg_revoke()
3153 BUG_ON(!msg->data_length); in ceph_msg_revoke()
3157 if (msg->data_length) in ceph_msg_revoke()
3158 con->out_skip += msg->cursor.total_resid; in ceph_msg_revoke()
3159 if (msg->middle) in ceph_msg_revoke()
3164 __func__, con, msg, con->out_kvec_bytes, con->out_skip); in ceph_msg_revoke()
3165 msg->hdr.seq = 0; in ceph_msg_revoke()
3167 ceph_msg_put(msg); in ceph_msg_revoke()
3176 void ceph_msg_revoke_incoming(struct ceph_msg *msg) in ceph_msg_revoke_incoming() argument
3178 struct ceph_connection *con = msg->con; in ceph_msg_revoke_incoming()
3181 dout("%s msg %p null con\n", __func__, msg); in ceph_msg_revoke_incoming()
3186 if (con->in_msg == msg) { in ceph_msg_revoke_incoming()
3192 dout("%s %p msg %p revoked\n", __func__, con, msg); in ceph_msg_revoke_incoming()
3205 __func__, con, con->in_msg, msg); in ceph_msg_revoke_incoming()
3241 static struct ceph_msg_data *ceph_msg_data_add(struct ceph_msg *msg) in ceph_msg_data_add() argument
3243 BUG_ON(msg->num_data_items >= msg->max_data_items); in ceph_msg_data_add()
3244 return &msg->data[msg->num_data_items++]; in ceph_msg_data_add()
3257 void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, in ceph_msg_data_add_pages() argument
3265 data = ceph_msg_data_add(msg); in ceph_msg_data_add_pages()
3272 msg->data_length += length; in ceph_msg_data_add_pages()
3276 void ceph_msg_data_add_pagelist(struct ceph_msg *msg, in ceph_msg_data_add_pagelist() argument
3284 data = ceph_msg_data_add(msg); in ceph_msg_data_add_pagelist()
3289 msg->data_length += pagelist->length; in ceph_msg_data_add_pagelist()
3294 void ceph_msg_data_add_bio(struct ceph_msg *msg, struct ceph_bio_iter *bio_pos, in ceph_msg_data_add_bio() argument
3299 data = ceph_msg_data_add(msg); in ceph_msg_data_add_bio()
3304 msg->data_length += length; in ceph_msg_data_add_bio()
3309 void ceph_msg_data_add_bvecs(struct ceph_msg *msg, in ceph_msg_data_add_bvecs() argument
3314 data = ceph_msg_data_add(msg); in ceph_msg_data_add_bvecs()
3318 msg->data_length += bvec_pos->iter.bi_size; in ceph_msg_data_add_bvecs()
3396 static int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg) in ceph_alloc_middle() argument
3398 int type = le16_to_cpu(msg->hdr.type); in ceph_alloc_middle()
3399 int middle_len = le32_to_cpu(msg->hdr.middle_len); in ceph_alloc_middle()
3401 dout("alloc_middle %p type %d %s middle_len %d\n", msg, type, in ceph_alloc_middle()
3404 BUG_ON(msg->middle); in ceph_alloc_middle()
3406 msg->middle = ceph_buffer_new(middle_len, GFP_NOFS); in ceph_alloc_middle()
3407 if (!msg->middle) in ceph_alloc_middle()
3431 struct ceph_msg *msg; in ceph_con_in_msg_alloc() local
3438 msg = con->ops->alloc_msg(con, hdr, skip); in ceph_con_in_msg_alloc()
3441 if (msg) in ceph_con_in_msg_alloc()
3442 ceph_msg_put(msg); in ceph_con_in_msg_alloc()
3445 if (msg) { in ceph_con_in_msg_alloc()
3447 msg_con_set(msg, con); in ceph_con_in_msg_alloc()
3448 con->in_msg = msg; in ceph_con_in_msg_alloc()
3511 struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) in ceph_msg_get() argument
3513 dout("%s %p (was %d)\n", __func__, msg, in ceph_msg_get()
3514 kref_read(&msg->kref)); in ceph_msg_get()
3515 kref_get(&msg->kref); in ceph_msg_get()
3516 return msg; in ceph_msg_get()
3520 void ceph_msg_put(struct ceph_msg *msg) in ceph_msg_put() argument
3522 dout("%s %p (was %d)\n", __func__, msg, in ceph_msg_put()
3523 kref_read(&msg->kref)); in ceph_msg_put()
3524 kref_put(&msg->kref, ceph_msg_release); in ceph_msg_put()
3528 void ceph_msg_dump(struct ceph_msg *msg) in ceph_msg_dump() argument
3530 pr_debug("msg_dump %p (front_alloc_len %d length %zd)\n", msg, in ceph_msg_dump()
3531 msg->front_alloc_len, msg->data_length); in ceph_msg_dump()
3534 &msg->hdr, sizeof(msg->hdr), true); in ceph_msg_dump()
3537 msg->front.iov_base, msg->front.iov_len, true); in ceph_msg_dump()
3538 if (msg->middle) in ceph_msg_dump()
3541 msg->middle->vec.iov_base, in ceph_msg_dump()
3542 msg->middle->vec.iov_len, true); in ceph_msg_dump()
3545 &msg->footer, sizeof(msg->footer), true); in ceph_msg_dump()