bcachefs: Improve btree_node_mem_ptr optimization
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 13 Sep 2021 20:04:49 +0000 (16:04 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:12 +0000 (17:09 -0400)
commitaae4eea60cf0c824abe6be809f0260df8574f49a
treeab9dd2ae4f4be916b3cad07badc7676ecce85c97
parentaa76bd3321f018af08629bb98ba2d5f0b4b18546
bcachefs: Improve btree_node_mem_ptr optimization

This patch checks b->hash_val before attempting to lock the node in the
btree, which makes it more equivalent to the "lookup in hash table"
path - and potentially avoids an unnecessary transaction restart if
btree_node_mem_ptr(k) no longer points to the node we want.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_cache.c