Commit d4bf5eec authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Use bch2_err_str() in error messages

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 615f867c
...@@ -464,7 +464,7 @@ int bch2_alloc_read(struct bch_fs *c) ...@@ -464,7 +464,7 @@ int bch2_alloc_read(struct bch_fs *c)
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
if (ret) if (ret)
bch_err(c, "error reading alloc info: %i", ret); bch_err(c, "error reading alloc info: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1211,7 +1211,7 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca) ...@@ -1211,7 +1211,7 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca)
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
if (ret < 0) { if (ret < 0) {
bch_err(ca, "error initializing free space: %i", ret); bch_err(ca, "error initializing free space: %s", bch2_err_str(ret));
return ret; return ret;
} }
......
...@@ -402,8 +402,8 @@ static int bch2_btree_repair_topology_recurse(struct bch_fs *c, struct btree *b) ...@@ -402,8 +402,8 @@ static int bch2_btree_repair_topology_recurse(struct bch_fs *c, struct btree *b)
} }
if (ret) { if (ret) {
bch_err(c, "%s: error %i getting btree node", bch_err(c, "%s: error getting btree node: %s",
__func__, ret); __func__, bch2_err_str(ret));
break; break;
} }
...@@ -471,8 +471,8 @@ static int bch2_btree_repair_topology_recurse(struct bch_fs *c, struct btree *b) ...@@ -471,8 +471,8 @@ static int bch2_btree_repair_topology_recurse(struct bch_fs *c, struct btree *b)
ret = PTR_ERR_OR_ZERO(cur); ret = PTR_ERR_OR_ZERO(cur);
if (ret) { if (ret) {
bch_err(c, "%s: error %i getting btree node", bch_err(c, "%s: error getting btree node: %s",
__func__, ret); __func__, bch2_err_str(ret));
goto err; goto err;
} }
...@@ -804,7 +804,7 @@ static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id, ...@@ -804,7 +804,7 @@ static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id,
fsck_err: fsck_err:
err: err:
if (ret) if (ret)
bch_err(c, "%s: ret %i", __func__, ret); bch_err(c, "error from %s(): %s", __func__, bch2_err_str(ret));
return ret; return ret;
} }
...@@ -910,7 +910,8 @@ static int bch2_gc_btree_init_recurse(struct btree_trans *trans, struct btree *b ...@@ -910,7 +910,8 @@ static int bch2_gc_btree_init_recurse(struct btree_trans *trans, struct btree *b
ret = bch2_gc_mark_key(trans, b->c.btree_id, b->c.level, ret = bch2_gc_mark_key(trans, b->c.btree_id, b->c.level,
false, &k, true); false, &k, true);
if (ret) { if (ret) {
bch_err(c, "%s: error %i from bch2_gc_mark_key", __func__, ret); bch_err(c, "%s: error from bch2_gc_mark_key: %s",
__func__, bch2_err_str(ret));
goto fsck_err; goto fsck_err;
} }
...@@ -970,8 +971,8 @@ static int bch2_gc_btree_init_recurse(struct btree_trans *trans, struct btree *b ...@@ -970,8 +971,8 @@ static int bch2_gc_btree_init_recurse(struct btree_trans *trans, struct btree *b
continue; continue;
} }
} else if (ret) { } else if (ret) {
bch_err(c, "%s: error %i getting btree node", bch_err(c, "%s: error getting btree node: %s",
__func__, ret); __func__, bch2_err_str(ret));
break; break;
} }
...@@ -1038,7 +1039,7 @@ static int bch2_gc_btree_init(struct btree_trans *trans, ...@@ -1038,7 +1039,7 @@ static int bch2_gc_btree_init(struct btree_trans *trans,
six_unlock_read(&b->c.lock); six_unlock_read(&b->c.lock);
if (ret < 0) if (ret < 0)
bch_err(c, "%s: ret %i", __func__, ret); bch_err(c, "error from %s(): %s", __func__, bch2_err_str(ret));
printbuf_exit(&buf); printbuf_exit(&buf);
return ret; return ret;
} }
...@@ -1068,7 +1069,7 @@ static int bch2_gc_btrees(struct bch_fs *c, bool initial, bool metadata_only) ...@@ -1068,7 +1069,7 @@ static int bch2_gc_btrees(struct bch_fs *c, bool initial, bool metadata_only)
: bch2_gc_btree(&trans, ids[i], initial, metadata_only); : bch2_gc_btree(&trans, ids[i], initial, metadata_only);
if (ret < 0) if (ret < 0)
bch_err(c, "%s: ret %i", __func__, ret); bch_err(c, "error from %s(): %s", __func__, bch2_err_str(ret));
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
return ret; return ret;
...@@ -1266,7 +1267,7 @@ static int bch2_gc_done(struct bch_fs *c, ...@@ -1266,7 +1267,7 @@ static int bch2_gc_done(struct bch_fs *c,
if (ca) if (ca)
percpu_ref_put(&ca->ref); percpu_ref_put(&ca->ref);
if (ret) if (ret)
bch_err(c, "%s: ret %i", __func__, ret); bch_err(c, "error from %s(): %s", __func__, bch2_err_str(ret));
percpu_up_write(&c->mark_lock); percpu_up_write(&c->mark_lock);
printbuf_exit(&buf); printbuf_exit(&buf);
...@@ -1433,7 +1434,7 @@ static int bch2_gc_alloc_done(struct bch_fs *c, bool metadata_only) ...@@ -1433,7 +1434,7 @@ static int bch2_gc_alloc_done(struct bch_fs *c, bool metadata_only)
bch2_alloc_write_key(&trans, &iter, k, metadata_only)); bch2_alloc_write_key(&trans, &iter, k, metadata_only));
if (ret < 0) { if (ret < 0) {
bch_err(c, "error writing alloc info: %i", ret); bch_err(c, "error writing alloc info: %s", bch2_err_str(ret));
percpu_ref_put(&ca->ref); percpu_ref_put(&ca->ref);
break; break;
} }
...@@ -1497,7 +1498,7 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only) ...@@ -1497,7 +1498,7 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only)
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
if (ret) if (ret)
bch_err(c, "error reading alloc info at gc start: %i", ret); bch_err(c, "error reading alloc info at gc start: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1968,7 +1969,7 @@ int bch2_gc_gens(struct bch_fs *c) ...@@ -1968,7 +1969,7 @@ int bch2_gc_gens(struct bch_fs *c)
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
gc_btree_gens_key(&trans, &iter, k)); gc_btree_gens_key(&trans, &iter, k));
if (ret) { if (ret) {
bch_err(c, "error recalculating oldest_gen: %i", ret); bch_err(c, "error recalculating oldest_gen: %s", bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -1981,7 +1982,7 @@ int bch2_gc_gens(struct bch_fs *c) ...@@ -1981,7 +1982,7 @@ int bch2_gc_gens(struct bch_fs *c)
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
bch2_alloc_write_oldest_gen(&trans, &iter, k)); bch2_alloc_write_oldest_gen(&trans, &iter, k));
if (ret) { if (ret) {
bch_err(c, "error writing oldest_gen: %i", ret); bch_err(c, "error writing oldest_gen: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -2053,7 +2054,7 @@ static int bch2_gc_thread(void *arg) ...@@ -2053,7 +2054,7 @@ static int bch2_gc_thread(void *arg)
ret = bch2_gc_gens(c); ret = bch2_gc_gens(c);
#endif #endif
if (ret < 0) if (ret < 0)
bch_err(c, "btree gc failed: %i", ret); bch_err(c, "btree gc failed: %s", bch2_err_str(ret));
debug_check_no_locks_held(); debug_check_no_locks_held();
} }
...@@ -2083,7 +2084,7 @@ int bch2_gc_thread_start(struct bch_fs *c) ...@@ -2083,7 +2084,7 @@ int bch2_gc_thread_start(struct bch_fs *c)
p = kthread_create(bch2_gc_thread, c, "bch-gc/%s", c->name); p = kthread_create(bch2_gc_thread, c, "bch-gc/%s", c->name);
if (IS_ERR(p)) { if (IS_ERR(p)) {
bch_err(c, "error creating gc thread: %li", PTR_ERR(p)); bch_err(c, "error creating gc thread: %s", bch2_err_str(PTR_ERR(p)));
return PTR_ERR(p); return PTR_ERR(p);
} }
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h" #include "bcachefs.h"
#include "checksum.h" #include "checksum.h"
#include "errcode.h"
#include "super.h" #include "super.h"
#include "super-io.h" #include "super-io.h"
...@@ -527,7 +528,7 @@ int bch2_decrypt_sb_key(struct bch_fs *c, ...@@ -527,7 +528,7 @@ int bch2_decrypt_sb_key(struct bch_fs *c,
ret = bch2_request_key(c->disk_sb.sb, &user_key); ret = bch2_request_key(c->disk_sb.sb, &user_key);
if (ret) { if (ret) {
bch_err(c, "error requesting encryption key: %i", ret); bch_err(c, "error requesting encryption key: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -552,20 +553,24 @@ int bch2_decrypt_sb_key(struct bch_fs *c, ...@@ -552,20 +553,24 @@ int bch2_decrypt_sb_key(struct bch_fs *c,
static int bch2_alloc_ciphers(struct bch_fs *c) static int bch2_alloc_ciphers(struct bch_fs *c)
{ {
int ret;
if (!c->chacha20) if (!c->chacha20)
c->chacha20 = crypto_alloc_sync_skcipher("chacha20", 0, 0); c->chacha20 = crypto_alloc_sync_skcipher("chacha20", 0, 0);
if (IS_ERR(c->chacha20)) { ret = PTR_ERR_OR_ZERO(c->chacha20);
bch_err(c, "error requesting chacha20 module: %li",
PTR_ERR(c->chacha20)); if (ret) {
return PTR_ERR(c->chacha20); bch_err(c, "error requesting chacha20 module: %s", bch2_err_str(ret));
return ret;
} }
if (!c->poly1305) if (!c->poly1305)
c->poly1305 = crypto_alloc_shash("poly1305", 0, 0); c->poly1305 = crypto_alloc_shash("poly1305", 0, 0);
if (IS_ERR(c->poly1305)) { ret = PTR_ERR_OR_ZERO(c->poly1305);
bch_err(c, "error requesting poly1305 module: %li",
PTR_ERR(c->poly1305)); if (ret) {
return PTR_ERR(c->poly1305); bch_err(c, "error requesting poly1305 module: %s", bch2_err_str(ret));
return ret;
} }
return 0; return 0;
...@@ -626,7 +631,7 @@ int bch2_enable_encryption(struct bch_fs *c, bool keyed) ...@@ -626,7 +631,7 @@ int bch2_enable_encryption(struct bch_fs *c, bool keyed)
if (keyed) { if (keyed) {
ret = bch2_request_key(c->disk_sb.sb, &user_key); ret = bch2_request_key(c->disk_sb.sb, &user_key);
if (ret) { if (ret) {
bch_err(c, "error requesting encryption key: %i", ret); bch_err(c, "error requesting encryption key: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -678,9 +683,9 @@ int bch2_fs_encryption_init(struct bch_fs *c) ...@@ -678,9 +683,9 @@ int bch2_fs_encryption_init(struct bch_fs *c)
pr_verbose_init(c->opts, ""); pr_verbose_init(c->opts, "");
c->sha256 = crypto_alloc_shash("sha256", 0, 0); c->sha256 = crypto_alloc_shash("sha256", 0, 0);
if (IS_ERR(c->sha256)) { ret = PTR_ERR_OR_ZERO(c->sha256);
bch_err(c, "error requesting sha256 module"); if (ret) {
ret = PTR_ERR(c->sha256); bch_err(c, "error requesting sha256 module: %s", bch2_err_str(ret));
goto out; goto out;
} }
......
...@@ -949,7 +949,8 @@ static void ec_stripe_create(struct ec_stripe_new *s) ...@@ -949,7 +949,8 @@ static void ec_stripe_create(struct ec_stripe_new *s)
for_each_keylist_key(&s->keys, k) { for_each_keylist_key(&s->keys, k) {
ret = ec_stripe_update_extents(c, &s->new_stripe, &k->k); ret = ec_stripe_update_extents(c, &s->new_stripe, &k->k);
if (ret) { if (ret) {
bch_err(c, "error creating stripe: error %i updating pointers", ret); bch_err(c, "error creating stripe: error updating pointers: %s",
bch2_err_str(ret));
break; break;
} }
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "buckets.h" #include "buckets.h"
#include "chardev.h" #include "chardev.h"
#include "dirent.h" #include "dirent.h"
#include "errcode.h"
#include "extents.h" #include "extents.h"
#include "fs.h" #include "fs.h"
#include "fs-common.h" #include "fs-common.h"
...@@ -1871,10 +1872,9 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type, ...@@ -1871,10 +1872,9 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,
sb->s_shrink.seeks = 0; sb->s_shrink.seeks = 0;
vinode = bch2_vfs_inode_get(c, BCACHEFS_ROOT_SUBVOL_INUM); vinode = bch2_vfs_inode_get(c, BCACHEFS_ROOT_SUBVOL_INUM);
if (IS_ERR(vinode)) { ret = PTR_ERR_OR_ZERO(vinode);
bch_err(c, "error mounting: error getting root inode %i", if (ret) {
(int) PTR_ERR(vinode)); bch_err(c, "error mounting: error getting root inode: %s", bch2_err_str(ret));
ret = PTR_ERR(vinode);
goto err_put_super; goto err_put_super;
} }
......
...@@ -137,8 +137,8 @@ static int lookup_first_inode(struct btree_trans *trans, u64 inode_nr, ...@@ -137,8 +137,8 @@ static int lookup_first_inode(struct btree_trans *trans, u64 inode_nr,
ret = bch2_inode_unpack(k, inode); ret = bch2_inode_unpack(k, inode);
err: err:
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(trans->c, "error %i fetching inode %llu", bch_err(trans->c, "error fetching inode %llu: %s",
ret, inode_nr); inode_nr, bch2_err_str(ret));
bch2_trans_iter_exit(trans, &iter); bch2_trans_iter_exit(trans, &iter);
return ret; return ret;
} }
...@@ -165,8 +165,8 @@ static int __lookup_inode(struct btree_trans *trans, u64 inode_nr, ...@@ -165,8 +165,8 @@ static int __lookup_inode(struct btree_trans *trans, u64 inode_nr,
*snapshot = iter.pos.snapshot; *snapshot = iter.pos.snapshot;
err: err:
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(trans->c, "error %i fetching inode %llu:%u", bch_err(trans->c, "error fetching inode %llu:%u: %s",
ret, inode_nr, *snapshot); inode_nr, *snapshot, bch2_err_str(ret));
bch2_trans_iter_exit(trans, &iter); bch2_trans_iter_exit(trans, &iter);
return ret; return ret;
} }
...@@ -225,7 +225,8 @@ static int write_inode(struct btree_trans *trans, ...@@ -225,7 +225,8 @@ static int write_inode(struct btree_trans *trans,
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
__write_inode(trans, inode, snapshot)); __write_inode(trans, inode, snapshot));
if (ret) if (ret)
bch_err(trans->c, "error in fsck: error %i updating inode", ret); bch_err(trans->c, "error in fsck: error updating inode: %s",
bch2_err_str(ret));
return ret; return ret;
} }
...@@ -314,7 +315,7 @@ static int __remove_dirent(struct btree_trans *trans, struct bpos pos) ...@@ -314,7 +315,7 @@ static int __remove_dirent(struct btree_trans *trans, struct bpos pos)
bch2_trans_iter_exit(trans, &iter); bch2_trans_iter_exit(trans, &iter);
err: err:
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(c, "error %i from __remove_dirent()", ret); bch_err(c, "error from __remove_dirent(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -350,7 +351,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 subvol, ...@@ -350,7 +351,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 subvol,
} }
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(c, "error looking up lost+found: %i", ret); bch_err(c, "error looking up lost+found: %s", bch2_err_str(ret));
if (ret) if (ret)
return ret; return ret;
...@@ -373,7 +374,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 subvol, ...@@ -373,7 +374,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 subvol,
0, 0, S_IFDIR|0700, 0, NULL, NULL, 0, 0, S_IFDIR|0700, 0, NULL, NULL,
(subvol_inum) { }, 0); (subvol_inum) { }, 0);
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(c, "error creating lost+found: %i", ret); bch_err(c, "error creating lost+found: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -437,8 +438,8 @@ static int reattach_inode(struct btree_trans *trans, ...@@ -437,8 +438,8 @@ static int reattach_inode(struct btree_trans *trans,
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
__reattach_inode(trans, inode, inode_snapshot)); __reattach_inode(trans, inode, inode_snapshot));
if (ret) { if (ret) {
bch_err(trans->c, "error %i reattaching inode %llu", bch_err(trans->c, "error reattaching inode %llu: %s",
ret, inode->bi_inum); inode->bi_inum, bch2_err_str(ret));
return ret; return ret;
} }
...@@ -910,7 +911,8 @@ static int check_inode(struct btree_trans *trans, ...@@ -910,7 +911,8 @@ static int check_inode(struct btree_trans *trans,
ret = fsck_inode_rm(trans, u.bi_inum, iter->pos.snapshot); ret = fsck_inode_rm(trans, u.bi_inum, iter->pos.snapshot);
if (ret) if (ret)
bch_err(c, "error in fsck: error %i while deleting inode", ret); bch_err(c, "error in fsck: error while deleting inode: %s",
bch2_err_str(ret));
return ret; return ret;
} }
...@@ -933,7 +935,8 @@ static int check_inode(struct btree_trans *trans, ...@@ -933,7 +935,8 @@ static int check_inode(struct btree_trans *trans,
POS(u.bi_inum, U64_MAX), POS(u.bi_inum, U64_MAX),
0, NULL); 0, NULL);
if (ret) { if (ret) {
bch_err(c, "error in fsck: error %i truncating inode", ret); bch_err(c, "error in fsck: error truncating inode: %s",
bch2_err_str(ret));
return ret; return ret;
} }
...@@ -958,8 +961,8 @@ static int check_inode(struct btree_trans *trans, ...@@ -958,8 +961,8 @@ static int check_inode(struct btree_trans *trans,
sectors = bch2_count_inode_sectors(trans, u.bi_inum, iter->pos.snapshot); sectors = bch2_count_inode_sectors(trans, u.bi_inum, iter->pos.snapshot);
if (sectors < 0) { if (sectors < 0) {
bch_err(c, "error in fsck: error %i recounting inode sectors", bch_err(c, "error in fsck: error recounting inode sectors: %s",
(int) sectors); bch2_err_str(sectors));
return sectors; return sectors;
} }
...@@ -978,13 +981,13 @@ static int check_inode(struct btree_trans *trans, ...@@ -978,13 +981,13 @@ static int check_inode(struct btree_trans *trans,
if (do_update) { if (do_update) {
ret = __write_inode(trans, &u, iter->pos.snapshot); ret = __write_inode(trans, &u, iter->pos.snapshot);
if (ret) if (ret)
bch_err(c, "error in fsck: error %i " bch_err(c, "error in fsck: error updating inode: %s",
"updating inode", ret); bch2_err_str(ret));
} }
err: err:
fsck_err: fsck_err:
if (ret) if (ret)
bch_err(c, "error %i from check_inode()", ret); bch_err(c, "error from check_inode(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1010,7 +1013,7 @@ static int check_inodes(struct bch_fs *c, bool full) ...@@ -1010,7 +1013,7 @@ static int check_inodes(struct bch_fs *c, bool full)
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
snapshots_seen_exit(&s); snapshots_seen_exit(&s);
if (ret) if (ret)
bch_err(c, "error %i from check_inodes()", ret); bch_err(c, "error from check_inodes(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1145,7 +1148,7 @@ static int check_i_sectors(struct btree_trans *trans, struct inode_walker *w) ...@@ -1145,7 +1148,7 @@ static int check_i_sectors(struct btree_trans *trans, struct inode_walker *w)
} }
fsck_err: fsck_err:
if (ret) if (ret)
bch_err(c, "error %i from check_i_sectors()", ret); bch_err(c, "error from check_i_sectors(): %s", bch2_err_str(ret));
return ret ?: ret2; return ret ?: ret2;
} }
...@@ -1327,7 +1330,7 @@ static int check_extents(struct bch_fs *c) ...@@ -1327,7 +1330,7 @@ static int check_extents(struct bch_fs *c)
snapshots_seen_exit(&s); snapshots_seen_exit(&s);
if (ret) if (ret)
bch_err(c, "error %i from check_extents()", ret); bch_err(c, "error from check_extents(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1366,7 +1369,7 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w) ...@@ -1366,7 +1369,7 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w)
} }
fsck_err: fsck_err:
if (ret) if (ret)
bch_err(c, "error %i from check_subdir_count()", ret); bch_err(c, "error from check_subdir_count(): %s", bch2_err_str(ret));
return ret ?: ret2; return ret ?: ret2;
} }
...@@ -1485,7 +1488,7 @@ static int check_dirent_target(struct btree_trans *trans, ...@@ -1485,7 +1488,7 @@ static int check_dirent_target(struct btree_trans *trans,
printbuf_exit(&buf); printbuf_exit(&buf);
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(c, "error %i from check_target()", ret); bch_err(c, "error from check_target(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1658,7 +1661,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter, ...@@ -1658,7 +1661,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
printbuf_exit(&buf); printbuf_exit(&buf);
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(c, "error %i from check_dirent()", ret); bch_err(c, "error from check_dirent(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1697,7 +1700,7 @@ static int check_dirents(struct bch_fs *c) ...@@ -1697,7 +1700,7 @@ static int check_dirents(struct bch_fs *c)
inode_walker_exit(&target); inode_walker_exit(&target);
if (ret) if (ret)
bch_err(c, "error %i from check_dirents()", ret); bch_err(c, "error from check_dirents(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1733,7 +1736,7 @@ static int check_xattr(struct btree_trans *trans, struct btree_iter *iter, ...@@ -1733,7 +1736,7 @@ static int check_xattr(struct btree_trans *trans, struct btree_iter *iter,
ret = hash_check_key(trans, bch2_xattr_hash_desc, hash_info, iter, k); ret = hash_check_key(trans, bch2_xattr_hash_desc, hash_info, iter, k);
fsck_err: fsck_err:
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(c, "error %i from check_xattr()", ret); bch_err(c, "error from check_xattr(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1765,7 +1768,7 @@ static int check_xattrs(struct bch_fs *c) ...@@ -1765,7 +1768,7 @@ static int check_xattrs(struct bch_fs *c)
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
if (ret) if (ret)
bch_err(c, "error %i from check_xattrs()", ret); bch_err(c, "error from check_xattrs(): %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1797,7 +1800,7 @@ static int check_root_trans(struct btree_trans *trans) ...@@ -1797,7 +1800,7 @@ static int check_root_trans(struct btree_trans *trans)
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
__bch2_btree_insert(trans, BTREE_ID_subvolumes, &root_subvol.k_i)); __bch2_btree_insert(trans, BTREE_ID_subvolumes, &root_subvol.k_i));
if (ret) { if (ret) {
bch_err(c, "error writing root subvol: %i", ret); bch_err(c, "error writing root subvol: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -1816,7 +1819,7 @@ static int check_root_trans(struct btree_trans *trans) ...@@ -1816,7 +1819,7 @@ static int check_root_trans(struct btree_trans *trans)
ret = __write_inode(trans, &root_inode, snapshot); ret = __write_inode(trans, &root_inode, snapshot);
if (ret) if (ret)
bch_err(c, "error writing root inode: %i", ret); bch_err(c, "error writing root inode: %s", bch2_err_str(ret));
} }
err: err:
fsck_err: fsck_err:
...@@ -1969,7 +1972,7 @@ static int check_path(struct btree_trans *trans, ...@@ -1969,7 +1972,7 @@ static int check_path(struct btree_trans *trans,
} }
fsck_err: fsck_err:
if (ret) if (ret)
bch_err(c, "%s: err %i", __func__, ret); bch_err(c, "%s: err %s", __func__, bch2_err_str(ret));
return ret; return ret;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "bcachefs.h" #include "bcachefs.h"
#include "btree_key_cache.h" #include "btree_key_cache.h"
#include "errcode.h"
#include "error.h" #include "error.h"
#include "journal.h" #include "journal.h"
#include "journal_io.h" #include "journal_io.h"
...@@ -741,15 +742,17 @@ int bch2_journal_reclaim_start(struct journal *j) ...@@ -741,15 +742,17 @@ int bch2_journal_reclaim_start(struct journal *j)
{ {
struct bch_fs *c = container_of(j, struct bch_fs, journal); struct bch_fs *c = container_of(j, struct bch_fs, journal);
struct task_struct *p; struct task_struct *p;
int ret;
if (j->reclaim_thread) if (j->reclaim_thread)
return 0; return 0;
p = kthread_create(bch2_journal_reclaim_thread, j, p = kthread_create(bch2_journal_reclaim_thread, j,
"bch-reclaim/%s", c->name); "bch-reclaim/%s", c->name);
if (IS_ERR(p)) { ret = PTR_ERR_OR_ZERO(p);
bch_err(c, "error creating journal reclaim thread: %li", PTR_ERR(p)); if (ret) {
return PTR_ERR(p); bch_err(c, "error creating journal reclaim thread: %s", bch2_err_str(ret));
return ret;
} }
get_task_struct(p); get_task_struct(p);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "btree_update.h" #include "btree_update.h"
#include "btree_update_interior.h" #include "btree_update_interior.h"
#include "buckets.h" #include "buckets.h"
#include "errcode.h"
#include "extents.h" #include "extents.h"
#include "io.h" #include "io.h"
#include "journal.h" #include "journal.h"
...@@ -151,7 +152,8 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags) ...@@ -151,7 +152,8 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags)
} }
if (ret) { if (ret) {
bch_err(c, "Error updating btree node key: %i", ret); bch_err(c, "Error updating btree node key: %s",
bch2_err_str(ret));
break; break;
} }
next: next:
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "btree_update_interior.h" #include "btree_update_interior.h"
#include "disk_groups.h" #include "disk_groups.h"
#include "ec.h" #include "ec.h"
#include "errcode.h"
#include "inode.h" #include "inode.h"
#include "io.h" #include "io.h"
#include "journal_reclaim.h" #include "journal_reclaim.h"
...@@ -564,7 +565,7 @@ static int bch2_move_btree(struct bch_fs *c, ...@@ -564,7 +565,7 @@ static int bch2_move_btree(struct bch_fs *c,
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
if (ret) if (ret)
bch_err(c, "error %i in bch2_move_btree", ret); bch_err(c, "error in %s(): %s", __func__, bch2_err_str(ret));
bch2_btree_interior_updates_flush(c); bch2_btree_interior_updates_flush(c);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "buckets.h" #include "buckets.h"
#include "clock.h" #include "clock.h"
#include "disk_groups.h" #include "disk_groups.h"
#include "errcode.h"
#include "error.h" #include "error.h"
#include "extents.h" #include "extents.h"
#include "eytzinger.h" #include "eytzinger.h"
...@@ -319,7 +320,7 @@ static int bch2_copygc(struct bch_fs *c) ...@@ -319,7 +320,7 @@ static int bch2_copygc(struct bch_fs *c)
false, false,
copygc_pred, NULL); copygc_pred, NULL);
if (ret < 0) if (ret < 0)
bch_err(c, "error %i from bch2_move_data() in copygc", ret); bch_err(c, "error from bch2_move_data() in copygc: %s", bch2_err_str(ret));
if (ret) if (ret)
return ret; return ret;
...@@ -427,6 +428,7 @@ void bch2_copygc_stop(struct bch_fs *c) ...@@ -427,6 +428,7 @@ void bch2_copygc_stop(struct bch_fs *c)
int bch2_copygc_start(struct bch_fs *c) int bch2_copygc_start(struct bch_fs *c)
{ {
struct task_struct *t; struct task_struct *t;
int ret;
if (c->copygc_thread) if (c->copygc_thread)
return 0; return 0;
...@@ -438,9 +440,10 @@ int bch2_copygc_start(struct bch_fs *c) ...@@ -438,9 +440,10 @@ int bch2_copygc_start(struct bch_fs *c)
return -ENOMEM; return -ENOMEM;
t = kthread_create(bch2_copygc_thread, c, "bch-copygc/%s", c->name); t = kthread_create(bch2_copygc_thread, c, "bch-copygc/%s", c->name);
if (IS_ERR(t)) { ret = PTR_ERR_OR_ZERO(t);
bch_err(c, "error creating copygc thread: %li", PTR_ERR(t)); if (ret) {
return PTR_ERR(t); bch_err(c, "error creating copygc thread: %s", bch2_err_str(ret));
return ret;
} }
get_task_struct(t); get_task_struct(t);
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h" #include "bcachefs.h"
#include "btree_update.h" #include "btree_update.h"
#include "errcode.h"
#include "inode.h" #include "inode.h"
#include "quota.h" #include "quota.h"
#include "subvolume.h" #include "subvolume.h"
...@@ -488,7 +489,7 @@ int bch2_fs_quota_read(struct bch_fs *c) ...@@ -488,7 +489,7 @@ int bch2_fs_quota_read(struct bch_fs *c)
POS_MIN, BTREE_ITER_PREFETCH|BTREE_ITER_ALL_SNAPSHOTS, k, POS_MIN, BTREE_ITER_PREFETCH|BTREE_ITER_ALL_SNAPSHOTS, k,
bch2_fs_quota_read_inode(&trans, &iter, k)); bch2_fs_quota_read_inode(&trans, &iter, k));
if (ret) if (ret)
bch_err(c, "err in quota_read: %i", ret); bch_err(c, "err in quota_read: %s", bch2_err_str(ret));
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
return ret; return ret;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "buckets.h" #include "buckets.h"
#include "clock.h" #include "clock.h"
#include "disk_groups.h" #include "disk_groups.h"
#include "errcode.h"
#include "extents.h" #include "extents.h"
#include "io.h" #include "io.h"
#include "move.h" #include "move.h"
...@@ -332,6 +333,7 @@ void bch2_rebalance_stop(struct bch_fs *c) ...@@ -332,6 +333,7 @@ void bch2_rebalance_stop(struct bch_fs *c)
int bch2_rebalance_start(struct bch_fs *c) int bch2_rebalance_start(struct bch_fs *c)
{ {
struct task_struct *p; struct task_struct *p;
int ret;
if (c->rebalance.thread) if (c->rebalance.thread)
return 0; return 0;
...@@ -340,9 +342,10 @@ int bch2_rebalance_start(struct bch_fs *c) ...@@ -340,9 +342,10 @@ int bch2_rebalance_start(struct bch_fs *c)
return 0; return 0;
p = kthread_create(bch2_rebalance_thread, c, "bch-rebalance/%s", c->name); p = kthread_create(bch2_rebalance_thread, c, "bch-rebalance/%s", c->name);
if (IS_ERR(p)) { ret = PTR_ERR_OR_ZERO(p);
bch_err(c, "error creating rebalance thread: %li", PTR_ERR(p)); if (ret) {
return PTR_ERR(p); bch_err(c, "error creating rebalance thread: %s", bch2_err_str(ret));
return ret;
} }
get_task_struct(p); get_task_struct(p);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "buckets.h" #include "buckets.h"
#include "dirent.h" #include "dirent.h"
#include "ec.h" #include "ec.h"
#include "errcode.h"
#include "error.h" #include "error.h"
#include "fs-common.h" #include "fs-common.h"
#include "fsck.h" #include "fsck.h"
...@@ -1419,9 +1420,9 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1419,9 +1420,9 @@ int bch2_fs_recovery(struct bch_fs *c)
} }
if (ret) if (ret)
bch_err(c, "Error in recovery: %s (%i)", err, ret); bch_err(c, "Error in recovery: %s (%s)", err, bch2_err_str(ret));
else else
bch_verbose(c, "ret %i", ret); bch_verbose(c, "ret %s", bch2_err_str(ret));
return ret; return ret;
err: err:
fsck_err: fsck_err:
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "bcachefs.h" #include "bcachefs.h"
#include "btree_key_cache.h" #include "btree_key_cache.h"
#include "btree_update.h" #include "btree_update.h"
#include "errcode.h"
#include "error.h" #include "error.h"
#include "fs.h" #include "fs.h"
#include "subvolume.h" #include "subvolume.h"
...@@ -315,8 +316,8 @@ static int check_subvol(struct btree_trans *trans, ...@@ -315,8 +316,8 @@ static int check_subvol(struct btree_trans *trans,
if (BCH_SUBVOLUME_UNLINKED(subvol.v)) { if (BCH_SUBVOLUME_UNLINKED(subvol.v)) {
ret = bch2_subvolume_delete(trans, iter->pos.offset); ret = bch2_subvolume_delete(trans, iter->pos.offset);
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(trans->c, "error deleting subvolume %llu: %i", bch_err(trans->c, "error deleting subvolume %llu: %s",
iter->pos.offset, ret); iter->pos.offset, bch2_err_str(ret));
if (ret) if (ret)
return ret; return ret;
} }
...@@ -365,7 +366,7 @@ int bch2_fs_snapshots_start(struct bch_fs *c) ...@@ -365,7 +366,7 @@ int bch2_fs_snapshots_start(struct bch_fs *c)
bch2_trans_exit(&trans); bch2_trans_exit(&trans);
if (ret) if (ret)
bch_err(c, "error starting snapshots: %i", ret); bch_err(c, "error starting snapshots: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -647,7 +648,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -647,7 +648,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
if (!test_bit(BCH_FS_STARTED, &c->flags)) { if (!test_bit(BCH_FS_STARTED, &c->flags)) {
ret = bch2_fs_read_write_early(c); ret = bch2_fs_read_write_early(c);
if (ret) { if (ret) {
bch_err(c, "error deleleting dead snapshots: error going rw: %i", ret); bch_err(c, "error deleleting dead snapshots: error going rw: %s", bch2_err_str(ret));
return ret; return ret;
} }
} }
...@@ -663,7 +664,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -663,7 +664,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
NULL, NULL, 0, NULL, NULL, 0,
bch2_delete_redundant_snapshot(&trans, &iter, k)); bch2_delete_redundant_snapshot(&trans, &iter, k));
if (ret) { if (ret) {
bch_err(c, "error deleting redundant snapshots: %i", ret); bch_err(c, "error deleting redundant snapshots: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -671,7 +672,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -671,7 +672,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
POS_MIN, 0, k, POS_MIN, 0, k,
bch2_snapshot_set_equiv(&trans, k)); bch2_snapshot_set_equiv(&trans, k));
if (ret) { if (ret) {
bch_err(c, "error in bch2_snapshots_set_equiv: %i", ret); bch_err(c, "error in bch2_snapshots_set_equiv: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -690,7 +691,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -690,7 +691,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
bch2_trans_iter_exit(&trans, &iter); bch2_trans_iter_exit(&trans, &iter);
if (ret) { if (ret) {
bch_err(c, "error walking snapshots: %i", ret); bch_err(c, "error walking snapshots: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -710,7 +711,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -710,7 +711,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
darray_exit(&equiv_seen); darray_exit(&equiv_seen);
if (ret) { if (ret) {
bch_err(c, "error deleting snapshot keys: %i", ret); bch_err(c, "error deleting snapshot keys: %s", bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -719,8 +720,8 @@ int bch2_delete_dead_snapshots(struct bch_fs *c) ...@@ -719,8 +720,8 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
ret = commit_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_snapshot_node_delete(&trans, deleted.data[i])); bch2_snapshot_node_delete(&trans, deleted.data[i]));
if (ret) { if (ret) {
bch_err(c, "error deleting snapshot %u: %i", bch_err(c, "error deleting snapshot %u: %s",
deleted.data[i], ret); deleted.data[i], bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -912,7 +913,7 @@ void bch2_subvolume_wait_for_pagecache_and_delete(struct work_struct *work) ...@@ -912,7 +913,7 @@ void bch2_subvolume_wait_for_pagecache_and_delete(struct work_struct *work)
ret = bch2_trans_do(c, NULL, NULL, BTREE_INSERT_NOFAIL, ret = bch2_trans_do(c, NULL, NULL, BTREE_INSERT_NOFAIL,
bch2_subvolume_delete(&trans, *id)); bch2_subvolume_delete(&trans, *id));
if (ret) { if (ret) {
bch_err(c, "error %i deleting subvolume %u", ret, *id); bch_err(c, "error deleting subvolume %u: %s", *id, bch2_err_str(ret));
break; break;
} }
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "debug.h" #include "debug.h"
#include "disk_groups.h" #include "disk_groups.h"
#include "ec.h" #include "ec.h"
#include "errcode.h"
#include "error.h" #include "error.h"
#include "fs.h" #include "fs.h"
#include "fs-io.h" #include "fs-io.h"
...@@ -1430,7 +1431,7 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca) ...@@ -1430,7 +1431,7 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)
bch2_btree_delete_range(c, BTREE_ID_alloc, start, end, bch2_btree_delete_range(c, BTREE_ID_alloc, start, end,
BTREE_TRIGGER_NORUN, NULL); BTREE_TRIGGER_NORUN, NULL);
if (ret) if (ret)
bch_err(c, "error %i removing dev alloc info", ret); bch_err(c, "error removing dev alloc info: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -1458,7 +1459,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags) ...@@ -1458,7 +1459,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
ret = bch2_dev_data_drop(c, ca->dev_idx, flags); ret = bch2_dev_data_drop(c, ca->dev_idx, flags);
if (ret) { if (ret) {
bch_err(ca, "Remove failed: error %i dropping data", ret); bch_err(ca, "Remove failed: error dropping data: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -1470,7 +1471,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags) ...@@ -1470,7 +1471,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
ret = bch2_journal_flush_device_pins(&c->journal, ca->dev_idx); ret = bch2_journal_flush_device_pins(&c->journal, ca->dev_idx);
if (ret) { if (ret) {
bch_err(ca, "Remove failed: error %i flushing journal", ret); bch_err(ca, "Remove failed: error flushing journal: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -1482,7 +1483,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags) ...@@ -1482,7 +1483,7 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
ret = bch2_replicas_gc2(c); ret = bch2_replicas_gc2(c);
if (ret) { if (ret) {
bch_err(ca, "Remove failed: error %i from replicas gc", ret); bch_err(ca, "Remove failed: error from replicas gc: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -1546,7 +1547,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path) ...@@ -1546,7 +1547,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret = bch2_read_super(path, &opts, &sb); ret = bch2_read_super(path, &opts, &sb);
if (ret) { if (ret) {
bch_err(c, "device add error: error reading super: %i", ret); bch_err(c, "device add error: error reading super: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -1639,13 +1640,13 @@ int bch2_dev_add(struct bch_fs *c, const char *path) ...@@ -1639,13 +1640,13 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret = bch2_trans_mark_dev_sb(c, ca); ret = bch2_trans_mark_dev_sb(c, ca);
if (ret) { if (ret) {
bch_err(c, "device add error: error marking new superblock: %i", ret); bch_err(c, "device add error: error marking new superblock: %s", bch2_err_str(ret));
goto err_late; goto err_late;
} }
ret = bch2_fs_freespace_init(c); ret = bch2_fs_freespace_init(c);
if (ret) { if (ret) {
bch_err(c, "device add error: error initializing free space: %i", ret); bch_err(c, "device add error: error initializing free space: %s", bch2_err_str(ret));
goto err_late; goto err_late;
} }
...@@ -1707,8 +1708,8 @@ int bch2_dev_online(struct bch_fs *c, const char *path) ...@@ -1707,8 +1708,8 @@ int bch2_dev_online(struct bch_fs *c, const char *path)
ret = bch2_trans_mark_dev_sb(c, ca); ret = bch2_trans_mark_dev_sb(c, ca);
if (ret) { if (ret) {
bch_err(c, "error bringing %s online: error %i from bch2_trans_mark_dev_sb", bch_err(c, "error bringing %s online: error from bch2_trans_mark_dev_sb: %s",
path, ret); path, bch2_err_str(ret));
goto err; goto err;
} }
...@@ -1777,7 +1778,7 @@ int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets) ...@@ -1777,7 +1778,7 @@ int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets)
ret = bch2_dev_buckets_resize(c, ca, nbuckets); ret = bch2_dev_buckets_resize(c, ca, nbuckets);
if (ret) { if (ret) {
bch_err(ca, "Resize error: %i", ret); bch_err(ca, "Resize error: %s", bch2_err_str(ret));
goto err; goto err;
} }
......
...@@ -46,7 +46,7 @@ static int test_delete(struct bch_fs *c, u64 nr) ...@@ -46,7 +46,7 @@ static int test_delete(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &k.k_i, 0)); bch2_trans_update(&trans, &iter, &k.k_i, 0));
if (ret) { if (ret) {
bch_err(c, "update error in test_delete: %i", ret); bch_err(c, "update error in test_delete: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -55,7 +55,7 @@ static int test_delete(struct bch_fs *c, u64 nr) ...@@ -55,7 +55,7 @@ static int test_delete(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(&trans, &iter, 0)); bch2_btree_delete_at(&trans, &iter, 0));
if (ret) { if (ret) {
bch_err(c, "delete error (first) in test_delete: %i", ret); bch_err(c, "delete error (first) in test_delete: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -64,7 +64,7 @@ static int test_delete(struct bch_fs *c, u64 nr) ...@@ -64,7 +64,7 @@ static int test_delete(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(&trans, &iter, 0)); bch2_btree_delete_at(&trans, &iter, 0));
if (ret) { if (ret) {
bch_err(c, "delete error (second) in test_delete: %i", ret); bch_err(c, "delete error (second) in test_delete: %s", bch2_err_str(ret));
goto err; goto err;
} }
err: err:
...@@ -92,7 +92,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr) ...@@ -92,7 +92,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &k.k_i, 0)); bch2_trans_update(&trans, &iter, &k.k_i, 0));
if (ret) { if (ret) {
bch_err(c, "update error in test_delete_written: %i", ret); bch_err(c, "update error in test_delete_written: %s", bch2_err_str(ret));
goto err; goto err;
} }
...@@ -103,7 +103,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr) ...@@ -103,7 +103,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(&trans, &iter, 0)); bch2_btree_delete_at(&trans, &iter, 0));
if (ret) { if (ret) {
bch_err(c, "delete error in test_delete_written: %i", ret); bch_err(c, "delete error in test_delete_written: %s", bch2_err_str(ret));
goto err; goto err;
} }
err: err:
...@@ -136,7 +136,7 @@ static int test_iterate(struct bch_fs *c, u64 nr) ...@@ -136,7 +136,7 @@ static int test_iterate(struct bch_fs *c, u64 nr)
ret = bch2_btree_insert(c, BTREE_ID_xattrs, &k.k_i, ret = bch2_btree_insert(c, BTREE_ID_xattrs, &k.k_i,
NULL, NULL, 0); NULL, NULL, 0);
if (ret) { if (ret) {
bch_err(c, "insert error in test_iterate: %i", ret); bch_err(c, "insert error in test_iterate: %s", bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -192,7 +192,7 @@ static int test_iterate_extents(struct bch_fs *c, u64 nr) ...@@ -192,7 +192,7 @@ static int test_iterate_extents(struct bch_fs *c, u64 nr)
ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i, ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i,
NULL, NULL, 0); NULL, NULL, 0);
if (ret) { if (ret) {
bch_err(c, "insert error in test_iterate_extents: %i", ret); bch_err(c, "insert error in test_iterate_extents: %s", bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -247,7 +247,7 @@ static int test_iterate_slots(struct bch_fs *c, u64 nr) ...@@ -247,7 +247,7 @@ static int test_iterate_slots(struct bch_fs *c, u64 nr)
ret = bch2_btree_insert(c, BTREE_ID_xattrs, &k.k_i, ret = bch2_btree_insert(c, BTREE_ID_xattrs, &k.k_i,
NULL, NULL, 0); NULL, NULL, 0);
if (ret) { if (ret) {
bch_err(c, "insert error in test_iterate_slots: %i", ret); bch_err(c, "insert error in test_iterate_slots: %s", bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -313,7 +313,7 @@ static int test_iterate_slots_extents(struct bch_fs *c, u64 nr) ...@@ -313,7 +313,7 @@ static int test_iterate_slots_extents(struct bch_fs *c, u64 nr)
ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i, ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i,
NULL, NULL, 0); NULL, NULL, 0);
if (ret) { if (ret) {
bch_err(c, "insert error in test_iterate_slots_extents: %i", ret); bch_err(c, "insert error in test_iterate_slots_extents: %s", bch2_err_str(ret));
goto err; goto err;
} }
} }
...@@ -419,7 +419,7 @@ static int insert_test_extent(struct bch_fs *c, ...@@ -419,7 +419,7 @@ static int insert_test_extent(struct bch_fs *c,
ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i, ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i,
NULL, NULL, 0); NULL, NULL, 0);
if (ret) if (ret)
bch_err(c, "insert error in insert_test_extent: %i", ret); bch_err(c, "insert error in insert_test_extent: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -518,7 +518,7 @@ static int test_snapshots(struct bch_fs *c, u64 nr) ...@@ -518,7 +518,7 @@ static int test_snapshots(struct bch_fs *c, u64 nr)
ret = test_snapshot_filter(c, snapids[0], snapids[1]); ret = test_snapshot_filter(c, snapids[0], snapids[1]);
if (ret) { if (ret) {
bch_err(c, "err %i from test_snapshot_filter", ret); bch_err(c, "err from test_snapshot_filter: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -555,7 +555,7 @@ static int rand_insert(struct bch_fs *c, u64 nr) ...@@ -555,7 +555,7 @@ static int rand_insert(struct bch_fs *c, u64 nr)
ret = commit_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k.k_i)); __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k.k_i));
if (ret) { if (ret) {
bch_err(c, "error in rand_insert: %i", ret); bch_err(c, "error in rand_insert: %s", bch2_err_str(ret));
break; break;
} }
} }
...@@ -591,7 +591,7 @@ static int rand_insert_multi(struct bch_fs *c, u64 nr) ...@@ -591,7 +591,7 @@ static int rand_insert_multi(struct bch_fs *c, u64 nr)
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[6].k_i) ?: __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[6].k_i) ?:
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[7].k_i)); __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[7].k_i));
if (ret) { if (ret) {
bch_err(c, "error in rand_insert_multi: %i", ret); bch_err(c, "error in rand_insert_multi: %s", bch2_err_str(ret));
break; break;
} }
} }
...@@ -618,7 +618,7 @@ static int rand_lookup(struct bch_fs *c, u64 nr) ...@@ -618,7 +618,7 @@ static int rand_lookup(struct bch_fs *c, u64 nr)
k = bch2_btree_iter_peek(&iter); k = bch2_btree_iter_peek(&iter);
ret = bkey_err(k); ret = bkey_err(k);
if (ret) { if (ret) {
bch_err(c, "error in rand_lookup: %i", ret); bch_err(c, "error in rand_lookup: %s", bch2_err_str(ret));
break; break;
} }
} }
...@@ -641,7 +641,7 @@ static int rand_mixed_trans(struct btree_trans *trans, ...@@ -641,7 +641,7 @@ static int rand_mixed_trans(struct btree_trans *trans,
k = bch2_btree_iter_peek(iter); k = bch2_btree_iter_peek(iter);
ret = bkey_err(k); ret = bkey_err(k);
if (ret && ret != -EINTR) if (ret && ret != -EINTR)
bch_err(trans->c, "lookup error in rand_mixed: %i", ret); bch_err(trans->c, "lookup error in rand_mixed: %s", bch2_err_str(ret));
if (ret) if (ret)
return ret; return ret;
...@@ -671,7 +671,7 @@ static int rand_mixed(struct bch_fs *c, u64 nr) ...@@ -671,7 +671,7 @@ static int rand_mixed(struct bch_fs *c, u64 nr)
ret = commit_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
rand_mixed_trans(&trans, &iter, &cookie, i, rand)); rand_mixed_trans(&trans, &iter, &cookie, i, rand));
if (ret) { if (ret) {
bch_err(c, "update error in rand_mixed: %i", ret); bch_err(c, "update error in rand_mixed: %s", bch2_err_str(ret));
break; break;
} }
} }
...@@ -717,7 +717,7 @@ static int rand_delete(struct bch_fs *c, u64 nr) ...@@ -717,7 +717,7 @@ static int rand_delete(struct bch_fs *c, u64 nr)
ret = commit_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__do_delete(&trans, pos)); __do_delete(&trans, pos));
if (ret) { if (ret) {
bch_err(c, "error in rand_delete: %i", ret); bch_err(c, "error in rand_delete: %s", bch2_err_str(ret));
break; break;
} }
} }
...@@ -747,7 +747,7 @@ static int seq_insert(struct bch_fs *c, u64 nr) ...@@ -747,7 +747,7 @@ static int seq_insert(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &insert.k_i, 0)); bch2_trans_update(&trans, &iter, &insert.k_i, 0));
if (ret) { if (ret) {
bch_err(c, "error in seq_insert: %i", ret); bch_err(c, "error in seq_insert: %s", bch2_err_str(ret));
break; break;
} }
...@@ -798,7 +798,7 @@ static int seq_overwrite(struct bch_fs *c, u64 nr) ...@@ -798,7 +798,7 @@ static int seq_overwrite(struct bch_fs *c, u64 nr)
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &u.k_i, 0)); bch2_trans_update(&trans, &iter, &u.k_i, 0));
if (ret) { if (ret) {
bch_err(c, "error in seq_overwrite: %i", ret); bch_err(c, "error in seq_overwrite: %s", bch2_err_str(ret));
break; break;
} }
} }
...@@ -816,7 +816,7 @@ static int seq_delete(struct bch_fs *c, u64 nr) ...@@ -816,7 +816,7 @@ static int seq_delete(struct bch_fs *c, u64 nr)
SPOS(0, 0, U32_MAX), SPOS_MAX, SPOS(0, 0, U32_MAX), SPOS_MAX,
0, NULL); 0, NULL);
if (ret) if (ret)
bch_err(c, "error in seq_delete: %i", ret); bch_err(c, "error in seq_delete: %s", bch2_err_str(ret));
return ret; return ret;
} }
...@@ -853,7 +853,7 @@ static int btree_perf_test_thread(void *data) ...@@ -853,7 +853,7 @@ static int btree_perf_test_thread(void *data)
ret = j->fn(j->c, div64_u64(j->nr, j->nr_threads)); ret = j->fn(j->c, div64_u64(j->nr, j->nr_threads));
if (ret) { if (ret) {
bch_err(j->c, "%ps: error %i", j->fn, ret); bch_err(j->c, "%ps: error %s", j->fn, bch2_err_str(ret));
j->ret = ret; j->ret = ret;
} }
......
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