Re: [PATCH] xfs: fix sparse checker warnings on kmem tracepoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 18, 2019 at 04:18:16PM -0600, Eric Sandeen wrote:
> 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.
> 
> Fixes: 0ad95687c3ad ("xfs: add kmem allocation trace points")
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

Looks ok insofar as cem will eventually kill these off, right?
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

--D

> ---
> 
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index c13bb3655e48..dd165b6d2289 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -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);
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux