* [PATCH v2] SUNRPC: convert RPC_TASK_* constants to enum
@ 2024-08-19 15:58 Stephen Brennan
2024-08-19 16:00 ` Stephen Brennan
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Brennan @ 2024-08-19 15:58 UTC (permalink / raw)
To: Anna Schumaker, Trond Myklebust
Cc: linux-nfs, Tom Talpey, linux-kernel, Chuck Lever, Dai Ngo,
Olga Kornievskaia, Stephen Brennan, Neil Brown, Jeff Layton
The RPC_TASK_* constants are defined as macros, which means that most
kernel builds will not contain their definitions in the debuginfo.
However, it's quite useful for debuggers to be able to view the task
state constant and interpret it correctly. Conversion to an enum will
ensure the constants are present in debuginfo and can be interpreted by
debuggers without needing to hard-code them and track their changes.
Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
---
Hi all,
For context, please see v1:
https://lore.kernel.org/linux-nfs/20240816220604.2688389-1-stephen.s.brennan@oracle.com/
include/linux/sunrpc/sched.h | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 0c77ba488bbae..fec1e8a1570c3 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -151,13 +151,15 @@ struct rpc_task_setup {
#define RPC_WAS_SENT(t) ((t)->tk_flags & RPC_TASK_SENT)
#define RPC_IS_MOVEABLE(t) ((t)->tk_flags & RPC_TASK_MOVEABLE)
-#define RPC_TASK_RUNNING 0
-#define RPC_TASK_QUEUED 1
-#define RPC_TASK_ACTIVE 2
-#define RPC_TASK_NEED_XMIT 3
-#define RPC_TASK_NEED_RECV 4
-#define RPC_TASK_MSG_PIN_WAIT 5
-#define RPC_TASK_SIGNALLED 6
+enum {
+ RPC_TASK_RUNNING,
+ RPC_TASK_QUEUED,
+ RPC_TASK_ACTIVE,
+ RPC_TASK_NEED_XMIT,
+ RPC_TASK_NEED_RECV,
+ RPC_TASK_MSG_PIN_WAIT,
+ RPC_TASK_SIGNALLED,
+};
#define rpc_test_and_set_running(t) \
test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
--
2.43.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] SUNRPC: convert RPC_TASK_* constants to enum
2024-08-19 15:58 [PATCH v2] SUNRPC: convert RPC_TASK_* constants to enum Stephen Brennan
@ 2024-08-19 16:00 ` Stephen Brennan
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Brennan @ 2024-08-19 16:00 UTC (permalink / raw)
To: linux-debuggers
Forgot to CC linux-debuggers, sorry! Check lore for replies.
Stephen Brennan <stephen.s.brennan@oracle.com> writes:
> The RPC_TASK_* constants are defined as macros, which means that most
> kernel builds will not contain their definitions in the debuginfo.
> However, it's quite useful for debuggers to be able to view the task
> state constant and interpret it correctly. Conversion to an enum will
> ensure the constants are present in debuginfo and can be interpreted by
> debuggers without needing to hard-code them and track their changes.
>
> Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
> ---
>
> Hi all,
>
> For context, please see v1:
> https://lore.kernel.org/linux-nfs/20240816220604.2688389-1-stephen.s.brennan@oracle.com/
>
> include/linux/sunrpc/sched.h | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
> index 0c77ba488bbae..fec1e8a1570c3 100644
> --- a/include/linux/sunrpc/sched.h
> +++ b/include/linux/sunrpc/sched.h
> @@ -151,13 +151,15 @@ struct rpc_task_setup {
> #define RPC_WAS_SENT(t) ((t)->tk_flags & RPC_TASK_SENT)
> #define RPC_IS_MOVEABLE(t) ((t)->tk_flags & RPC_TASK_MOVEABLE)
>
> -#define RPC_TASK_RUNNING 0
> -#define RPC_TASK_QUEUED 1
> -#define RPC_TASK_ACTIVE 2
> -#define RPC_TASK_NEED_XMIT 3
> -#define RPC_TASK_NEED_RECV 4
> -#define RPC_TASK_MSG_PIN_WAIT 5
> -#define RPC_TASK_SIGNALLED 6
> +enum {
> + RPC_TASK_RUNNING,
> + RPC_TASK_QUEUED,
> + RPC_TASK_ACTIVE,
> + RPC_TASK_NEED_XMIT,
> + RPC_TASK_NEED_RECV,
> + RPC_TASK_MSG_PIN_WAIT,
> + RPC_TASK_SIGNALLED,
> +};
>
> #define rpc_test_and_set_running(t) \
> test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
> --
> 2.43.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-19 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 15:58 [PATCH v2] SUNRPC: convert RPC_TASK_* constants to enum Stephen Brennan
2024-08-19 16:00 ` Stephen Brennan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.