Commit ad8b68cd authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_data_update_to_text()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 0f1f7324
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
#include "bkey_buf.h" #include "bkey_buf.h"
#include "btree_update.h" #include "btree_update.h"
#include "buckets.h" #include "buckets.h"
#include "compress.h"
#include "data_update.h" #include "data_update.h"
#include "disk_groups.h"
#include "ec.h" #include "ec.h"
#include "error.h" #include "error.h"
#include "extents.h" #include "extents.h"
...@@ -454,6 +456,38 @@ static void bch2_update_unwritten_extent(struct btree_trans *trans, ...@@ -454,6 +456,38 @@ static void bch2_update_unwritten_extent(struct btree_trans *trans,
} }
} }
void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c,
struct bch_io_opts *io_opts,
struct data_update_opts *data_opts)
{
printbuf_tabstop_push(out, 20);
prt_str(out, "rewrite ptrs:\t");
bch2_prt_u64_base2(out, data_opts->rewrite_ptrs);
prt_newline(out);
prt_str(out, "kill ptrs:\t");
bch2_prt_u64_base2(out, data_opts->kill_ptrs);
prt_newline(out);
prt_str(out, "target:\t");
bch2_target_to_text(out, c, data_opts->target);
prt_newline(out);
prt_str(out, "compression:\t");
bch2_compression_opt_to_text(out, background_compression(*io_opts));
prt_newline(out);
prt_str(out, "extra replicas:\t");
prt_u64(out, data_opts->extra_replicas);
}
void bch2_data_update_to_text(struct printbuf *out, struct data_update *m)
{
bch2_bkey_val_to_text(out, m->op.c, bkey_i_to_s_c(m->k.k));
prt_newline(out);
bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts);
}
int bch2_extent_drop_ptrs(struct btree_trans *trans, int bch2_extent_drop_ptrs(struct btree_trans *trans,
struct btree_iter *iter, struct btree_iter *iter,
struct bkey_s_c k, struct bkey_s_c k,
......
...@@ -17,6 +17,9 @@ struct data_update_opts { ...@@ -17,6 +17,9 @@ struct data_update_opts {
unsigned write_flags; unsigned write_flags;
}; };
void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *,
struct bch_io_opts *, struct data_update_opts *);
struct data_update { struct data_update {
/* extent being updated: */ /* extent being updated: */
enum btree_id btree_id; enum btree_id btree_id;
...@@ -27,6 +30,8 @@ struct data_update { ...@@ -27,6 +30,8 @@ struct data_update {
struct bch_write_op op; struct bch_write_op op;
}; };
void bch2_data_update_to_text(struct printbuf *, struct data_update *);
int bch2_data_update_index_update(struct bch_write_op *); int bch2_data_update_index_update(struct bch_write_op *);
void bch2_data_update_read_done(struct data_update *, void bch2_data_update_read_done(struct data_update *,
......
...@@ -36,31 +36,6 @@ const char * const bch2_data_ops_strs[] = { ...@@ -36,31 +36,6 @@ const char * const bch2_data_ops_strs[] = {
NULL NULL
}; };
static void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c,
struct bch_io_opts *io_opts,
struct data_update_opts *data_opts)
{
printbuf_tabstop_push(out, 20);
prt_str(out, "rewrite ptrs:\t");
bch2_prt_u64_base2(out, data_opts->rewrite_ptrs);
prt_newline(out);
prt_str(out, "kill ptrs:\t");
bch2_prt_u64_base2(out, data_opts->kill_ptrs);
prt_newline(out);
prt_str(out, "target:\t");
bch2_target_to_text(out, c, data_opts->target);
prt_newline(out);
prt_str(out, "compression:\t");
bch2_compression_opt_to_text(out, background_compression(*io_opts));
prt_newline(out);
prt_str(out, "extra replicas:\t");
prt_u64(out, data_opts->extra_replicas);
}
static void trace_move_extent2(struct bch_fs *c, struct bkey_s_c k, static void trace_move_extent2(struct bch_fs *c, struct bkey_s_c k,
struct bch_io_opts *io_opts, struct bch_io_opts *io_opts,
struct data_update_opts *data_opts) struct data_update_opts *data_opts)
......
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