diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-02-24 21:25:00 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:08:35 +0200 |
commit | 72141e1f4fa4f389f64d4ed7c6a63689e67921ac (patch) | |
tree | 9f7a853dfce1eefd75c055354221ae03a6352496 /fs/bcachefs/btree_cache.h | |
parent | bcachefs: Fix incorrect initialization of btree_node_old_extent_overwrite() (diff) | |
download | linux-72141e1f4fa4f389f64d4ed7c6a63689e67921ac.tar.xz linux-72141e1f4fa4f389f64d4ed7c6a63689e67921ac.zip |
bcachefs: Use btree_ptr_v2.mem_ptr to avoid hash table lookup
Nice performance optimization
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_cache.h')
-rw-r--r-- | fs/bcachefs/btree_cache.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h index 6e7edcaf6675..5d85987457bf 100644 --- a/fs/bcachefs/btree_cache.h +++ b/fs/bcachefs/btree_cache.h @@ -47,6 +47,13 @@ static inline u64 btree_ptr_hash_val(const struct bkey_i *k) } } +static inline struct btree *btree_node_mem_ptr(const struct bkey_i *k) +{ + return k->k.type == KEY_TYPE_btree_ptr_v2 + ? (void *)(unsigned long)bkey_i_to_btree_ptr_v2_c(k)->v.mem_ptr + : NULL; +} + /* is btree node in hash table? */ static inline bool btree_node_hashed(struct btree *b) { |