summaryrefslogtreecommitdiff
path: root/libbcachefs/ec.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-04 22:47:04 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-03-04 23:33:25 -0500
commitb0c9ad15f4e5cee60973a8f5f6dc49acfeec9755 (patch)
treeec326791b8b4cc3178150361a7b142b716334780 /libbcachefs/ec.c
parent9fc4b5d675cd6dc0b2503abe95b1c761d8d05abe (diff)
Update bcachefs sources to 171da96d76 bcachefs: Drop some anonymous structs, unions
Diffstat (limited to 'libbcachefs/ec.c')
-rw-r--r--libbcachefs/ec.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/libbcachefs/ec.c b/libbcachefs/ec.c
index f7598883..c0342e60 100644
--- a/libbcachefs/ec.c
+++ b/libbcachefs/ec.c
@@ -869,12 +869,10 @@ static int ec_stripe_key_update(struct btree_trans *trans,
for (i = 0; i < new->v.nr_blocks; i++) {
unsigned v = stripe_blockcount_get(old, i);
- if (!v)
- continue;
-
- BUG_ON(old->ptrs[i].dev != new->v.ptrs[i].dev ||
- old->ptrs[i].gen != new->v.ptrs[i].gen ||
- old->ptrs[i].offset != new->v.ptrs[i].offset);
+ BUG_ON(v &&
+ (old->ptrs[i].dev != new->v.ptrs[i].dev ||
+ old->ptrs[i].gen != new->v.ptrs[i].gen ||
+ old->ptrs[i].offset != new->v.ptrs[i].offset));
stripe_blockcount_set(&new->v, i, v);
}
@@ -1594,8 +1592,6 @@ static int __bch2_ec_stripe_head_reuse(struct btree_trans *trans, struct ec_stri
bkey_copy(&h->s->new_stripe.key.k_i, &h->s->existing_stripe.key.k_i);
h->s->have_existing_stripe = true;
- pr_info("reused %llu", h->s->idx);
-
return 0;
}
@@ -1687,9 +1683,9 @@ struct ec_stripe_head *bch2_ec_stripe_head_get(struct btree_trans *trans,
if (h->s->allocated)
goto allocated;
- if (h->s->idx)
+ if (h->s->have_existing_stripe)
goto alloc_existing;
-#if 0
+
/* First, try to allocate a full stripe: */
ret = new_stripe_alloc_buckets(trans, h, RESERVE_stripe, NULL) ?:
__bch2_ec_stripe_head_reserve(trans, h);
@@ -1699,24 +1695,17 @@ struct ec_stripe_head *bch2_ec_stripe_head_get(struct btree_trans *trans,
bch2_err_matches(ret, ENOMEM))
goto err;
- if (ret == -BCH_ERR_open_buckets_empty) {
- /* don't want to reuse in this case */
- }
-#endif
/*
* Not enough buckets available for a full stripe: we must reuse an
* existing stripe:
*/
while (1) {
ret = __bch2_ec_stripe_head_reuse(trans, h);
- if (ret)
- ret = __bch2_ec_stripe_head_reserve(trans, h);
if (!ret)
break;
- pr_info("err %s", bch2_err_str(ret));
if (ret == -BCH_ERR_ENOSPC_stripe_reuse && cl)
ret = -BCH_ERR_stripe_alloc_blocked;
- if (waiting || !cl)
+ if (waiting || !cl || ret != -BCH_ERR_stripe_alloc_blocked)
goto err;
/* XXX freelist_wait? */