Commit 06a98c96 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Change __bch2_trans_commit() to run triggers then get RW

This is prep work for the next patch, which is going to change
__bch2_trans_commit() to use bch2_journal_key_insert() when very early
in the recovery process, so that we have a unified interface for doing
btree updates.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 10b93677
......@@ -982,6 +982,17 @@ int __bch2_trans_commit(struct btree_trans *trans)
if (trans->flags & BTREE_INSERT_GC_LOCK_HELD)
lockdep_assert_held(&c->gc_lock);
ret = bch2_trans_commit_run_triggers(trans);
if (ret)
goto out_reset;
if (!(trans->flags & BTREE_INSERT_NOCHECK_RW) &&
unlikely(!percpu_ref_tryget(&c->writes))) {
ret = bch2_trans_commit_get_rw_cold(trans);
if (ret)
goto out_reset;
}
memset(&trans->journal_preres, 0, sizeof(trans->journal_preres));
trans->journal_u64s = trans->extra_journal_entry_u64s;
......@@ -992,17 +1003,6 @@ int __bch2_trans_commit(struct btree_trans *trans)
if (trans->journal_transaction_names)
trans->journal_u64s += JSET_ENTRY_LOG_U64s;
if (!(trans->flags & BTREE_INSERT_NOCHECK_RW) &&
unlikely(!percpu_ref_tryget(&c->writes))) {
ret = bch2_trans_commit_get_rw_cold(trans);
if (ret)
goto out_reset;
}
ret = bch2_trans_commit_run_triggers(trans);
if (ret)
goto out;
trans_for_each_update(trans, i) {
BUG_ON(!i->path->should_be_locked);
......
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