summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/journal.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-02-18 17:39:42 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:16 -0400
commitd16b4a77a5c64fca52ff637c22668b679b47ef22 (patch)
tree7c5260d0bf950ee04a8bb6495b82ca7f6ea7a8f3 /fs/bcachefs/journal.h
parentecf37a4a80ec029d640b9c18f87880d4ec4a726f (diff)
downloadlinux-d16b4a77a5c64fca52ff637c22668b679b47ef22.tar.gz
linux-d16b4a77a5c64fca52ff637c22668b679b47ef22.tar.bz2
linux-d16b4a77a5c64fca52ff637c22668b679b47ef22.zip
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.h24
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);