Commit 449ceafb authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_trans_commit_flags_to_text()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent b7f10636
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h" #include "bcachefs.h"
#include "alloc_foreground.h"
#include "btree_gc.h" #include "btree_gc.h"
#include "btree_io.h" #include "btree_io.h"
#include "btree_iter.h" #include "btree_iter.h"
...@@ -19,6 +20,26 @@ ...@@ -19,6 +20,26 @@
#include <linux/prefetch.h> #include <linux/prefetch.h>
static const char * const trans_commit_flags_strs[] = {
#define x(n, ...) #n,
BCH_TRANS_COMMIT_FLAGS()
#undef x
NULL
};
void bch2_trans_commit_flags_to_text(struct printbuf *out, enum bch_trans_commit_flags flags)
{
enum bch_watermark watermark = flags & BCH_WATERMARK_MASK;
prt_printf(out, "watermark=%s", bch2_watermarks[watermark]);
flags >>= BCH_WATERMARK_BITS;
if (flags) {
prt_char(out, ' ');
bch2_prt_bitflags(out, trans_commit_flags_strs, flags);
}
}
static void verify_update_old_key(struct btree_trans *trans, struct btree_insert_entry *i) static void verify_update_old_key(struct btree_trans *trans, struct btree_insert_entry *i)
{ {
#ifdef CONFIG_BCACHEFS_DEBUG #ifdef CONFIG_BCACHEFS_DEBUG
......
...@@ -44,6 +44,8 @@ enum bch_trans_commit_flags { ...@@ -44,6 +44,8 @@ enum bch_trans_commit_flags {
#undef x #undef x
}; };
void bch2_trans_commit_flags_to_text(struct printbuf *, enum bch_trans_commit_flags);
int bch2_btree_delete_extent_at(struct btree_trans *, struct btree_iter *, int bch2_btree_delete_extent_at(struct btree_trans *, struct btree_iter *,
unsigned, unsigned); unsigned, unsigned);
int bch2_btree_delete_at(struct btree_trans *, struct btree_iter *, unsigned); int bch2_btree_delete_at(struct btree_trans *, struct btree_iter *, unsigned);
......
...@@ -1207,7 +1207,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path, ...@@ -1207,7 +1207,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
as->start_time = start_time; as->start_time = start_time;
as->ip_started = _RET_IP_; as->ip_started = _RET_IP_;
as->mode = BTREE_UPDATE_none; as->mode = BTREE_UPDATE_none;
as->watermark = watermark; as->flags = flags;
as->took_gc_lock = true; as->took_gc_lock = true;
as->btree_id = path->btree_id; as->btree_id = path->btree_id;
as->update_level_start = level_start; as->update_level_start = level_start;
...@@ -2565,12 +2565,13 @@ void bch2_btree_root_alloc_fake(struct bch_fs *c, enum btree_id id, unsigned lev ...@@ -2565,12 +2565,13 @@ void bch2_btree_root_alloc_fake(struct bch_fs *c, enum btree_id id, unsigned lev
static void bch2_btree_update_to_text(struct printbuf *out, struct btree_update *as) static void bch2_btree_update_to_text(struct printbuf *out, struct btree_update *as)
{ {
prt_printf(out, "%ps: btree=%s l=%u-%u watermark=%s mode=%s nodes_written=%u cl.remaining=%u journal_seq=%llu\n", prt_printf(out, "%ps: ", (void *) as->ip_started);
(void *) as->ip_started, bch2_trans_commit_flags_to_text(out, as->flags);
prt_printf(out, " btree=%s l=%u-%u mode=%s nodes_written=%u cl.remaining=%u journal_seq=%llu\n",
bch2_btree_id_str(as->btree_id), bch2_btree_id_str(as->btree_id),
as->update_level_start, as->update_level_start,
as->update_level_end, as->update_level_end,
bch2_watermarks[as->watermark],
bch2_btree_update_modes[as->mode], bch2_btree_update_modes[as->mode],
as->nodes_written, as->nodes_written,
closure_nr_remaining(&as->cl), closure_nr_remaining(&as->cl),
......
...@@ -52,7 +52,7 @@ struct btree_update { ...@@ -52,7 +52,7 @@ struct btree_update {
struct list_head unwritten_list; struct list_head unwritten_list;
enum btree_update_mode mode; enum btree_update_mode mode;
enum bch_watermark watermark; enum bch_trans_commit_flags flags;
unsigned nodes_written:1; unsigned nodes_written:1;
unsigned took_gc_lock:1; unsigned took_gc_lock:1;
......
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