Re: [PATCH v3 01/12] btrfs: make flush_space take a enum btrfs_flush_state instead of int
From: Josef Bacik <josef@toxicpanda.com>
Date: 2021-01-27 10:10:54
On 1/26/21 1:36 PM, David Sterba wrote:
On Fri, Oct 09, 2020 at 09:28:18AM -0400, Josef Bacik wrote:quoted
I got a automated message from somebody who runs clang against our kernels and it's because I used the wrong enum type for what I passed into flush_space. Change the argument to be explicitly the enum we're expecting to make everything consistent. Maybe eventually gcc will catch errors like this.I can't find any such public report and none of the clang warnings seem to be specific about that. Local run with clang 11 does not produce any warning.
IDK, it was a private email just to me with the following output from clang
s/btrfs/space-info.c:1115:12: warning: implicit conversion from
enumeration type 'enum btrfs_flush_state' to different enumeration type
'enum btrfs_reserve_flush_enum' [-Wenum-conversion]
flush = FLUSH_DELALLOC;
~ ^~~~~~~~~~~~~~
fs/btrfs/space-info.c:1120:12: warning: implicit conversion from
enumeration type 'enum btrfs_flush_state' to different enumeration type
'enum btrfs_reserve_flush_enum' [-Wenum-conversion]
flush = FORCE_COMMIT_TRANS;
~ ^~~~~~~~~~~~~~~~~~
fs/btrfs/space-info.c:1124:12: warning: implicit conversion from
enumeration type 'enum btrfs_flush_state' to different enumeration type
'enum btrfs_reserve_flush_enum' [-Wenum-conversion]
flush = FLUSH_DELAYED_ITEMS_NR;
~ ^~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/space-info.c:1127:12: warning: implicit conversion from
enumeration type 'enum btrfs_flush_state' to different enumeration type
'enum btrfs_reserve_flush_enum' [-Wenum-conversion]
flush = FLUSH_DELAYED_REFS_NR;
~ ^~~~~~~~~~~~~~~~~~~~~
I figure it made sense, might as well fix it. Do we have that option for our
shiny new -W build options? Thanks,
Josef