summaryrefslogtreecommitdiff
path: root/libbcachefs/alloc_foreground.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-09 02:32:57 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2022-10-09 02:33:05 -0400
commit8d6138baac3b4fcd715c34cf325ae11b01a4ca67 (patch)
tree7b2aeefc77ca3c31e2686ca4bceaad13cd0a24d9 /libbcachefs/alloc_foreground.c
parent99caca2c70f312c4a2504a7e7a9c92a91426d885 (diff)
Update bcachefs sources to cbccc6d869 bcachefs: Ratelimit ec error message
Diffstat (limited to 'libbcachefs/alloc_foreground.c')
-rw-r--r--libbcachefs/alloc_foreground.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libbcachefs/alloc_foreground.c b/libbcachefs/alloc_foreground.c
index ce365fec..e89999cf 100644
--- a/libbcachefs/alloc_foreground.c
+++ b/libbcachefs/alloc_foreground.c
@@ -688,7 +688,7 @@ static int bch2_bucket_alloc_set_trans(struct btree_trans *trans,
bch2_dev_alloc_list(c, stripe, devs_may_alloc);
unsigned dev;
struct bch_dev *ca;
- int ret = 0;
+ int ret = -BCH_ERR_insufficient_devices;
unsigned i;
BUG_ON(*nr_effective >= nr_replicas);
@@ -718,8 +718,8 @@ static int bch2_bucket_alloc_set_trans(struct btree_trans *trans,
bch2_dev_stripe_increment(ca, stripe);
percpu_ref_put(&ca->ref);
- ret = PTR_ERR_OR_ZERO(ob);
- if (ret) {
+ if (IS_ERR(ob)) {
+ ret = PTR_ERR(ob);
if (bch2_err_matches(ret, BCH_ERR_transaction_restart) || cl)
break;
continue;
@@ -728,15 +728,12 @@ static int bch2_bucket_alloc_set_trans(struct btree_trans *trans,
add_new_bucket(c, ptrs, devs_may_alloc,
nr_effective, have_cache, flags, ob);
- if (*nr_effective >= nr_replicas)
+ if (*nr_effective >= nr_replicas) {
+ ret = 0;
break;
+ }
}
- if (*nr_effective >= nr_replicas)
- ret = 0;
- else if (!ret)
- ret = -BCH_ERR_insufficient_devices;
-
return ret;
}