summaryrefslogtreecommitdiff
path: root/libbcachefs/journal_io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-03 16:21:35 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2020-06-03 19:56:33 -0400
commit1952c0790c74e4e81d7066a19aabc5c55a13f10f (patch)
tree501fa5db6a5f1fd3b2412a2660e995c74ebf0bba /libbcachefs/journal_io.c
parent90d54b388666b258c97be6a4e632824d136356c4 (diff)
Update bcachefs sources to c9b4a210f9 fixup! bcachefs: Fixes for going RO
Diffstat (limited to 'libbcachefs/journal_io.c')
-rw-r--r--libbcachefs/journal_io.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libbcachefs/journal_io.c b/libbcachefs/journal_io.c
index 39bb2154..b923efc4 100644
--- a/libbcachefs/journal_io.c
+++ b/libbcachefs/journal_io.c
@@ -2,6 +2,7 @@
#include "bcachefs.h"
#include "alloc_foreground.h"
#include "btree_io.h"
+#include "btree_update_interior.h"
#include "buckets.h"
#include "checksum.h"
#include "error.h"
@@ -993,8 +994,23 @@ void bch2_journal_write(struct closure *cl)
j->write_start_time = local_clock();
- start = vstruct_last(jset);
- end = bch2_journal_super_entries_add_common(c, start,
+ /*
+ * New btree roots are set by journalling them; when the journal entry
+ * gets written we have to propagate them to c->btree_roots
+ *
+ * But, every journal entry we write has to contain all the btree roots
+ * (at least for now); so after we copy btree roots to c->btree_roots we
+ * have to get any missing btree roots and add them to this journal
+ * entry:
+ */
+
+ bch2_journal_entries_to_btree_roots(c, jset);
+
+ start = end = vstruct_last(jset);
+
+ end = bch2_btree_roots_to_journal_entries(c, jset->start, end);
+
+ end = bch2_journal_super_entries_add_common(c, end,
le64_to_cpu(jset->seq));
u64s = (u64 *) end - (u64 *) start;
BUG_ON(u64s > j->entry_u64s_reserved);