From: Alan Huang Date: Mon, 17 Mar 2025 17:54:24 +0000 (+0800) Subject: bcachefs: Fix incorrect state count X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5cc0ab39fb16c44ef6bbabb1b5a0c5705ec0bb56;p=users%2Fjedix%2Flinux-maple.git bcachefs: Fix incorrect state count atomic64_read(&j->seq) - j->seq_write_started == JOURNAL_STATE_BUF_NR is the condition in journal_entry_open where we return JOURNAL_ERR_max_open, so journal_cur_seq(j) - seq == JOURNAL_STATE_BUF_NR means that the buf corresponding to seq has started to write. Signed-off-by: Alan Huang Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index 1c460ded2a11..ab68c5c4d8d8 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -161,7 +161,7 @@ static inline int journal_state_count(union journal_res_state s, int idx) static inline int journal_state_seq_count(struct journal *j, union journal_res_state s, u64 seq) { - if (journal_cur_seq(j) - seq <= JOURNAL_STATE_BUF_NR) + if (journal_cur_seq(j) - seq < JOURNAL_STATE_BUF_NR) return journal_state_count(s, seq & JOURNAL_STATE_BUF_MASK); else return 0;