Skip to content

Commit 2f09c24

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
SUNRPC: Ensure that we can trace waitqueues when !defined(CONFIG_SYSCTL)
The tracepoint code relies on the queue->name being defined in order to be able to display the name of the waitqueue on which an RPC task is sleeping. Reported-by: Randy Dunlap <rdunlap@xenotime.net> Reported-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Randy Dunlap <rdunlap@xenotime.net>
1 parent 685f50f commit 2f09c24

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎include/linux/sunrpc/debug.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#ifdef CONFIG_SYSCTL
3535
#define RPC_DEBUG
3636
#endif
37+
#ifdef CONFIG_TRACEPOINTS
38+
#define RPC_TRACEPOINTS
39+
#endif
3740
/* #define RPC_PROFILE */
3841

3942
/*

‎include/linux/sunrpc/sched.h‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ struct rpc_wait_queue {
195195
unsigned char nr; /* # tasks remaining for cookie */
196196
unsigned short qlen; /* total # tasks waiting in queue */
197197
struct rpc_timer timer_list;
198-
#ifdef RPC_DEBUG
198+
#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS)
199199
const char * name;
200200
#endif
201201
};
@@ -270,11 +270,22 @@ static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char pri
270270
return (task->tk_priority + RPC_PRIORITY_LOW == prio);
271271
}
272272

273-
#ifdef RPC_DEBUG
273+
#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
274274
static inline const char * rpc_qname(const struct rpc_wait_queue *q)
275275
{
276276
return ((q && q->name) ? q->name : "unknown");
277277
}
278+
279+
static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
280+
const char *name)
281+
{
282+
q->name = name;
283+
}
284+
#else
285+
static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
286+
const char *name)
287+
{
288+
}
278289
#endif
279290

280291
#endif /* _LINUX_SUNRPC_SCHED_H_ */

‎net/sunrpc/sched.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ static void __rpc_init_priority_wait_queue(struct rpc_wait_queue *queue, const c
208208
queue->qlen = 0;
209209
setup_timer(&queue->timer_list.timer, __rpc_queue_timer_fn, (unsigned long)queue);
210210
INIT_LIST_HEAD(&queue->timer_list.list);
211-
#ifdef RPC_DEBUG
212-
queue->name = qname;
213-
#endif
211+
rpc_assign_waitqueue_name(queue, qname);
214212
}
215213

216214
void rpc_init_priority_wait_queue(struct rpc_wait_queue *queue, const char *qname)

0 commit comments

Comments
 (0)