diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-20 20:49:25 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:04 +0300 |
commit | 1bb3c2a9747c404d23012088fbefb4499b884415 (patch) | |
tree | 450da8adf0cea75a7dda044f4c4b7c3d413c9da0 /fs/bcachefs/journal.c | |
parent | a83e108fc1964b8273c6f51cc62588ee774a5a48 (diff) | |
download | linux-1bb3c2a9747c404d23012088fbefb4499b884415.tar.xz |
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 <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal.c')
-rw-r--r-- | fs/bcachefs/journal.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 433c97844f36..64332c78a6bb 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -978,7 +978,7 @@ int bch2_set_nr_journal_buckets(struct bch_fs *c, struct bch_dev *ca, } if (ret) - bch_err(c, "%s: err %s", __func__, bch2_err_str(ret)); + bch_err_fn(c, ret); unlock: up_write(&c->state_lock); return ret; @@ -987,9 +987,12 @@ unlock: int bch2_dev_journal_alloc(struct bch_dev *ca) { unsigned nr; + int ret; - if (dynamic_fault("bcachefs:add:journal_alloc")) - return -BCH_ERR_ENOMEM_set_nr_journal_buckets; + if (dynamic_fault("bcachefs:add:journal_alloc")) { + ret = -BCH_ERR_ENOMEM_set_nr_journal_buckets; + goto err; + } /* 1/128th of the device by default: */ nr = ca->mi.nbuckets >> 7; @@ -1003,7 +1006,11 @@ int bch2_dev_journal_alloc(struct bch_dev *ca) min(1 << 13, (1 << 24) / ca->mi.bucket_size)); - return __bch2_set_nr_journal_buckets(ca, nr, true, NULL); + ret = __bch2_set_nr_journal_buckets(ca, nr, true, NULL); +err: + if (ret) + bch_err_fn(ca, ret); + return ret; } /* startup/shutdown: */ |