All of lore.kernel.org
 help / color / mirror / Atom feed
* A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
@ 2022-08-13  0:00 Wang Yugui
  2022-08-13  0:22 ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Wang Yugui @ 2022-08-13  0:00 UTC (permalink / raw)
  To: linux-btrfs, bvanassche

Hi, Bart Van Assche

A sparse(make C=1) warning in btrfs about the 'blk_opf_t'

./include/trace/events/btrfs.h:2327:1: warning: incorrect type in assignment (different base types)
./include/trace/events/btrfs.h:2327:1:    expected unsigned char [usertype] opf
./include/trace/events/btrfs.h:2327:1:    got restricted blk_opf_t enum req_op

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/08/13



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
  2022-08-13  0:00 A sparse(make C=1) warning in btrfs about the 'blk_opf_t' Wang Yugui
@ 2022-08-13  0:22 ` Bart Van Assche
  2022-08-13  1:13   ` Wang Yugui
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2022-08-13  0:22 UTC (permalink / raw)
  To: Wang Yugui, linux-btrfs

On 8/12/22 17:00, Wang Yugui wrote:
> Hi, Bart Van Assche
> 
> A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
> 
> ./include/trace/events/btrfs.h:2327:1: warning: incorrect type in assignment (different base types)
> ./include/trace/events/btrfs.h:2327:1:    expected unsigned char [usertype] opf
> ./include/trace/events/btrfs.h:2327:1:    got restricted blk_opf_t enum req_op

Hi Wang,

Please help with verifying whether this patch fixes that warning: 
"[PATCH] tracing: Suppress sparse warnings triggered by 
is_signed_type()" 
(https://lore.kernel.org/all/20220717151047.19220-1-bvanassche@acm.org/).

Thanks,

Bart.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
  2022-08-13  0:22 ` Bart Van Assche
@ 2022-08-13  1:13   ` Wang Yugui
  2022-08-13  3:02     ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Wang Yugui @ 2022-08-13  1:13 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-btrfs

Hi,

> On 8/12/22 17:00, Wang Yugui wrote:
> > Hi, Bart Van Assche
> >
> > A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
> >
> > ./include/trace/events/btrfs.h:2327:1: warning: incorrect type in assignment (different base types)
> > ./include/trace/events/btrfs.h:2327:1:    expected unsigned char [usertype] opf
> > ./include/trace/events/btrfs.h:2327:1:    got restricted blk_opf_t enum req_op
> 
> Hi Wang,
> 
> Please help with verifying whether this patch fixes that warning: "[PATCH] tracing: Suppress sparse warnings triggered by is_signed_type()" (https://lore.kernel.org/all/20220717151047.19220-1-bvanassche@acm.org/).
> 
> Thanks,
> 
> Bart.

This warning is still ON after applied this patch([PATCH] tracing: Suppress sparse warnings triggered by is_signed_type())

Mabye '(different base types)' is a key in this case.

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/08/13


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
  2022-08-13  1:13   ` Wang Yugui
@ 2022-08-13  3:02     ` Bart Van Assche
  2022-08-13  4:53       ` Wang Yugui
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2022-08-13  3:02 UTC (permalink / raw)
  To: Wang Yugui; +Cc: linux-btrfs

On 8/12/22 18:13, Wang Yugui wrote:
> This warning is still ON after applied this patch([PATCH] tracing: Suppress sparse warnings triggered by is_signed_type())

How about the patch below?

diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 73df80d462dc..925e74356547 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -2338,7 +2338,7 @@ DECLARE_EVENT_CLASS(btrfs_raid56_bio,
  		__field(	u64,	devid		)
  		__field(	u32,	offset		)
  		__field(	u32,	len		)
-		__field(	u8,	opf		)
+		__field(enum req_op,	opf		)
  		__field(	u8,	total_stripes	)
  		__field(	u8,	real_stripes	)
  		__field(	u8,	nr_data		)

Thanks,

Bart.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
  2022-08-13  3:02     ` Bart Van Assche
@ 2022-08-13  4:53       ` Wang Yugui
  2022-08-13 15:25         ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Wang Yugui @ 2022-08-13  4:53 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-btrfs

Hi,

both '__field(enum req_op,opf)' and '__field(blk_opf_t,opf)' failed to work.

./include/trace/events/btrfs.h:2327:1: warning: incorrect type in assignment (different base types)
./include/trace/events/btrfs.h:2327:1:    expected unsigned int [usertype] opf
./include/trace/events/btrfs.h:2327:1:    got restricted blk_opf_t enum req_op

/ssd/git/os/linux-5.19/fs/btrfs/super.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/btrfs.h):
./include/trace/events/btrfs.h:2327:1: warning: cast to restricted blk_opf_t
./include/trace/events/btrfs.h:2327:1: warning: cast to restricted blk_opf_t
./include/trace/events/btrfs.h:2327:1: warning: restricted blk_opf_t degrades to integer
./include/trace/events/btrfs.h:2327:1: warning: restricted blk_opf_t degrades to integer


the flowing works, but  I'm not confident about it.

./include/linux/blk_types.h:243:typedef __u32 __bitwise blk_opf_t;

diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 73df80d462dc..e1f95b061ff1 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -2338,7 +2338,7 @@ DECLARE_EVENT_CLASS(btrfs_raid56_bio,
                __field(        u64,    devid           )
                __field(        u32,    offset          )
                __field(        u32,    len             )
-               __field(        u8,     opf             )
+               __field(        u32,    opf             )
                __field(        u8,     total_stripes   )
                __field(        u8,     real_stripes    )
                __field(        u8,     nr_data         )
@@ -2349,7 +2349,7 @@ DECLARE_EVENT_CLASS(btrfs_raid56_bio,
                __entry->full_stripe    = rbio->bioc->raid_map[0];
                __entry->physical       = bio->bi_iter.bi_sector << SECTOR_SHIFT;
                __entry->len            = bio->bi_iter.bi_size;
-               __entry->opf            = bio_op(bio);
+               __entry->opf            = (__force u32)bio_op(bio);
                __entry->devid          = trace_info->devid;
                __entry->offset         = trace_info->offset;
                __entry->stripe_nr      = trace_info->stripe_nr;

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/08/13

> On 8/12/22 18:13, Wang Yugui wrote:
> > This warning is still ON after applied this patch([PATCH] tracing: Suppress sparse warnings triggered by is_signed_type())
> 
> How about the patch below?
> 
> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> index 73df80d462dc..925e74356547 100644
> --- a/include/trace/events/btrfs.h
> +++ b/include/trace/events/btrfs.h
> @@ -2338,7 +2338,7 @@ DECLARE_EVENT_CLASS(btrfs_raid56_bio,
>   		__field(	u64,	devid		)
>   		__field(	u32,	offset		)
>   		__field(	u32,	len		)
> -		__field(	u8,	opf		)
> +		__field(enum req_op,	opf		)
>   		__field(	u8,	total_stripes	)
>   		__field(	u8,	real_stripes	)
>   		__field(	u8,	nr_data		)
> 
> Thanks,
> 
> Bart.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
  2022-08-13  4:53       ` Wang Yugui
@ 2022-08-13 15:25         ` Bart Van Assche
  2022-08-13 16:03           ` Wang Yugui
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2022-08-13 15:25 UTC (permalink / raw)
  To: Wang Yugui; +Cc: linux-btrfs

On 8/12/22 21:53, Wang Yugui wrote:
> both '__field(enum req_op,opf)' and '__field(blk_opf_t,opf)' failed to work.
> 
> ./include/trace/events/btrfs.h:2327:1: warning: incorrect type in assignment (different base types)
> ./include/trace/events/btrfs.h:2327:1:    expected unsigned int [usertype] opf
> ./include/trace/events/btrfs.h:2327:1:    got restricted blk_opf_t enum req_op
> 
> /ssd/git/os/linux-5.19/fs/btrfs/super.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/btrfs.h):
> ./include/trace/events/btrfs.h:2327:1: warning: cast to restricted blk_opf_t
> ./include/trace/events/btrfs.h:2327:1: warning: cast to restricted blk_opf_t
> ./include/trace/events/btrfs.h:2327:1: warning: restricted blk_opf_t degrades to integer
> ./include/trace/events/btrfs.h:2327:1: warning: restricted blk_opf_t degrades to integer

 From https://en.wikipedia.org/wiki/Posting_style:

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Regarding the warnings reported above: please apply patch "[PATCH] 
tracing: Suppress sparse warnings triggered by is_signed_type()" before 
testing my patch.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
  2022-08-13 15:25         ` Bart Van Assche
@ 2022-08-13 16:03           ` Wang Yugui
  0 siblings, 0 replies; 7+ messages in thread
From: Wang Yugui @ 2022-08-13 16:03 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-btrfs

Hi,

> On 8/12/22 21:53, Wang Yugui wrote:
> > both '__field(enum req_op,opf)' and '__field(blk_opf_t,opf)' failed to work.
> >
> > ./include/trace/events/btrfs.h:2327:1: warning: incorrect type in assignment (different base types)
> > ./include/trace/events/btrfs.h:2327:1:    expected unsigned int [usertype] opf
> > ./include/trace/events/btrfs.h:2327:1:    got restricted blk_opf_t enum req_op
> >
> > /ssd/git/os/linux-5.19/fs/btrfs/super.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/btrfs.h):
> > ./include/trace/events/btrfs.h:2327:1: warning: cast to restricted blk_opf_t
> > ./include/trace/events/btrfs.h:2327:1: warning: cast to restricted blk_opf_t
> > ./include/trace/events/btrfs.h:2327:1: warning: restricted blk_opf_t degrades to integer
> > ./include/trace/events/btrfs.h:2327:1: warning: restricted blk_opf_t degrades to integer
> 
>  From https://en.wikipedia.org/wiki/Posting_style:
> 
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?

Thanks for the comment.


> Regarding the warnings reported above: please apply patch "[PATCH] tracing: Suppress sparse warnings triggered by is_signed_type()" before testing my patch.
> 
> Thanks,
> 
> Bart.

After applied patch "[PATCH] tracing: Suppress sparse warnings triggered
by is_signed_type()",  both '__field(enum req_op,opf)' and 
'__field(blk_opf_t,opf)' work well without sparse warning(make C=1).

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/08/13



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-13 16:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13  0:00 A sparse(make C=1) warning in btrfs about the 'blk_opf_t' Wang Yugui
2022-08-13  0:22 ` Bart Van Assche
2022-08-13  1:13   ` Wang Yugui
2022-08-13  3:02     ` Bart Van Assche
2022-08-13  4:53       ` Wang Yugui
2022-08-13 15:25         ` Bart Van Assche
2022-08-13 16:03           ` Wang Yugui

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.