debug.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _BCACHE_DEBUG_H
  2. #define _BCACHE_DEBUG_H
  3. /* Btree/bkey debug printing */
  4. #define KEYHACK_SIZE 80
  5. struct keyprint_hack {
  6. char s[KEYHACK_SIZE];
  7. };
  8. struct keyprint_hack bch_pkey(const struct bkey *k);
  9. struct keyprint_hack bch_pbtree(const struct btree *b);
  10. #define pkey(k) (&bch_pkey(k).s[0])
  11. #define pbtree(b) (&bch_pbtree(b).s[0])
  12. #ifdef CONFIG_BCACHE_EDEBUG
  13. unsigned bch_count_data(struct btree *);
  14. void bch_check_key_order_msg(struct btree *, struct bset *, const char *, ...);
  15. void bch_check_keys(struct btree *, const char *, ...);
  16. #define bch_check_key_order(b, i) \
  17. bch_check_key_order_msg(b, i, "keys out of order")
  18. #define EBUG_ON(cond) BUG_ON(cond)
  19. #else /* EDEBUG */
  20. #define bch_count_data(b) 0
  21. #define bch_check_key_order(b, i) do {} while (0)
  22. #define bch_check_key_order_msg(b, i, ...) do {} while (0)
  23. #define bch_check_keys(b, ...) do {} while (0)
  24. #define EBUG_ON(cond) do {} while (0)
  25. #endif
  26. #ifdef CONFIG_BCACHE_DEBUG
  27. void bch_btree_verify(struct btree *, struct bset *);
  28. void bch_data_verify(struct search *);
  29. #else /* DEBUG */
  30. static inline void bch_btree_verify(struct btree *b, struct bset *i) {}
  31. static inline void bch_data_verify(struct search *s) {};
  32. #endif
  33. #ifdef CONFIG_DEBUG_FS
  34. void bch_debug_init_cache_set(struct cache_set *);
  35. #else
  36. static inline void bch_debug_init_cache_set(struct cache_set *c) {}
  37. #endif
  38. #endif