Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: Don't touch c->flags in bch2_trans_iter_init()

This moves the JOURNAL_REPLAY_DONE flag check from
bch2_trans_iter_init() to bch2_trans_init(), where we stash a copy in
btree_trans - gaining us a small performance improvement.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+7 -5
+7 -5
fs/bcachefs/btree_iter.c
··· 1167 1167 (void *) src + offset, 1168 1168 sizeof(struct btree_path) - offset); 1169 1169 1170 - for (i = 0; i < BTREE_MAX_DEPTH; i++) 1171 - if (btree_node_locked(dst, i)) 1172 - six_lock_increment(&dst->l[i].b->c.lock, 1173 - __btree_lock_want(dst, i)); 1170 + for (i = 0; i < BTREE_MAX_DEPTH; i++) { 1171 + unsigned t = btree_node_locked_type(dst, i); 1172 + 1173 + if (t != BTREE_NODE_UNLOCKED) 1174 + six_lock_increment(&dst->l[i].b->c.lock, t); 1175 + } 1174 1176 1175 1177 trans->paths_sorted = false; 1176 1178 } ··· 2633 2631 unsigned depth, 2634 2632 unsigned flags) 2635 2633 { 2636 - if (trans->restarted) 2634 + if (unlikely(trans->restarted)) 2637 2635 panic("bch2_trans_iter_init(): in transaction restart, %s by %pS\n", 2638 2636 bch2_err_str(trans->restarted), 2639 2637 (void *) trans->last_restarted_ip);