Commit 4141fde0 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix bch2_journal_meta()

This patch ensures that the journal entry written gets written as flush
entry, which is important for the shutdown path - the last entry written
needs to be a flush entry.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent e75b2d4c
......@@ -641,6 +641,7 @@ int bch2_journal_flush_seq(struct journal *j, u64 seq)
int bch2_journal_meta(struct journal *j)
{
struct journal_buf *buf;
struct journal_res res;
int ret;
......@@ -650,6 +651,10 @@ int bch2_journal_meta(struct journal *j)
if (ret)
return ret;
buf = j->buf + (res.seq & JOURNAL_BUF_MASK);
buf->must_flush = true;
set_bit(JOURNAL_NEED_WRITE, &j->flags);
bch2_journal_res_put(j, &res);
return bch2_journal_flush_seq(j, res.seq);
......
......@@ -1445,7 +1445,7 @@ void bch2_journal_write(struct closure *cl)
SET_JSET_BIG_ENDIAN(jset, CPU_BIG_ENDIAN);
SET_JSET_CSUM_TYPE(jset, bch2_meta_checksum_type(c));
if (journal_entry_empty(jset))
if (!JSET_NO_FLUSH(jset) && journal_entry_empty(jset))
j->last_empty_seq = le64_to_cpu(jset->seq);
if (bch2_csum_type_is_encryption(JSET_CSUM_TYPE(jset)))
......
......@@ -131,7 +131,6 @@ do { \
return strtoi_h(buf, &var) ?: (ssize_t) size; \
} while (0)
write_attribute(trigger_journal_flush);
write_attribute(trigger_gc);
write_attribute(prune_cache);
rw_attribute(btree_gc_periodic);
......@@ -482,9 +481,6 @@ STORE(bch2_fs)
/* Debugging: */
if (attr == &sysfs_trigger_journal_flush)
bch2_journal_meta(&c->journal);
if (attr == &sysfs_trigger_gc) {
/*
* Full gc is currently incompatible with btree key cache:
......@@ -574,7 +570,6 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_io_timers_read,
&sysfs_io_timers_write,
&sysfs_trigger_journal_flush,
&sysfs_trigger_gc,
&sysfs_prune_cache,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment