Skip to content

Commit 9482f3b

Browse files
author
Kent Overstreet
committed
bcachefs: avoid overflowing LRU_TIME_BITS for cached data lru
Reported-by: syzbot+510b0b28f8e6de64d307@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 075cabf commit 9482f3b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/bcachefs/alloc_background.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ static inline void alloc_data_type_set(struct bch_alloc_v4 *a, enum bch_data_typ
150150

151151
static inline u64 alloc_lru_idx_read(struct bch_alloc_v4 a)
152152
{
153-
return a.data_type == BCH_DATA_cached ? a.io_time[READ] : 0;
153+
return a.data_type == BCH_DATA_cached
154+
? a.io_time[READ] & LRU_TIME_MAX
155+
: 0;
154156
}
155157

156158
#define DATA_TYPES_MOVABLE \

0 commit comments

Comments
 (0)