summaryrefslogtreecommitdiff
path: root/fs/bcachefs/ec.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-14 22:35:57 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:57 +0300
commit65d48e35250fe46a560dffa13876830336b152c9 (patch)
tree66141141933b02b33b6caa4f94118af4c782996a /fs/bcachefs/ec.c
parent872c0311675bdb73b29ee74c7f27afc82d4918e9 (diff)
downloadlinux-65d48e35250fe46a560dffa13876830336b152c9.tar.xz
bcachefs: Private error codes: ENOMEM
This adds private error codes for most (but not all) of our ENOMEM uses, which makes it easier to track down assorted allocation failures. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r--fs/bcachefs/ec.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 74cfd9edd680..af3a72acc67f 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -494,7 +494,7 @@ int bch2_ec_read_extent(struct bch_fs *c, struct bch_read_bio *rbio)
buf = kzalloc(sizeof(*buf), GFP_NOIO);
if (!buf)
- return -ENOMEM;
+ return -BCH_ERR_ENOMEM_ec_read_extent;
ret = get_stripe_key(c, rbio->pick.ec.idx, buf);
if (ret) {
@@ -559,7 +559,7 @@ static int __ec_stripe_mem_alloc(struct bch_fs *c, size_t idx, gfp_t gfp)
if (idx >= h->size) {
if (!init_heap(&n, max(1024UL, roundup_pow_of_two(idx + 1)), gfp))
- return -ENOMEM;
+ return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc;
mutex_lock(&c->ec_stripes_heap_lock);
if (n.size > h->size) {
@@ -573,11 +573,11 @@ static int __ec_stripe_mem_alloc(struct bch_fs *c, size_t idx, gfp_t gfp)
}
if (!genradix_ptr_alloc(&c->stripes, idx, gfp))
- return -ENOMEM;
+ return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc;
if (c->gc_pos.phase != GC_PHASE_NOT_RUNNING &&
!genradix_ptr_alloc(&c->gc_stripes, idx, gfp))
- return -ENOMEM;
+ return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc;
return 0;
}
@@ -1323,7 +1323,7 @@ static int ec_new_stripe_alloc(struct bch_fs *c, struct ec_stripe_head *h)
s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s)
- return -ENOMEM;
+ return -BCH_ERR_ENOMEM_ec_new_stripe_alloc;
mutex_init(&s->lock);
closure_init(&s->iodone, NULL);
@@ -1680,8 +1680,8 @@ struct ec_stripe_head *bch2_ec_stripe_head_get(struct btree_trans *trans,
return h;
if (!h->s) {
- if (ec_new_stripe_alloc(c, h)) {
- ret = -ENOMEM;
+ ret = ec_new_stripe_alloc(c, h);
+ if (ret) {
bch_err(c, "failed to allocate new stripe");
goto err;
}