]> www.infradead.org Git - users/hch/xfs.git/commitdiff
bcachefs: bch2_data_update_to_text()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 3 Jul 2024 17:25:13 +0000 (13:25 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 10 Jul 2024 13:53:39 +0000 (09:53 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/data_update.c
fs/bcachefs/data_update.h
fs/bcachefs/move.c

index 1a0072eef109b57934e7aa8be7650a2856a3ffc2..eeae760a15d3cccd902f1092843847cc8bb9537e 100644 (file)
@@ -5,7 +5,9 @@
 #include "bkey_buf.h"
 #include "btree_update.h"
 #include "buckets.h"
+#include "compress.h"
 #include "data_update.h"
+#include "disk_groups.h"
 #include "ec.h"
 #include "error.h"
 #include "extents.h"
@@ -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,
                          struct btree_iter *iter,
                          struct bkey_s_c k,
index 991095bbd469baeb55de1c0d2636267e49d68a28..8d36365bdea8a5fbdac77f86a92431a822bc580e 100644 (file)
@@ -17,6 +17,9 @@ struct data_update_opts {
        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 {
        /* extent being updated: */
        enum btree_id           btree_id;
@@ -27,6 +30,8 @@ struct data_update {
        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 *);
 
 void bch2_data_update_read_done(struct data_update *,
index 6e477fadaa2a5b546e191f4da614e8d74722bd47..e714e3bd5bbbb1eddf4f4dc4de35bae692f43b7b 100644 (file)
@@ -36,31 +36,6 @@ const char * const bch2_data_ops_strs[] = {
        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,
                               struct bch_io_opts *io_opts,
                               struct data_update_opts *data_opts)