From: Wang Yugui <wangyugui@e16-tech.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: A sparse(make C=1) warning in btrfs about the 'blk_opf_t'
Date: Sat, 13 Aug 2022 12:53:32 +0800 [thread overview]
Message-ID: <20220813125331.3F71.409509F4@e16-tech.com> (raw)
In-Reply-To: <bc8c1eb6-18e0-788c-3863-7f0b39501944@acm.org>
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.
next prev parent reply other threads:[~2022-08-13 4:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2022-08-13 15:25 ` Bart Van Assche
2022-08-13 16:03 ` Wang Yugui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220813125331.3F71.409509F4@e16-tech.com \
--to=wangyugui@e16-tech.com \
--cc=bvanassche@acm.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.