Re: [PATCH v3 01/12] btrfs: make flush_space take a enum btrfs_flush_state instead of int
From: David Sterba <hidden>
Date: 2021-01-26 23:06:06
On Fri, Oct 09, 2020 at 09:28:18AM -0400, Josef Bacik wrote:
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.
quoted hunk ↗ jump to hunk
Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/space-info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 64099565ab8f..ba2b72409d46 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c@@ -667,7 +667,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info, */ static void flush_space(struct btrfs_fs_info *fs_info, struct btrfs_space_info *space_info, u64 num_bytes, - int state) + enum btrfs_flush_state state) { struct btrfs_root *root = fs_info->extent_root; struct btrfs_trans_handle *trans;@@ -920,7 +920,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) struct btrfs_fs_info *fs_info; struct btrfs_space_info *space_info; u64 to_reclaim; - int flush_state; + enum btrfs_flush_state flush_state;
The pattern with int instead of the enum is also in priority_reclaim_metadata_space so I'll add it. If you find the report we can add the warning among the newly enabled warnings to Makefile.
int commit_cycles = 0; u64 last_tickets_id; -- 2.26.2