]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: Fix incorrect state count
authorAlan Huang <mmpgouride@gmail.com>
Mon, 17 Mar 2025 17:54:24 +0000 (01:54 +0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 24 Mar 2025 13:50:35 +0000 (09:50 -0400)
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 <mmpgouride@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.h

index 1c460ded2a11f4db66a5d880f189494d3df30357..ab68c5c4d8d8c73f3f1d18dc93b81860c908e70a 100644 (file)
@@ -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;