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: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
10b93677d3
commit
06a98c966f
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user