summaryrefslogtreecommitdiff
path: root/libbcachefs/journal_io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-20 16:28:18 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-20 16:28:27 -0500
commite5b2870d05753c1dedd79261ba5e321ce953f5ab (patch)
tree441dc614c9a1b13f0208a8a5cd749c2b4e32d217 /libbcachefs/journal_io.c
parent6ff5313cbe0432fb34605aea2f861cfc5c5fdb32 (diff)
Update bcachefs sources to c887148ebf99 thread_with_file: add f_ops.flush
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/journal_io.c')
-rw-r--r--libbcachefs/journal_io.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libbcachefs/journal_io.c b/libbcachefs/journal_io.c
index 16c1249c..f9e5b100 100644
--- a/libbcachefs/journal_io.c
+++ b/libbcachefs/journal_io.c
@@ -1830,7 +1830,10 @@ static int bch2_journal_write_prep(struct journal *j, struct journal_buf *w)
if (wb.wb)
bch2_journal_keys_to_write_buffer_end(c, &wb);
+
+ spin_lock(&c->journal.lock);
w->need_flush_to_write_buffer = false;
+ spin_unlock(&c->journal.lock);
start = end = vstruct_last(jset);
@@ -1948,12 +1951,20 @@ CLOSURE_CALLBACK(bch2_journal_write)
unsigned nr_rw_members = 0;
int ret;
+ for_each_rw_member(c, ca)
+ nr_rw_members++;
+
BUG_ON(BCH_SB_CLEAN(c->disk_sb.sb));
+ BUG_ON(!w->write_started);
BUG_ON(w->write_allocated);
+ BUG_ON(w->write_done);
j->write_start_time = local_clock();
spin_lock(&j->lock);
+ if (nr_rw_members > 1)
+ w->separate_flush = true;
+
ret = bch2_journal_write_pick_flush(j, w);
spin_unlock(&j->lock);
if (ret)
@@ -2008,12 +2019,6 @@ CLOSURE_CALLBACK(bch2_journal_write)
if (c->opts.nochanges)
goto no_io;
- for_each_rw_member(c, ca)
- nr_rw_members++;
-
- if (nr_rw_members > 1)
- w->separate_flush = true;
-
/*
* Mark journal replicas before we submit the write to guarantee
* recovery will find the journal entries after a crash.