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

bcachefs: extent_squash() can no longer fail

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent e4ccb251
...@@ -1402,7 +1402,7 @@ bch2_extent_can_insert(struct btree_insert *trans, ...@@ -1402,7 +1402,7 @@ bch2_extent_can_insert(struct btree_insert *trans,
return BTREE_INSERT_OK; return BTREE_INSERT_OK;
} }
static enum btree_insert_ret static void
extent_squash(struct extent_insert_state *s, struct bkey_i *insert, extent_squash(struct extent_insert_state *s, struct bkey_i *insert,
struct bset_tree *t, struct bkey_packed *_k, struct bkey_s k, struct bset_tree *t, struct bkey_packed *_k, struct bkey_s k,
enum bch_extent_overlap overlap) enum bch_extent_overlap overlap)
...@@ -1496,8 +1496,6 @@ extent_squash(struct extent_insert_state *s, struct bkey_i *insert, ...@@ -1496,8 +1496,6 @@ extent_squash(struct extent_insert_state *s, struct bkey_i *insert,
break; break;
} }
} }
return BTREE_INSERT_OK;
} }
static enum btree_insert_ret static enum btree_insert_ret
...@@ -1542,7 +1540,7 @@ __bch2_insert_fixup_extent(struct extent_insert_state *s) ...@@ -1542,7 +1540,7 @@ __bch2_insert_fixup_extent(struct extent_insert_state *s)
_k->needs_whiteout = false; _k->needs_whiteout = false;
} }
ret = extent_squash(s, insert, t, _k, k, overlap); extent_squash(s, insert, t, _k, k, overlap);
} else { } else {
if (bkey_whiteout(k.k)) if (bkey_whiteout(k.k))
goto next; goto next;
...@@ -1575,21 +1573,18 @@ __bch2_insert_fixup_extent(struct extent_insert_state *s) ...@@ -1575,21 +1573,18 @@ __bch2_insert_fixup_extent(struct extent_insert_state *s)
discard.k.needs_whiteout = true; discard.k.needs_whiteout = true;
ret = extent_squash(s, insert, t, _k, k, overlap); extent_squash(s, insert, t, _k, k, overlap);
BUG_ON(ret != BTREE_INSERT_OK);
extent_bset_insert(c, iter, &discard); extent_bset_insert(c, iter, &discard);
} else { } else {
ret = extent_squash(s, insert, t, _k, k, overlap); extent_squash(s, insert, t, _k, k, overlap);
BUG_ON(ret != BTREE_INSERT_OK);
} }
next: next:
bch2_cut_front(s->committed, insert); bch2_cut_front(s->committed, insert);
bch2_btree_iter_set_pos_same_leaf(iter, s->committed); bch2_btree_iter_set_pos_same_leaf(iter, s->committed);
} }
if (ret != BTREE_INSERT_OK || if (overlap == BCH_EXTENT_OVERLAP_FRONT ||
overlap == BCH_EXTENT_OVERLAP_FRONT ||
overlap == BCH_EXTENT_OVERLAP_MIDDLE) overlap == BCH_EXTENT_OVERLAP_MIDDLE)
break; break;
} }
......
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