Re: fs/zonefs/./trace.h:22:1: sparse: sparse: cast to restricted blk_opf_t

From: Damien Le Moal
Date: Wed Aug 10 2022 - 10:37:18 EST


On 2022/08/08 8:37, Bart Van Assche wrote:
> On 8/8/22 07:48, Damien Le Moal wrote:
>> Are you going to send a patch to fix this or do you want me to do it ?
>
> Hi Damien,
>
> Thanks for having taken a look. Please help with verifying whether the
> following patch is sufficient to fix the reported warning: "[PATCH]
> tracing: Suppress sparse warnings triggered by is_signed_type()"
> (https://lore.kernel.org/all/20220717151047.19220-1-bvanassche@xxxxxxx/).
>
> Bart.

With the current Linus tree, I do not see this sparse warning. However, applying
the above patch, "make M=fs/zonefs C=1" generates a lot of warnings:

make -j64 M=fs/zonefs C=1
CC [M] fs/zonefs/super.o
CC [M] fs/zonefs/sysfs.o
CHECK fs/zonefs/sysfs.c
CHECK fs/zonefs/super.c
fs/zonefs/sysfs.c: note: in included file (through include/linux/bitops.h,
include/linux/kernel.h, arch/x86/include/asm/percpu.h,
arch/x86/include/asm/preempt.h, include/linux/preempt.h,
include/linux/spinlock.h, ...):
./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
fs/zonefs/sysfs.c: note: in included file (through include/linux/bitops.h,
include/linux/kernel.h, arch/x86/include/asm/percpu.h,
arch/x86/include/asm/preempt.h, include/linux/preempt.h,
include/linux/spinlock.h, ...):
./include/asm-generic/bitops/generic-non-atomic.h:29:9: warning: unreplaced
symbol 'mask'
./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced
symbol 'p'
./include/asm-generic/bitops/generic-non-atomic.h:32:10: warning: unreplaced
symbol 'p'
./include/asm-generic/bitops/generic-non-atomic.h:32:16: warning: unreplaced
symbol 'mask'
./include/asm-generic/bitops/generic-non-atomic.h:27:1: warning: unreplaced
symbol 'return'
fs/zonefs/sysfs.c: note: in included file (through
arch/x86/include/asm/bitops.h, include/linux/bitops.h, include/linux/kernel.h,
arch/x86/include/asm/percpu.h, arch/x86/include/asm/preempt.h,
include/linux/preempt.h, ...):
./include/asm-generic/bitops/instrumented-non-atomic.h:26:1: warning: unreplaced
symbol 'return'
fs/zonefs/sysfs.c: note: in included file (through include/linux/bitops.h,
include/linux/kernel.h, arch/x86/include/asm/percpu.h,
arch/x86/include/asm/preempt.h, include/linux/preempt.h,
include/linux/spinlock.h, ...):
./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
fs/zonefs/sysfs.c: note: in included file (through include/linux/bitops.h,
include/linux/kernel.h, arch/x86/include/asm/percpu.h,
arch/x86/include/asm/preempt.h, include/linux/preempt.h,
include/linux/spinlock.h, ...):
./include/asm-generic/bitops/generic-non-atomic.h:38:9: warning: unreplaced
symbol 'mask'
./include/asm-generic/bitops/generic-non-atomic.h:39:9: warning: unreplaced
symbol 'p'
./include/asm-generic/bitops/generic-non-atomic.h:41:10: warning: unreplaced
symbol 'p'
./include/asm-generic/bitops/generic-non-atomic.h:41:16: warning: unreplaced
symbol 'mask'
./include/asm-generic/bitops/generic-non-atomic.h:36:1: warning: unreplaced
symbol 'return'
...

Much more messages after that.

--
Damien Le Moal
Western Digital Research