Re: [PATCH -mm 1/2] nilfs2: use integer type instead of enum req_op for event tracing header

From: Ryusuke Konishi
Date: Mon May 06 2024 - 17:17:55 EST


On Tue, May 7, 2024 at 2:26 AM Bart Van Assche wrote:
>
> On 5/5/24 12:04 PM, Ryusuke Konishi wrote:
> > I also tried typecasting on the declaration header side of event
> > tracing, but so far, the sparse warnings don't go away except for the
> > patch I first proposed.
>
> How about this patch?
>
> diff --git a/include/trace/events/nilfs2.h b/include/trace/events/nilfs2.h
> index 8efc6236f57c..b1a364a33a62 100644
> --- a/include/trace/events/nilfs2.h
> +++ b/include/trace/events/nilfs2.h
> @@ -200,7 +200,11 @@ TRACE_EVENT(nilfs2_mdt_submit_block,
> __field(struct inode *, inode)
> __field(unsigned long, ino)
> __field(unsigned long, blkoff)
> - __field(enum req_op, mode)
> + /*
> + * Use field_struct to avoid is_signed_type() on the bitwise
> + * type enum req_op.
> + */
> + __field_struct(enum req_op, mode)
> ),
>
> TP_fast_assign(
>
> Thanks,
>
> Bart.

Great! This patch removed the sparse warnings.

It passed multiple build methods and did not break either tracing or
nilfs2 functionality in operational testing.

I never thought of using __field_struct for enum type, but looking at
the definition it looks like it can be used to just avoid
is_signed_type() without any side effects. So, this patch looks
better than mine.

If you don't mind, could you complete this change as a patch by adding
a commit message and related tags?

Thanks,
Ryusuke Konishi