Commit c515e3f0 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Kill bch2_extent_trim_atomic() usage

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 494dcc57
......@@ -1716,18 +1716,10 @@ int bch2_btree_delete_range_trans(struct btree_trans *trans, enum btree_id id,
*/
delete.k.p = iter.pos;
if (iter.flags & BTREE_ITER_IS_EXTENTS) {
unsigned max_sectors =
KEY_SIZE_MAX & (~0 << trans->c->block_bits);
/* create the biggest key we can */
bch2_key_resize(&delete.k, max_sectors);
bch2_cut_back(end, &delete);
ret = bch2_extent_trim_atomic(trans, &iter, &delete);
if (ret)
goto err;
}
if (iter.flags & BTREE_ITER_IS_EXTENTS)
bch2_key_resize(&delete.k,
bpos_min(end, k.k->p).offset -
iter.pos.offset);
ret = bch2_trans_update(trans, &iter, &delete, update_flags) ?:
bch2_trans_commit(trans, &disk_res, journal_seq,
......
......@@ -595,11 +595,11 @@ static int bch2_inode_delete_keys(struct btree_trans *trans,
int ret = 0;
/*
* We're never going to be deleting extents, no need to use an extent
* iterator:
* We're never going to be deleting partial extents, no need to use an
* extent iterator:
*/
bch2_trans_iter_init(trans, &iter, id, POS(inum.inum, 0),
BTREE_ITER_INTENT);
BTREE_ITER_INTENT|BTREE_ITER_NOT_EXTENTS);
while (1) {
bch2_trans_begin(trans);
......@@ -621,14 +621,6 @@ static int bch2_inode_delete_keys(struct btree_trans *trans,
bkey_init(&delete.k);
delete.k.p = iter.pos;
if (iter.flags & BTREE_ITER_IS_EXTENTS) {
bch2_key_resize(&delete.k, k.k->p.offset - iter.pos.offset);
ret = bch2_extent_trim_atomic(trans, &iter, &delete);
if (ret)
goto err;
}
ret = bch2_trans_update(trans, &iter, &delete, 0) ?:
bch2_trans_commit(trans, NULL, NULL,
BTREE_INSERT_NOFAIL);
......
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