summaryrefslogtreecommitdiff
path: root/fs/bcachefs/bset.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-17 14:19:34 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:44 +0300
commitb0c5b15cc8969f79b410a825efe9894cdec85738 (patch)
tree495e92c60b482a06f7f07928eefc054d3f58837a /fs/bcachefs/bset.h
parent3e8b4b3afedc4757c2d8aaad9a900e98a453d110 (diff)
downloadlinux-b0c5b15cc8969f79b410a825efe9894cdec85738.tar.xz
bcachefs: Optimize __bkey_unpack_key_format_checked()
Delete some code when CONFIG_BCACHEFS_DEBUG=n Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bset.h')
-rw-r--r--fs/bcachefs/bset.h11
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