Commit b0c5b15c authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Optimize __bkey_unpack_key_format_checked()

Delete some code when CONFIG_BCACHEFS_DEBUG=n
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 3e8b4b3a
...@@ -212,20 +212,19 @@ __bkey_unpack_key_format_checked(const struct btree *b, ...@@ -212,20 +212,19 @@ __bkey_unpack_key_format_checked(const struct btree *b,
struct bkey *dst, struct bkey *dst,
const struct bkey_packed *src) 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; compiled_unpack_fn unpack_fn = b->aux_data;
unpack_fn(dst, src); 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); struct bkey dst2 = __bch2_bkey_unpack_key(&b->format, src);
BUG_ON(memcmp(dst, &dst2, sizeof(*dst))); 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 static inline struct bkey
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment