xfs: fix sparse checker warnings on kmem tracepoints
PATCH 1/1 xfs: fix sparse checker warnings on kmem tracepoints
Sparse checker doesn't like kmem.c tracepoints:
kmem.c:18:32: warning: incorrect type in argument 2 (different base types)
kmem.c:18:32: expected int [signed] flags
kmem.c:18:32: got restricted xfs_km_flags_t [usertype] flags
So take an xfs_km_flags_t, and cast it to an int when we print it.
---
fs/xfs/xfs_trace.h +4 -4
@@ -3545,11 +3545,11 @@ TRACE_EVENT(xfs_pwork_init, ) DECLARE_EVENT_CLASS(xfs_kmem_class, - TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), + TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip), TP_ARGS(size, flags, caller_ip), TP_STRUCT__entry( __field(ssize_t, size) - __field(int, flags) + __field(xfs_km_flags_t, flags) __field(unsigned long, caller_ip) ), TP_fast_assign(
@@ -3559,13 +3559,13 @@ DECLARE_EVENT_CLASS(xfs_kmem_class, ), TP_printk("size %zd flags 0x%x caller %pS", __entry->size, - __entry->flags, + (int)__entry->flags, (char *)__entry->caller_ip) )#define DEFINE_KMEM_EVENT (name) \ DEFINE_EVENT(xfs_kmem_class, name, \ - TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \ + TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip), \ TP_ARGS(size, flags, caller_ip))DEFINE_KMEM_EVENT (kmem_alloc);DEFINE_KMEM_EVENT (kmem_alloc_io);
Quoted 10 lines · Eric Sandeen
Sparse checker doesn't like
kmem.ctracepoints:kmem.c:18:32: warning: incorrect type in argument 2 (different base types)
kmem.c:18:32: expected int [signed] flags
kmem.c:18:32: got restrictedxfs_km_flags_t[usertype] flagsSo take an
xfs_km_flags_t, and cast it to an int when we print it.Fixes 0ad95687c3ad ("xfs: add kmem allocation trace points")Signed-off-by Eric Sandeen <[email protected]>
Looks ok insofar as cem will eventually kill these off, right?
--D
Quoted 37 lines
---
fs/xfs/xfs_trace.h +4
-4@@ -3545,11 +3545,11 @@ TRACE_EVENT(xfs_pwork_init, ) DECLARE_EVENT_CLASS(xfs_kmem_class, - TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), + TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip), TP_ARGS(size, flags, caller_ip), TP_STRUCT__entry( __field(ssize_t, size) - __field(int, flags) + __field(xfs_km_flags_t, flags) __field(unsigned long, caller_ip) ), TP_fast_assign(@@ -3559,13 +3559,13 @@ DECLARE_EVENT_CLASS(xfs_kmem_class, ), TP_printk("size %zd flags 0x%x caller %pS", __entry->size, - __entry->flags, + (int)__entry->flags, (char *)__entry->caller_ip) )#define DEFINE_KMEM_EVENT (name) \ DEFINE_EVENT(xfs_kmem_class, name, \ - TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \ + TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip), \ TP_ARGS(size, flags, caller_ip))DEFINE_KMEM_EVENT (kmem_alloc);DEFINE_KMEM_EVENT (kmem_alloc_io);
Quoted 7 lines · Darrick J. Wong
Quoted 6 lines · Eric Sandeen
Sparse checker doesn't like
kmem.ctracepoints:kmem.c:18:32: warning: incorrect type in argument 2 (different base types)
kmem.c:18:32: expected int [signed] flags
kmem.c:18:32: got restrictedxfs_km_flags_t[usertype] flags
Quoted 7 lines
Quoted 4 lines
So take an
xfs_km_flags_t, and cast it to an int when we print it.Fixes 0ad95687c3ad ("xfs: add kmem allocation trace points")Signed-off-by Eric Sandeen <[email protected]>Looks ok insofar as cem will eventually kill these off, right?
Reviewed-by Darrick J. Wong <[email protected]>
Oh, I guess so - if you want to just wait for that and drop this patch, it's fine.
-Eric