Skip to content

Commit

Permalink
bcachefs: bch2_gc_pos_to_text()
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
  • Loading branch information
Kent Overstreet committed Jun 13, 2024
1 parent 2c32dfe commit c748270
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
16 changes: 16 additions & 0 deletions fs/bcachefs/btree_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@
#define DROP_PREV_NODE 11
#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)
{
return (struct bkey_s) {{{
Expand Down
2 changes: 2 additions & 0 deletions fs/bcachefs/btree_gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos)
return ret;
}

void bch2_gc_pos_to_text(struct printbuf *, struct gc_pos *);

int bch2_gc_gens(struct bch_fs *);
void bch2_gc_gens_async(struct bch_fs *);
void bch2_fs_gc_init(struct bch_fs *);
Expand Down
13 changes: 9 additions & 4 deletions fs/bcachefs/btree_gc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@

#include <linux/generic-radix-tree.h>

#define GC_PHASES() \
x(not_running) \
x(start) \
x(sb) \
x(btree)

enum gc_phase {
GC_PHASE_not_running,
GC_PHASE_start,
GC_PHASE_sb,
GC_PHASE_btree,
#define x(n) GC_PHASE_##n,
GC_PHASES()
#undef x
};

struct gc_pos {
Expand Down

0 comments on commit c748270

Please sign in to comment.