summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/ec.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-16 22:43:41 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 11:47:41 -0500
commitcf904c8d964fa477cdb83445a03d05e9eda5d65c (patch)
tree84e344c4722547763920f511a318d07f95df57de /fs/bcachefs/ec.c
parente06af20719a439730a588155e3b28d327a57d951 (diff)
downloadlinux-cf904c8d964fa477cdb83445a03d05e9eda5d65c.tar.gz
linux-cf904c8d964fa477cdb83445a03d05e9eda5d65c.tar.bz2
linux-cf904c8d964fa477cdb83445a03d05e9eda5d65c.zip
bcachefs: bch_err_(fn|msg) check if should print
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r--fs/bcachefs/ec.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 76163c2ea3b3..6cbc1d8a3ab5 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -791,28 +791,22 @@ static void ec_stripe_delete_work(struct work_struct *work)
{
struct bch_fs *c =
container_of(work, struct bch_fs, ec_stripe_delete_work);
- struct btree_trans *trans = bch2_trans_get(c);
- int ret;
- u64 idx;
while (1) {
mutex_lock(&c->ec_stripes_heap_lock);
- idx = stripe_idx_to_delete(c);
+ u64 idx = stripe_idx_to_delete(c);
mutex_unlock(&c->ec_stripes_heap_lock);
if (!idx)
break;
- ret = commit_do(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
- ec_stripe_delete(trans, idx));
- if (ret) {
- bch_err_fn(c, ret);
+ int ret = bch2_trans_do(c, NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
+ ec_stripe_delete(trans, idx));
+ bch_err_fn(c, ret);
+ if (ret)
break;
- }
}
- bch2_trans_put(trans);
-
bch2_write_ref_put(c, BCH_WRITE_REF_stripe_delete);
}
@@ -1126,16 +1120,15 @@ static void ec_stripe_create(struct ec_stripe_new *s)
ec_stripe_key_update(trans,
bkey_i_to_stripe(&s->new_stripe.key),
!s->have_existing_stripe));
+ bch_err_msg(c, ret, "creating stripe key");
if (ret) {
- bch_err(c, "error creating stripe: error creating stripe key");
goto err;
}
ret = ec_stripe_update_extents(c, &s->new_stripe);
- if (ret) {
- bch_err_msg(c, ret, "creating stripe: error updating pointers");
+ bch_err_msg(c, ret, "error updating extents");
+ if (ret)
goto err;
- }
err:
bch2_disk_reservation_put(c, &s->res);
@@ -1865,7 +1858,6 @@ int bch2_stripes_read(struct bch_fs *c)
bch2_stripes_heap_insert(c, m, k.k->p.offset);
0;
})));
-
bch_err_fn(c, ret);
return ret;
}