diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-17 07:19:34 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:44 -0400 |
commit | b0c5b15cc8969f79b410a825efe9894cdec85738 (patch) | |
tree | 495e92c60b482a06f7f07928eefc054d3f58837a | |
parent | 3e8b4b3afedc4757c2d8aaad9a900e98a453d110 (diff) |
bcachefs: Optimize __bkey_unpack_key_format_checked()
Delete some code when CONFIG_BCACHEFS_DEBUG=n
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/bset.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/bcachefs/bset.h b/fs/bcachefs/bset.h index 9708b9ffa4df..e458d1acdef4 100644 --- a/fs/bcachefs/bset.h +++ b/fs/bcachefs/bset.h @@ -212,20 +212,19 @@ __bkey_unpack_key_format_checked(const struct btree *b, struct bkey *dst, const struct bkey_packed *src) { -#ifdef HAVE_BCACHEFS_COMPILED_UNPACK - { + if (IS_ENABLED(HAVE_BCACHEFS_COMPILED_UNPACK)) { compiled_unpack_fn unpack_fn = b->aux_data; unpack_fn(dst, src); - if (bch2_expensive_debug_checks) { + if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) && + bch2_expensive_debug_checks) { struct bkey dst2 = __bch2_bkey_unpack_key(&b->format, src); BUG_ON(memcmp(dst, &dst2, sizeof(*dst))); } + } else { + *dst = __bch2_bkey_unpack_key(&b->format, src); } -#else - *dst = __bch2_bkey_unpack_key(&b->format, src); -#endif } static inline struct bkey |