Project

General

Profile

Feature #2374 » 0002-ceph-add-tracepoints-for-message-send-queueing-and-c.patch

Alex Elder, 06/28/2012 09:00 AM

View differences:

include/trace/events/ceph.h
#if !defined(_TRACE_CEPH_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_CEPH_H
#if defined(CEPH_TRACE_FS_FILE) \
|| defined(CEPH_TRACE_FS_ADDR) \
|| defined(CEPH_TRACE_NET_OSDC)
#if !defined(TRACE_HEADER_MULTI_READ)
......
#ifdef CEPH_TRACE_NET_OSDC
DEFINE_CEPH_START_REQ_EVENT(ceph_osdc_writepages_req);
DEFINE_CEPH_START_REQ_EVENT(ceph_osdc_readpages_req);
TRACE_EVENT(ceph_handle_reply_msg,
TP_PROTO(struct ceph_connection *con,
struct ceph_msg *msg,
struct ceph_osd_reply_head *reply,
void *req),
TP_ARGS(con, msg, reply, req),
TP_STRUCT__entry(
__field(unsigned long long, tid)
__field(long long, peer_num)
__field(void*, req)
__field(unsigned, peer_type)
__field(int, result)
__field(int, flags)
),
TP_fast_assign(
__entry->tid = le64_to_cpu(msg->hdr.tid);
__entry->peer_num = le64_to_cpu(con->peer_name.num);
__entry->peer_type = con->peer_name.type;
__entry->req = req;
__entry->result = le32_to_cpu(reply->result);
__entry->flags = le32_to_cpu(reply->flags);
),
TP_printk("peer %s%lld tid %llu result %d flags 0x%08x (req %p)",
ceph_entity_type_name(__entry->peer_type), __entry->peer_num,
__entry->tid, __entry->result, __entry->flags, __entry->req
)
);
#endif
#endif /* CEPH_TRACE_FS_FILE || CEPH_TRACE_FS_ADDR || CEPH_TRACE_NET_OSDC */
#if defined(CEPH_TRACE_NET_MESSENGER)
DECLARE_EVENT_CLASS(ceph_write_msg_class,
TP_PROTO(struct ceph_connection *con, struct ceph_msg *msg),
TP_ARGS(con, msg),
TP_STRUCT__entry(
__field(unsigned long long, tid)
__field(unsigned long long, seq)
__field(long long, peer_num)
__field(unsigned, peer_type)
__field(int, sent)
),
TP_fast_assign(
__entry->tid = le64_to_cpu(msg->hdr.tid);
__entry->seq = le64_to_cpu(msg->hdr.seq);
__entry->peer_num = le64_to_cpu(con->peer_name.num);
__entry->peer_type = con->peer_name.type;
__entry->sent = con->out_msg_pos.data_pos;
),
TP_printk("peer %s%lld tid %llu seq %llu sent %d",
ceph_entity_type_name(__entry->peer_type), __entry->peer_num,
__entry->tid, __entry->seq, __entry->sent)
);
#define CEPH_WRITE_MSG_EVENT(name) \
DEFINE_EVENT(ceph_write_msg_class, name, \
TP_PROTO(struct ceph_connection *con, struct ceph_msg *msg), \
TP_ARGS(con, msg))
CEPH_WRITE_MSG_EVENT(ceph_prepare_write_msg);
CEPH_WRITE_MSG_EVENT(ceph_try_write_msg);
CEPH_WRITE_MSG_EVENT(ceph_try_write_msg_done);
#endif /* CEPH_TRACE_NET_MESSENGER */
#endif /* _TRACE_CEPH_H */
net/ceph/messenger.c
#include <linux/ceph/pagelist.h>
#include <linux/export.h>
#include <linux/tracepoint.h>
#define CREATE_TRACE_POINTS
#define CEPH_TRACE_NET_MESSENGER
#include <trace/events/ceph.h>
/*
* Ceph uses the messenger to exchange ceph_msg messages with other
* hosts in the system. The messenger provides ordered and reliable
......
else
/* no, queue up footer too and be done */
prepare_write_message_footer(con);
trace_ceph_prepare_write_msg(con, m);
set_bit(WRITE_PENDING, &con->flags);
}
......
/* msg pages? */
if (con->out_msg) {
trace_ceph_try_write_msg(con, con->out_msg);
if (con->out_msg_done) {
ceph_msg_put(con->out_msg);
trace_ceph_try_write_msg_done(con, con->out_msg);
con->out_msg = NULL; /* we're done with this one */
goto do_next;
}
net/ceph/osd_client.c
/* lookup */
mutex_lock(&osdc->request_mutex);
req = __lookup_request(osdc, tid);
trace_ceph_handle_reply_msg(con, msg, rhead, req);
if (req == NULL) {
dout("handle_reply tid %llu dne\n", tid);
mutex_unlock(&osdc->request_mutex);
(2-2/2)