The sparse check with "make C=1" outputs warnings regarding references to the header file "include/trace/events/nilfs2.h" for event tracing: fs/nilfs2/segment.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/nilfs2.h): ./include/trace/events/nilfs2.h:191:1: warning: cast to restricted blk_opf_t ./include/trace/events/nilfs2.h:191:1: warning: restricted blk_opf_t degrades to integer ./include/trace/events/nilfs2.h:191:1: warning: restricted blk_opf_t degrades to integer Fix this issue by reverting the type of the parameter related to the bio operation mode in the event tracing definition from "enum req_op" to "int". In order to prevent sparse warnings on the caller side (where trace_nilfs2_mdt_submit_block() is used), also add a typecast to an argument passed to the tracepoint. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxx> Reported-by: kernel test robot <lkp@xxxxxxxxx> Closes: https://lore.kernel.org/oe-kbuild-all/202401092241.I4mm9OWl-lkp@xxxxxxxxx/ Fixes: ed4512590bd5 ("fs/nilfs2: Use the enum req_op and blk_opf_t types") Cc: Bart Van Assche <bvanassche@xxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> --- fs/nilfs2/mdt.c | 2 +- include/trace/events/nilfs2.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 4f792a0ad0f0..323eb8442e0a 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -152,7 +152,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, blk_opf_t opf, ret = 0; trace_nilfs2_mdt_submit_block(inode, inode->i_ino, blkoff, - opf & REQ_OP_MASK); + (__force int)(opf & REQ_OP_MASK)); out: get_bh(bh); *out_bh = bh; diff --git a/include/trace/events/nilfs2.h b/include/trace/events/nilfs2.h index 8efc6236f57c..84ee31fc04cc 100644 --- a/include/trace/events/nilfs2.h +++ b/include/trace/events/nilfs2.h @@ -192,7 +192,7 @@ TRACE_EVENT(nilfs2_mdt_submit_block, TP_PROTO(struct inode *inode, unsigned long ino, unsigned long blkoff, - enum req_op mode), + int mode), TP_ARGS(inode, ino, blkoff, mode), @@ -200,7 +200,7 @@ TRACE_EVENT(nilfs2_mdt_submit_block, __field(struct inode *, inode) __field(unsigned long, ino) __field(unsigned long, blkoff) - __field(enum req_op, mode) + __field(int, mode) ), TP_fast_assign( -- 2.34.1