Re: [PATCH] sunrpc: Fix trace events to store data in the struct

From: Steven Rostedt
Date: Tue Feb 24 2015 - 09:49:48 EST


On Tue, 24 Feb 2015 08:36:48 -0500
Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> wrote:

> > diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
> > index b9c1dc6c825a..47dfcaebfaaf 100644
> > --- a/include/trace/events/sunrpc.h
> > +++ b/include/trace/events/sunrpc.h
> > @@ -503,18 +503,22 @@ TRACE_EVENT(svc_xprt_do_enqueue,
> >
> > TP_STRUCT__entry(
> > __field(struct svc_xprt *, xprt)
> > - __field(struct svc_rqst *, rqst)
> > + __field_struct(struct sockaddr_storage, ss)
> > + __field(unsigned long, flags);
> > + __field(int, pid)
> > ),
> >
> > TP_fast_assign(
> > __entry->xprt = xprt;
> > - __entry->rqst = rqst;
> > + xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss));
>
> How could xprt ever be NULL here, and even if it was, why the esoteric
> C instead of a simple 'if' statement?

If it can never be NULL here, then we do not need the conditional.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/