debug.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _BCACHE_DEBUG_H
  2. #define _BCACHE_DEBUG_H
  3. /* Btree/bkey debug printing */
  4. int bch_bkey_to_text(char *buf, size_t size, const struct bkey *k);
  5. int bch_btree_to_text(char *buf, size_t size, const struct btree *b);
  6. #ifdef CONFIG_BCACHE_EDEBUG
  7. unsigned bch_count_data(struct btree *);
  8. void bch_check_key_order_msg(struct btree *, struct bset *, const char *, ...);
  9. void bch_check_keys(struct btree *, const char *, ...);
  10. #define bch_check_key_order(b, i) \
  11. bch_check_key_order_msg(b, i, "keys out of order")
  12. #define EBUG_ON(cond) BUG_ON(cond)
  13. #else /* EDEBUG */
  14. #define bch_count_data(b) 0
  15. #define bch_check_key_order(b, i) do {} while (0)
  16. #define bch_check_key_order_msg(b, i, ...) do {} while (0)
  17. #define bch_check_keys(b, ...) do {} while (0)
  18. #define EBUG_ON(cond) do {} while (0)
  19. #endif
  20. #ifdef CONFIG_BCACHE_DEBUG
  21. void bch_btree_verify(struct btree *, struct bset *);
  22. void bch_data_verify(struct search *);
  23. #else /* DEBUG */
  24. static inline void bch_btree_verify(struct btree *b, struct bset *i) {}
  25. static inline void bch_data_verify(struct search *s) {};
  26. #endif
  27. #ifdef CONFIG_DEBUG_FS
  28. void bch_debug_init_cache_set(struct cache_set *);
  29. #else
  30. static inline void bch_debug_init_cache_set(struct cache_set *c) {}
  31. #endif
  32. #endif