Commit dd3995a6 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_gc_pos_to_text()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 11169d99
...@@ -45,6 +45,22 @@ ...@@ -45,6 +45,22 @@
#define DROP_PREV_NODE 11 #define DROP_PREV_NODE 11
#define DID_FILL_FROM_SCAN 12 #define DID_FILL_FROM_SCAN 12
static const char * const bch2_gc_phase_strs[] = {
#define x(n) #n,
GC_PHASES()
#undef x
NULL
};
void bch2_gc_pos_to_text(struct printbuf *out, struct gc_pos *p)
{
prt_str(out, bch2_gc_phase_strs[p->phase]);
prt_char(out, ' ');
bch2_btree_id_to_text(out, p->btree);
prt_printf(out, " l=%u ", p->level);
bch2_bpos_to_text(out, p->pos);
}
static struct bkey_s unsafe_bkey_s_c_to_s(struct bkey_s_c k) static struct bkey_s unsafe_bkey_s_c_to_s(struct bkey_s_c k)
{ {
return (struct bkey_s) {{{ return (struct bkey_s) {{{
......
...@@ -78,6 +78,8 @@ static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos) ...@@ -78,6 +78,8 @@ static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos)
return ret; return ret;
} }
void bch2_gc_pos_to_text(struct printbuf *, struct gc_pos *);
int bch2_gc_gens(struct bch_fs *); int bch2_gc_gens(struct bch_fs *);
void bch2_gc_gens_async(struct bch_fs *); void bch2_gc_gens_async(struct bch_fs *);
void bch2_fs_gc_init(struct bch_fs *); void bch2_fs_gc_init(struct bch_fs *);
......
...@@ -4,11 +4,16 @@ ...@@ -4,11 +4,16 @@
#include <linux/generic-radix-tree.h> #include <linux/generic-radix-tree.h>
#define GC_PHASES() \
x(not_running) \
x(start) \
x(sb) \
x(btree)
enum gc_phase { enum gc_phase {
GC_PHASE_not_running, #define x(n) GC_PHASE_##n,
GC_PHASE_start, GC_PHASES()
GC_PHASE_sb, #undef x
GC_PHASE_btree,
}; };
struct gc_pos { struct gc_pos {
......
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