Commit bbfcb451 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix bch2_extent_can_insert() call

It was being skipped when hole punching, leading to problems when
splitting compressed extents.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 2e8f9d23
...@@ -806,13 +806,13 @@ static int extent_update_to_keys(struct btree_trans *trans, ...@@ -806,13 +806,13 @@ static int extent_update_to_keys(struct btree_trans *trans,
{ {
int ret; int ret;
if (bkey_deleted(&n.k->k))
return 0;
ret = bch2_extent_can_insert(trans, n.iter, n.k); ret = bch2_extent_can_insert(trans, n.iter, n.k);
if (ret) if (ret)
return ret; return ret;
if (bkey_deleted(&n.k->k))
return 0;
n.iter = bch2_trans_get_iter(trans, n.iter->btree_id, n.k->k.p, n.iter = bch2_trans_get_iter(trans, n.iter->btree_id, n.k->k.p,
BTREE_ITER_INTENT| BTREE_ITER_INTENT|
BTREE_ITER_NOT_EXTENTS); BTREE_ITER_NOT_EXTENTS);
......
...@@ -1270,14 +1270,15 @@ int bch2_mark_update(struct btree_trans *trans, ...@@ -1270,14 +1270,15 @@ int bch2_mark_update(struct btree_trans *trans,
static noinline __cold static noinline __cold
void fs_usage_apply_warn(struct btree_trans *trans, void fs_usage_apply_warn(struct btree_trans *trans,
unsigned disk_res_sectors) unsigned disk_res_sectors,
s64 should_not_have_added)
{ {
struct bch_fs *c = trans->c; struct bch_fs *c = trans->c;
struct btree_insert_entry *i; struct btree_insert_entry *i;
char buf[200]; char buf[200];
bch_err(c, "disk usage increased more than %u sectors reserved", bch_err(c, "disk usage increased %lli more than %u sectors reserved",
disk_res_sectors); should_not_have_added, disk_res_sectors);
trans_for_each_update(trans, i) { trans_for_each_update(trans, i) {
pr_err("while inserting"); pr_err("while inserting");
...@@ -1309,6 +1310,7 @@ void fs_usage_apply_warn(struct btree_trans *trans, ...@@ -1309,6 +1310,7 @@ void fs_usage_apply_warn(struct btree_trans *trans,
} }
} }
} }
__WARN();
} }
void bch2_trans_fs_usage_apply(struct btree_trans *trans, void bch2_trans_fs_usage_apply(struct btree_trans *trans,
...@@ -1367,7 +1369,7 @@ void bch2_trans_fs_usage_apply(struct btree_trans *trans, ...@@ -1367,7 +1369,7 @@ void bch2_trans_fs_usage_apply(struct btree_trans *trans,
preempt_enable(); preempt_enable();
if (unlikely(warn) && !xchg(&warned_disk_usage, 1)) if (unlikely(warn) && !xchg(&warned_disk_usage, 1))
fs_usage_apply_warn(trans, disk_res_sectors); fs_usage_apply_warn(trans, disk_res_sectors, should_not_have_added);
} }
/* trans_mark: */ /* trans_mark: */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment