summaryrefslogtreecommitdiff
path: root/libbcachefs/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/journal.c')
-rw-r--r--libbcachefs/journal.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libbcachefs/journal.c b/libbcachefs/journal.c
index 69e487bc..04c94e57 100644
--- a/libbcachefs/journal.c
+++ b/libbcachefs/journal.c
@@ -118,6 +118,9 @@ void __bch2_journal_buf_put(struct journal *j)
/*
* Returns true if journal entry is now closed:
+ *
+ * We don't close a journal_buf until the next journal_buf is finished writing,
+ * and can be opened again - this also initializes the next journal_buf:
*/
static bool __journal_entry_close(struct journal *j)
{
@@ -155,6 +158,7 @@ static bool __journal_entry_close(struct journal *j)
} while ((v = atomic64_cmpxchg(&j->reservations.counter,
old.v, new.v)) != old.v);
+ /* Close out old buffer: */
buf->data->u64s = cpu_to_le32(old.cur_entry_offset);
sectors = vstruct_blocks_plus(buf->data, c->block_bits,
@@ -185,6 +189,7 @@ static bool __journal_entry_close(struct journal *j)
__bch2_journal_pin_put(j, le64_to_cpu(buf->data->seq));
+ /* Initialize new buffer: */
journal_pin_new_entry(j, 1);
bch2_journal_buf_init(j);