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

From: Ryusuke Konishi
Date: Wed May 01 2024 - 11:33:16 EST


On Wed, May 1, 2024 at 11:42 PM Bart Van Assche wrote:
>
> On 4/30/24 10:00, Ryusuke Konishi wrote:
> > trace_nilfs2_mdt_submit_block(inode, inode->i_ino, blkoff,
> > - opf & REQ_OP_MASK);
> > + (__force int)(opf & REQ_OP_MASK));
>
> Please keep the enum req_op type instead of casting that type away with
> "__force int".
>
> Thanks,
>
> Bart.

Hi Bart,

No, this type cast is necessary to prevent the following sparse warning:

CC [M] fs/nilfs2/mdt.o
CHECK fs/nilfs2/mdt.c
fs/nilfs2/mdt.c:155:43: warning: incorrect type in argument 4
(different base types)
fs/nilfs2/mdt.c:155:43: expected int mode
fs/nilfs2/mdt.c:155:43: got restricted blk_opf_t

What we're doing here is just changing the event tracing type back to
int, and keeping blk_opf_t and enum req_op in the rest of the code.

I understand if you have enough reason to ignore the warnings, but
Why do you have to keep enum req_op type instead of int for event tracing?

Regards,
Ryusuke Konishi