bcachefs: Ratelimit ec error message
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 9 Oct 2022 06:30:50 +0000 (02:30 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:42 +0000 (17:09 -0400)
We should fix this, but for now this makes this more usable.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/ec.c

index aa83011463828c871a5149e2ba6ddc9aeabd829d..2dcca5c7fcec4873a5c2918aa167be3383441c06 100644 (file)
@@ -1386,10 +1386,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);
@@ -1427,21 +1425,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(c, "failed to reserve stripe");
-       }
-
-       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,
@@ -1483,8 +1469,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);