bcachefs: BTREE_UPDATE_NOJOURNAL

We're going to have btree updates that don't need to be journalled; add
a flag for that.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2022-12-31 00:15:23 -05:00
parent c27314b448
commit 34d74830b2
2 changed files with 7 additions and 2 deletions

View File

@ -630,6 +630,7 @@ static inline bool btree_type_has_snapshots(enum btree_id id)
enum btree_update_flags {
__BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE,
__BTREE_UPDATE_NOJOURNAL,
__BTREE_TRIGGER_NORUN, /* Don't run triggers at all */
@ -642,6 +643,7 @@ enum btree_update_flags {
};
#define BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE (1U << __BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE)
#define BTREE_UPDATE_NOJOURNAL (1U << __BTREE_UPDATE_NOJOURNAL)
#define BTREE_TRIGGER_NORUN (1U << __BTREE_TRIGGER_NORUN)

View File

@ -356,7 +356,8 @@ static inline void do_btree_insert_one(struct btree_trans *trans,
if (!did_work)
return;
if (likely(!(trans->flags & BTREE_INSERT_JOURNAL_REPLAY))) {
if (likely(!(trans->flags & BTREE_INSERT_JOURNAL_REPLAY)) &&
!(i->flags & BTREE_UPDATE_NOJOURNAL)) {
bch2_journal_add_keys(j, &trans->journal_res,
i->btree_id,
i->level,
@ -897,7 +898,9 @@ int __bch2_trans_commit(struct btree_trans *trans)
if (i->cached &&
likely(!(trans->flags & BTREE_INSERT_JOURNAL_REPLAY)))
trans->journal_preres_u64s += u64s;
trans->journal_u64s += u64s;
if (!(i->flags & BTREE_UPDATE_NOJOURNAL))
trans->journal_u64s += u64s;
}
if (trans->extra_journal_res) {