diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-07-31 02:33:25 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-08-07 14:31:10 +0200 |
commit | 7442b5cdf259e2fb112560904b7002ce48d15578 (patch) | |
tree | d4ad9b1f07561570c9b0f92cec4bdc7bf84c8137 /fs/bcachefs/alloc_background.h | |
parent | lockdep: Fix lockdep_set_notrack_class() for CONFIG_LOCK_STAT (diff) | |
download | linux-7442b5cdf259e2fb112560904b7002ce48d15578.tar.xz linux-7442b5cdf259e2fb112560904b7002ce48d15578.zip |
bcachefs: Don't rely on implicit unsigned -> signed integer conversion
implicit integer conversion is a fertile source of bugs, and we really
would rather not have the min()/max() macros doing it implicitly.
bcachefs appears to be the only place in the kernel where this happens,
so let's fix it.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r-- | fs/bcachefs/alloc_background.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h index 8d2b62c9588e..f13e619b4b21 100644 --- a/fs/bcachefs/alloc_background.h +++ b/fs/bcachefs/alloc_background.h @@ -166,8 +166,8 @@ static inline u64 alloc_lru_idx_fragmentation(struct bch_alloc_v4 a, * avoid overflowing LRU_TIME_BITS on a corrupted fs, when * bucket_sectors_dirty is (much) bigger than bucket_size */ - u64 d = min(bch2_bucket_sectors_dirty(a), - ca->mi.bucket_size); + u64 d = min_t(s64, bch2_bucket_sectors_dirty(a), + ca->mi.bucket_size); return div_u64(d * (1ULL << 31), ca->mi.bucket_size); } |