Commit 7442b5cd authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ff9bf4b3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ 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),
	u64 d = min_t(s64, bch2_bucket_sectors_dirty(a),
		      ca->mi.bucket_size);

	return div_u64(d * (1ULL << 31), ca->mi.bucket_size);