Skip to content

Commit ad8b68c

Browse files
author
Kent Overstreet
committed
bcachefs: bch2_data_update_to_text()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 0f1f732 commit ad8b68c

File tree

3 files changed

+39
-25
lines changed

3 files changed

+39
-25
lines changed

fs/bcachefs/data_update.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include "bkey_buf.h"
66
#include "btree_update.h"
77
#include "buckets.h"
8+
#include "compress.h"
89
#include "data_update.h"
10+
#include "disk_groups.h"
911
#include "ec.h"
1012
#include "error.h"
1113
#include "extents.h"
@@ -454,6 +456,38 @@ static void bch2_update_unwritten_extent(struct btree_trans *trans,
454456
}
455457
}
456458

459+
void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c,
460+
struct bch_io_opts *io_opts,
461+
struct data_update_opts *data_opts)
462+
{
463+
printbuf_tabstop_push(out, 20);
464+
prt_str(out, "rewrite ptrs:\t");
465+
bch2_prt_u64_base2(out, data_opts->rewrite_ptrs);
466+
prt_newline(out);
467+
468+
prt_str(out, "kill ptrs:\t");
469+
bch2_prt_u64_base2(out, data_opts->kill_ptrs);
470+
prt_newline(out);
471+
472+
prt_str(out, "target:\t");
473+
bch2_target_to_text(out, c, data_opts->target);
474+
prt_newline(out);
475+
476+
prt_str(out, "compression:\t");
477+
bch2_compression_opt_to_text(out, background_compression(*io_opts));
478+
prt_newline(out);
479+
480+
prt_str(out, "extra replicas:\t");
481+
prt_u64(out, data_opts->extra_replicas);
482+
}
483+
484+
void bch2_data_update_to_text(struct printbuf *out, struct data_update *m)
485+
{
486+
bch2_bkey_val_to_text(out, m->op.c, bkey_i_to_s_c(m->k.k));
487+
prt_newline(out);
488+
bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts);
489+
}
490+
457491
int bch2_extent_drop_ptrs(struct btree_trans *trans,
458492
struct btree_iter *iter,
459493
struct bkey_s_c k,

fs/bcachefs/data_update.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ struct data_update_opts {
1717
unsigned write_flags;
1818
};
1919

20+
void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *,
21+
struct bch_io_opts *, struct data_update_opts *);
22+
2023
struct data_update {
2124
/* extent being updated: */
2225
enum btree_id btree_id;
@@ -27,6 +30,8 @@ struct data_update {
2730
struct bch_write_op op;
2831
};
2932

33+
void bch2_data_update_to_text(struct printbuf *, struct data_update *);
34+
3035
int bch2_data_update_index_update(struct bch_write_op *);
3136

3237
void bch2_data_update_read_done(struct data_update *,

fs/bcachefs/move.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,6 @@ const char * const bch2_data_ops_strs[] = {
3636
NULL
3737
};
3838

39-
static void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c,
40-
struct bch_io_opts *io_opts,
41-
struct data_update_opts *data_opts)
42-
{
43-
printbuf_tabstop_push(out, 20);
44-
prt_str(out, "rewrite ptrs:\t");
45-
bch2_prt_u64_base2(out, data_opts->rewrite_ptrs);
46-
prt_newline(out);
47-
48-
prt_str(out, "kill ptrs:\t");
49-
bch2_prt_u64_base2(out, data_opts->kill_ptrs);
50-
prt_newline(out);
51-
52-
prt_str(out, "target:\t");
53-
bch2_target_to_text(out, c, data_opts->target);
54-
prt_newline(out);
55-
56-
prt_str(out, "compression:\t");
57-
bch2_compression_opt_to_text(out, background_compression(*io_opts));
58-
prt_newline(out);
59-
60-
prt_str(out, "extra replicas:\t");
61-
prt_u64(out, data_opts->extra_replicas);
62-
}
63-
6439
static void trace_move_extent2(struct bch_fs *c, struct bkey_s_c k,
6540
struct bch_io_opts *io_opts,
6641
struct data_update_opts *data_opts)

0 commit comments

Comments
 (0)