summaryrefslogtreecommitdiff
path: root/libbcachefs/ec.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-09 23:27:41 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2022-10-10 00:10:45 -0400
commit72add8822c47e5801d4ac6d42af8c5d9d7b4d3c9 (patch)
tree9e4c08aa14105b9d3c88116291b326352aec6065 /libbcachefs/ec.c
parent8d6138baac3b4fcd715c34cf325ae11b01a4ca67 (diff)
Update bcachefs sources to 47ffed9fad bcachefs: bch2_btree_delete_range_trans() now uses peek_upto()
Diffstat (limited to 'libbcachefs/ec.c')
-rw-r--r--libbcachefs/ec.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/libbcachefs/ec.c b/libbcachefs/ec.c
index f902da01..d3fa2d7a 100644
--- a/libbcachefs/ec.c
+++ b/libbcachefs/ec.c
@@ -1403,10 +1403,8 @@ static int __bch2_ec_stripe_head_reuse(struct bch_fs *c,
int ret;
idx = get_existing_stripe(c, h);
- if (idx < 0) {
- bch_err(c, "failed to find an existing stripe");
+ if (idx < 0)
return -BCH_ERR_ENOSPC_stripe_reuse;
- }
h->s->have_existing_stripe = true;
ret = get_stripe_key(c, idx, &h->s->existing_stripe);
@@ -1444,21 +1442,9 @@ static int __bch2_ec_stripe_head_reuse(struct bch_fs *c,
static int __bch2_ec_stripe_head_reserve(struct bch_fs *c,
struct ec_stripe_head *h)
{
- int ret;
-
- ret = bch2_disk_reservation_get(c, &h->s->res,
- h->blocksize,
- h->s->nr_parity, 0);
-
- if (ret) {
- /*
- * This means we need to wait for copygc to
- * empty out buckets from existing stripes:
- */
- bch_err_ratelimited(c, "failed to reserve stripe: %s", bch2_err_str(ret));
- }
-
- return ret;
+ return bch2_disk_reservation_get(c, &h->s->res,
+ h->blocksize,
+ h->s->nr_parity, 0);
}
struct ec_stripe_head *bch2_ec_stripe_head_get(struct bch_fs *c,
@@ -1500,8 +1486,10 @@ struct ec_stripe_head *bch2_ec_stripe_head_get(struct bch_fs *c,
ret = __bch2_ec_stripe_head_reserve(c, h);
if (ret && needs_stripe_new)
ret = __bch2_ec_stripe_head_reuse(c, h);
- if (ret)
+ if (ret) {
+ bch_err_ratelimited(c, "failed to get stripe: %s", bch2_err_str(ret));
goto err;
+ }
if (!h->s->allocated) {
ret = new_stripe_alloc_buckets(c, h, cl);