diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-02-19 01:39:42 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:16 +0300 |
commit | d16b4a77a5c64fca52ff637c22668b679b47ef22 (patch) | |
tree | 7c5260d0bf950ee04a8bb6495b82ca7f6ea7a8f3 /fs/bcachefs/journal.h | |
parent | ecf37a4a80ec029d640b9c18f87880d4ec4a726f (diff) | |
download | linux-d16b4a77a5c64fca52ff637c22668b679b47ef22.tar.xz |
bcachefs: Assorted journal refactoring
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal.h')
-rw-r--r-- | fs/bcachefs/journal.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index 5290cdeab585..4acb0f59396d 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -179,6 +179,11 @@ static inline unsigned jset_u64s(unsigned u64s) return u64s + sizeof(struct jset_entry) / sizeof(u64); } +static inline int journal_entry_overhead(struct journal *j) +{ + return sizeof(struct jset) / sizeof(u64) + j->entry_u64s_reserved; +} + static inline struct jset_entry * bch2_journal_add_entry_noreservation(struct journal_buf *buf, size_t u64s) { @@ -225,7 +230,7 @@ static inline void bch2_journal_add_keys(struct journal *j, struct journal_res * id, 0, k, k->k.u64s); } -void bch2_journal_buf_put_slowpath(struct journal *, bool); +void __bch2_journal_buf_put(struct journal *, bool); static inline void bch2_journal_buf_put(struct journal *j, unsigned idx, bool need_write_just_set) @@ -236,17 +241,10 @@ static inline void bch2_journal_buf_put(struct journal *j, unsigned idx, .buf0_count = idx == 0, .buf1_count = idx == 1, }).v, &j->reservations.counter); - - EBUG_ON(s.idx != idx && !s.prev_buf_unwritten); - - /* - * Do not initiate a journal write if the journal is in an error state - * (previous journal entry write may have failed) - */ - if (s.idx != idx && - !journal_state_count(s, idx) && - s.cur_entry_offset != JOURNAL_ENTRY_ERROR_VAL) - bch2_journal_buf_put_slowpath(j, need_write_just_set); + if (!journal_state_count(s, idx)) { + EBUG_ON(s.idx == idx || !s.prev_buf_unwritten); + __bch2_journal_buf_put(j, need_write_just_set); + } } /* @@ -333,6 +331,8 @@ out: return 0; } +/* journal_entry_res: */ + void bch2_journal_entry_res_resize(struct journal *, struct journal_entry_res *, unsigned); |