diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-02-23 21:16:41 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:08:53 +0200 |
commit | dab9ef0d271648c24b867059855439ec48775fc4 (patch) | |
tree | ddf192029855fb6b9498f5318e169e563397652c /fs | |
parent | bcachefs: Extents may now cross btree node boundaries (diff) | |
download | linux-dab9ef0d271648c24b867059855439ec48775fc4.tar.xz linux-dab9ef0d271648c24b867059855439ec48775fc4.zip |
bcachefs: Add error message for some allocation failures
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/alloc_background.c | 5 | ||||
-rw-r--r-- | fs/bcachefs/btree_gc.c | 38 | ||||
-rw-r--r-- | fs/bcachefs/journal_reclaim.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/movinggc.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/rebalance.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/recovery.c | 13 |
6 files changed, 53 insertions, 15 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index aadd878b357d..eac82c9880ba 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -1387,8 +1387,11 @@ int bch2_dev_allocator_start(struct bch_dev *ca) p = kthread_create(bch2_allocator_thread, ca, "bch-alloc/%s", ca->name); - if (IS_ERR(p)) + if (IS_ERR(p)) { + bch_err(ca->fs, "error creating allocator thread: %li", + PTR_ERR(p)); return PTR_ERR(p); + } get_task_struct(p); rcu_assign_pointer(ca->alloc_thread, p); diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index f687cc3bfa94..426c932098da 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -115,8 +115,10 @@ static int bch2_gc_check_topology(struct bch_fs *c, } new = kmalloc(bkey_bytes(&cur.k->k), GFP_KERNEL); - if (!new) + if (!new) { + bch_err(c, "%s: error allocating new key", __func__); return -ENOMEM; + } bkey_copy(new, cur.k); @@ -235,8 +237,10 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id, } new = kmalloc(bkey_bytes(k->k), GFP_KERNEL); - if (!new) + if (!new) { + bch_err(c, "%s: error allocating new key", __func__); return -ENOMEM; + } bkey_reassemble(new, *k); @@ -302,8 +306,10 @@ static int bch2_gc_mark_key(struct bch_fs *c, enum btree_id btree_id, "superblock not marked as containing replicas (type %u)", k.k->type)) { ret = bch2_mark_bkey_replicas(c, k); - if (ret) - return ret; + if (ret) { + bch_err(c, "error marking bkey replicas: %i", ret); + goto err; + } } ret = bch2_check_fix_ptrs(c, btree_id, level, is_root, &k); @@ -321,6 +327,9 @@ static int bch2_gc_mark_key(struct bch_fs *c, enum btree_id btree_id, bch2_mark_key(c, k, 0, k.k->size, NULL, 0, flags); fsck_err: +err: + if (ret) + bch_err(c, "%s: ret %i", __func__, ret); return ret; } @@ -448,8 +457,10 @@ static int bch2_gc_btree_init_recurse(struct bch_fs *c, struct btree *b, ret = bch2_gc_mark_key(c, b->c.btree_id, b->c.level, false, k, &max_stale, true); - if (ret) + if (ret) { + bch_err(c, "%s: error %i from bch2_gc_mark_key", __func__, ret); break; + } if (b->c.level) { bch2_bkey_buf_reassemble(&cur, c, k); @@ -493,8 +504,11 @@ static int bch2_gc_btree_init_recurse(struct bch_fs *c, struct btree *b, continue; } - if (ret) + if (ret) { + bch_err(c, "%s: error %i getting btree node", + __func__, ret); break; + } ret = bch2_gc_btree_init_recurse(c, child, target_depth); @@ -551,6 +565,8 @@ static int bch2_gc_btree_init(struct bch_fs *c, fsck_err: six_unlock_read(&b->c.lock); + if (ret) + bch_err(c, "%s: ret %i", __func__, ret); return ret; } @@ -574,8 +590,10 @@ static int bch2_gc_btrees(struct bch_fs *c, bool initial) int ret = initial ? bch2_gc_btree_init(c, id) : bch2_gc_btree(c, id, initial); - if (ret) + if (ret) { + bch_err(c, "%s: ret %i", __func__, ret); return ret; + } } return 0; @@ -881,6 +899,8 @@ static int bch2_gc_done(struct bch_fs *c, #undef copy_stripe_field #undef copy_field fsck_err: + if (ret) + bch_err(c, "%s: ret %i", __func__, ret); return ret; } @@ -1601,8 +1621,10 @@ int bch2_gc_thread_start(struct bch_fs *c) BUG_ON(c->gc_thread); 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)); return PTR_ERR(p); + } get_task_struct(p); c->gc_thread = p; diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 1141b7d3a060..0a16343fb51a 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -691,8 +691,10 @@ int bch2_journal_reclaim_start(struct journal *j) p = kthread_create(bch2_journal_reclaim_thread, j, "bch-reclaim/%s", c->name); - if (IS_ERR(p)) + if (IS_ERR(p)) { + bch_err(c, "error creating journal reclaim thread: %li", PTR_ERR(p)); return PTR_ERR(p); + } get_task_struct(p); j->reclaim_thread = p; diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c index e2472c19beaf..b61bbc18a0aa 100644 --- a/fs/bcachefs/movinggc.c +++ b/fs/bcachefs/movinggc.c @@ -348,8 +348,10 @@ int bch2_copygc_start(struct bch_fs *c) return -ENOMEM; t = kthread_create(bch2_copygc_thread, c, "bch-copygc/%s", c->name); - if (IS_ERR(t)) + if (IS_ERR(t)) { + bch_err(c, "error creating copygc thread: %li", PTR_ERR(t)); return PTR_ERR(t); + } get_task_struct(t); diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c index 2263ee41c444..c75411af4622 100644 --- a/fs/bcachefs/rebalance.c +++ b/fs/bcachefs/rebalance.c @@ -315,8 +315,10 @@ int bch2_rebalance_start(struct bch_fs *c) return 0; p = kthread_create(bch2_rebalance_thread, c, "bch-rebalance/%s", c->name); - if (IS_ERR(p)) + if (IS_ERR(p)) { + bch_err(c, "error creating rebalance thread: %li", PTR_ERR(p)); return PTR_ERR(p); + } get_task_struct(p); rcu_assign_pointer(c->rebalance.thread, p); diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 54ac9cc470af..0aeaaadbf3f8 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -122,8 +122,11 @@ int bch2_journal_key_insert(struct bch_fs *c, enum btree_id id, }; new_keys.d = kvmalloc(sizeof(new_keys.d[0]) * new_keys.size, GFP_KERNEL); - if (!new_keys.d) + if (!new_keys.d) { + bch_err(c, "%s: error allocating new key array (size %zu)", + __func__, new_keys.size); return -ENOMEM; + } memcpy(new_keys.d, keys->d, sizeof(keys->d[0]) * keys->nr); kvfree(keys->d); @@ -145,8 +148,10 @@ int bch2_journal_key_delete(struct bch_fs *c, enum btree_id id, kmalloc(sizeof(struct bkey), GFP_KERNEL); int ret; - if (!whiteout) + if (!whiteout) { + bch_err(c, "%s: error allocating new key", __func__); return -ENOMEM; + } bkey_init(&whiteout->k); whiteout->k.p = pos; @@ -1330,8 +1335,10 @@ int bch2_fs_initialize(struct bch_fs *c) &lostfound, 0, 0, S_IFDIR|0700, 0, NULL, NULL)); - if (ret) + if (ret) { + bch_err(c, "error creating lost+found"); goto err; + } if (enabled_qtypes(c)) { ret = bch2_fs_quota_read(c); |