From 1bb3c2a9747c404d23012088fbefb4499b884415 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 20 Jun 2023 13:49:25 -0400 Subject: bcachefs: New error message helpers Add two new helpers for printing error messages with __func__ and bch2_err_str(): - bch_err_fn - bch_err_msg Also kill the old error strings in the recovery path, which were causing us to incorrectly report memory allocation failures - they're not needed anymore. Signed-off-by: Kent Overstreet --- fs/bcachefs/move.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fs/bcachefs/move.c') diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index fd629136824b..37fb3784a2f9 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -690,7 +690,7 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, bch2_trans_iter_exit(trans, &iter); if (ret) { - bch_err(c, "%s: error looking up alloc key: %s", __func__, bch2_err_str(ret)); + bch_err_msg(c, ret, "looking up alloc key"); goto err; } @@ -701,7 +701,7 @@ int __bch2_evacuate_bucket(struct btree_trans *trans, ret = bch2_btree_write_buffer_flush(trans); if (ret) { - bch_err(c, "%s: error flushing btree write buffer: %s", __func__, bch2_err_str(ret)); + bch_err_msg(c, ret, "flushing btree write buffer"); goto err; } @@ -904,7 +904,7 @@ next: bch2_trans_exit(&trans); if (ret) - bch_err(c, "error in %s(): %s", __func__, bch2_err_str(ret)); + bch_err_fn(c, ret); bch2_btree_interior_updates_flush(c); @@ -1029,6 +1029,8 @@ int bch2_scan_old_btree_nodes(struct bch_fs *c, struct bch_move_stats *stats) mutex_unlock(&c->sb_lock); } + if (ret) + bch_err_fn(c, ret); return ret; } -- cgit v1.2.3