]> www.infradead.org Git - linux.git/commitdiff
bcachefs: avoid overflowing LRU_TIME_BITS for cached data lru
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 16 Aug 2024 16:41:46 +0000 (12:41 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 16 Aug 2024 16:46:40 +0000 (12:46 -0400)
Reported-by: syzbot+510b0b28f8e6de64d307@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.h

index 260e7fa83d0518945e37e5f08c160d8436178d39..fd790b03fbe1987af43d01e9ad210ec3d94a8e3e 100644 (file)
@@ -150,7 +150,9 @@ static inline void alloc_data_type_set(struct bch_alloc_v4 *a, enum bch_data_typ
 
 static inline u64 alloc_lru_idx_read(struct bch_alloc_v4 a)
 {
-       return a.data_type == BCH_DATA_cached ? a.io_time[READ] : 0;
+       return a.data_type == BCH_DATA_cached
+               ? a.io_time[READ] & LRU_TIME_MAX
+               : 0;
 }
 
 #define DATA_TYPES_MOVABLE             \