diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-01-06 12:29:04 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:48 +0200 |
commit | c515e3f019fe0ab60ae6f5343d211f52b8a2c759 (patch) | |
tree | ab07882a1845d00aea65b64274e9041bf6c9dd24 | |
parent | bcachefs: Plumb saw_error through to btree_err() (diff) | |
download | linux-c515e3f019fe0ab60ae6f5343d211f52b8a2c759.tar.xz linux-c515e3f019fe0ab60ae6f5343d211f52b8a2c759.zip |
bcachefs: Kill bch2_extent_trim_atomic() usage
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/btree_update_leaf.c | 16 | ||||
-rw-r--r-- | fs/bcachefs/inode.c | 14 |
2 files changed, 7 insertions, 23 deletions
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c index d333d0e46d0d..3e57722007a9 100644 --- a/fs/bcachefs/btree_update_leaf.c +++ b/fs/bcachefs/btree_update_leaf.c @@ -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, diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index cf453edcb5ab..141cf21e2951 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -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); |