A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
Subsystems (2)
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 ([email protected])
2022/08/13
Quoted 7 lines · Wang Yugui
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 restrictedblk_opf_tenumreq_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/[email protected]/).
Thanks,
Bart.
Hi,
Quoted 9 lines · Wang Yugui
Quoted 7 lines
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 restrictedblk_opf_tenumreq_op
Quoted 7 lines
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/[email protected]/).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 ([email protected])
2022/08/13
Quoted 1 line · Wang Yugui
This warning is still ON after applied this
patch([PATCH] tracing: Suppress sparse warnings triggered by is_signed_type())
How about the patch below?
include/trace/events/btrfs.h +1 -1
@@ -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.
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;
include/trace/events/btrfs.h +2 -2
@@ -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 ([email protected])
2022/08/13
Quoted 22 lines · Wang Yugui
Quoted 1 line
This warning is still ON after applied this
patch([PATCH] tracing: Suppress sparse warnings triggered by is_signed_type())How about the patch below?
include/trace/events/btrfs.h +1
-1@@ -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.
Quoted 11 lines · Wang Yugui
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 restrictedblk_opf_tenumreq_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 restrictedblk_opf_t./include/trace/events/btrfs.h:2327:1: warning: cast to restrictedblk_opf_t./include/trace/events/btrfs.h:2327:1: warning: restrictedblk_opf_tdegrades to integer./include/trace/events/btrfs.h:2327:1: warning: restrictedblk_opf_tdegrades 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.
Hi,
Quoted 13 lines · Wang Yugui
Quoted 11 lines
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 restrictedblk_opf_tenumreq_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 restrictedblk_opf_t./include/trace/events/btrfs.h:2327:1: warning: cast to restrictedblk_opf_t./include/trace/events/btrfs.h:2327:1: warning: restrictedblk_opf_tdegrades to integer./include/trace/events/btrfs.h:2327:1: warning: restrictedblk_opf_tdegrades to integer
Quoted 6 lines
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.
Quoted 5 lines
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 ([email protected])
2022/08/13