bcachefs-tools/libbcache/debug.h

66 lines
1.6 KiB
C
Raw Normal View History

2017-01-08 12:13:18 +03:00
#ifndef _BCACHE_DEBUG_H
#define _BCACHE_DEBUG_H
#include "bcache.h"
struct bio;
struct btree;
struct cached_dev;
2017-03-11 00:40:01 +03:00
struct bch_fs;
2017-01-08 12:13:18 +03:00
#define BCH_DEBUG_PARAM(name, description) extern bool bch_##name;
BCH_DEBUG_PARAMS()
#undef BCH_DEBUG_PARAM
#define BCH_DEBUG_PARAM(name, description) \
2017-03-11 00:40:01 +03:00
static inline bool name(struct bch_fs *c) \
2017-01-08 12:13:18 +03:00
{ return bch_##name || c->name; }
BCH_DEBUG_PARAMS_ALWAYS()
#undef BCH_DEBUG_PARAM
#ifdef CONFIG_BCACHE_DEBUG
#define BCH_DEBUG_PARAM(name, description) \
2017-03-11 00:40:01 +03:00
static inline bool name(struct bch_fs *c) \
2017-01-08 12:13:18 +03:00
{ return bch_##name || c->name; }
BCH_DEBUG_PARAMS_DEBUG()
#undef BCH_DEBUG_PARAM
2017-03-11 00:40:01 +03:00
void __bch_btree_verify(struct bch_fs *, struct btree *);
2017-01-08 12:13:18 +03:00
void bch_data_verify(struct cached_dev *, struct bio *);
#define bypass_torture_test(d) ((d)->bypass_torture_test)
#else /* DEBUG */
#define BCH_DEBUG_PARAM(name, description) \
2017-03-11 00:40:01 +03:00
static inline bool name(struct bch_fs *c) { return false; }
2017-01-08 12:13:18 +03:00
BCH_DEBUG_PARAMS_DEBUG()
#undef BCH_DEBUG_PARAM
2017-03-11 00:40:01 +03:00
static inline void __bch_btree_verify(struct bch_fs *c, struct btree *b) {}
2017-01-08 12:13:18 +03:00
static inline void bch_data_verify(struct cached_dev *dc, struct bio *bio) {}
#define bypass_torture_test(d) 0
#endif
2017-03-11 00:40:01 +03:00
static inline void bch_btree_verify(struct bch_fs *c, struct btree *b)
2017-01-08 12:13:18 +03:00
{
if (verify_btree_ondisk(c))
__bch_btree_verify(c, b);
}
#ifdef CONFIG_DEBUG_FS
2017-03-11 00:40:01 +03:00
void bch_fs_debug_exit(struct bch_fs *);
void bch_fs_debug_init(struct bch_fs *);
2017-01-08 12:13:18 +03:00
#else
2017-03-11 00:40:01 +03:00
static inline void bch_fs_debug_exit(struct bch_fs *c) {}
static inline void bch_fs_debug_init(struct bch_fs *c) {}
2017-01-08 12:13:18 +03:00
#endif
void bch_debug_exit(void);
int bch_debug_init(void);
#endif