From 30ef633a0b46e06860f46bf7df0f5a313e6e1a19 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 28 Feb 2022 19:17:27 -0500 Subject: bcachefs: Refactor journal code to not use unwritten_idx It makes the code more readable if we work off of sequence numbers, instead of direct indexes into the array of journal buffers. Signed-off-by: Kent Overstreet --- fs/bcachefs/journal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/bcachefs/journal.h') diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index 6c7a38ad2195..409d32b784d2 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -141,6 +141,11 @@ static inline u64 journal_cur_seq(struct journal *j) return j->pin.back - 1; } +static inline u64 journal_last_unwritten_seq(struct journal *j) +{ + return j->seq_ondisk + 1; +} + static inline int journal_state_count(union journal_res_state s, int idx) { switch (idx) { -- cgit v1.2.3