SUNRPC: Don't allocate a full sockaddr_storage for tracing
We're always tracing IPv4 or IPv6 addresses, so we can save a lot
of space on the ringbuffer by allocating the correct sockaddr size.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: stable@vger.kernel.org
Fixes: 83a712e0af
"sunrpc: add some tracepoints around ..."
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
6343a21208
commit
db1bb44c4c
|
@ -529,20 +529,27 @@ TRACE_EVENT(svc_xprt_do_enqueue,
|
|||
|
||||
TP_STRUCT__entry(
|
||||
__field(struct svc_xprt *, xprt)
|
||||
__field_struct(struct sockaddr_storage, ss)
|
||||
__field(int, pid)
|
||||
__field(unsigned long, flags)
|
||||
__dynamic_array(unsigned char, addr, xprt != NULL ?
|
||||
xprt->xpt_remotelen : 0)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->xprt = xprt;
|
||||
xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss));
|
||||
__entry->pid = rqst? rqst->rq_task->pid : 0;
|
||||
__entry->flags = xprt ? xprt->xpt_flags : 0;
|
||||
if (xprt) {
|
||||
memcpy(__get_dynamic_array(addr),
|
||||
&xprt->xpt_remote,
|
||||
xprt->xpt_remotelen);
|
||||
__entry->flags = xprt->xpt_flags;
|
||||
} else
|
||||
__entry->flags = 0;
|
||||
),
|
||||
|
||||
TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
|
||||
(struct sockaddr *)&__entry->ss,
|
||||
__get_dynamic_array_len(addr) != 0 ?
|
||||
(struct sockaddr *)__get_dynamic_array(addr) : NULL,
|
||||
__entry->pid, show_svc_xprt_flags(__entry->flags))
|
||||
);
|
||||
|
||||
|
@ -553,18 +560,25 @@ TRACE_EVENT(svc_xprt_dequeue,
|
|||
|
||||
TP_STRUCT__entry(
|
||||
__field(struct svc_xprt *, xprt)
|
||||
__field_struct(struct sockaddr_storage, ss)
|
||||
__field(unsigned long, flags)
|
||||
__dynamic_array(unsigned char, addr, xprt != NULL ?
|
||||
xprt->xpt_remotelen : 0)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->xprt = xprt,
|
||||
xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss));
|
||||
__entry->flags = xprt ? xprt->xpt_flags : 0;
|
||||
__entry->xprt = xprt;
|
||||
if (xprt) {
|
||||
memcpy(__get_dynamic_array(addr),
|
||||
&xprt->xpt_remote,
|
||||
xprt->xpt_remotelen);
|
||||
__entry->flags = xprt->xpt_flags;
|
||||
} else
|
||||
__entry->flags = 0;
|
||||
),
|
||||
|
||||
TP_printk("xprt=0x%p addr=%pIScp flags=%s", __entry->xprt,
|
||||
(struct sockaddr *)&__entry->ss,
|
||||
__get_dynamic_array_len(addr) != 0 ?
|
||||
(struct sockaddr *)__get_dynamic_array(addr) : NULL,
|
||||
show_svc_xprt_flags(__entry->flags))
|
||||
);
|
||||
|
||||
|
@ -592,19 +606,26 @@ TRACE_EVENT(svc_handle_xprt,
|
|||
TP_STRUCT__entry(
|
||||
__field(struct svc_xprt *, xprt)
|
||||
__field(int, len)
|
||||
__field_struct(struct sockaddr_storage, ss)
|
||||
__field(unsigned long, flags)
|
||||
__dynamic_array(unsigned char, addr, xprt != NULL ?
|
||||
xprt->xpt_remotelen : 0)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->xprt = xprt;
|
||||
xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss));
|
||||
__entry->len = len;
|
||||
__entry->flags = xprt ? xprt->xpt_flags : 0;
|
||||
if (xprt) {
|
||||
memcpy(__get_dynamic_array(addr),
|
||||
&xprt->xpt_remote,
|
||||
xprt->xpt_remotelen);
|
||||
__entry->flags = xprt->xpt_flags;
|
||||
} else
|
||||
__entry->flags = 0;
|
||||
),
|
||||
|
||||
TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
|
||||
(struct sockaddr *)&__entry->ss,
|
||||
__get_dynamic_array_len(addr) != 0 ?
|
||||
(struct sockaddr *)__get_dynamic_array(addr) : NULL,
|
||||
__entry->len, show_svc_xprt_flags(__entry->flags))
|
||||
);
|
||||
#endif /* _TRACE_SUNRPC_H */
|
||||
|
|
Loading…
Reference in New Issue