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

bcachefs: Dont't call bch2_trans_begin_updates() in bch2_extent_update()

Prep work for reflink - for reflink, we're going to be using
bch2_extent_update() with other updates in the same transaction.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 8627f674
......@@ -276,16 +276,16 @@ static int sum_sector_overwrites(struct btree_trans *trans,
return 0;
}
static int bch2_extent_update(struct btree_trans *trans,
struct bch_inode_info *inode,
struct disk_reservation *disk_res,
struct quota_res *quota_res,
struct btree_iter *extent_iter,
struct bkey_i *k,
u64 new_i_size,
bool may_allocate,
bool direct,
s64 *total_delta)
int bch2_extent_update(struct btree_trans *trans,
struct bch_inode_info *inode,
struct disk_reservation *disk_res,
struct quota_res *quota_res,
struct btree_iter *extent_iter,
struct bkey_i *k,
u64 new_i_size,
bool may_allocate,
bool direct,
s64 *total_delta)
{
struct bch_fs *c = trans->c;
struct btree_iter *inode_iter = NULL;
......@@ -297,8 +297,6 @@ static int bch2_extent_update(struct btree_trans *trans,
s64 i_sectors_delta;
int ret;
bch2_trans_begin_updates(trans);
ret = bch2_btree_iter_traverse(extent_iter);
if (ret)
return ret;
......@@ -447,6 +445,8 @@ static int bchfs_write_index_update(struct bch_write_op *wop)
bkey_copy(&tmp.k, bch2_keylist_front(keys));
bch2_trans_begin_updates(&trans);
ret = bch2_extent_update(&trans, inode,
&wop->res, quota_res,
iter, &tmp.k,
......@@ -2198,6 +2198,8 @@ static int __bch2_fpunch(struct bch_fs *c, struct bch_inode_info *inode,
bch2_key_resize(&delete.k, max_sectors);
bch2_cut_back(end, &delete.k);
bch2_trans_begin_updates(&trans);
ret = bch2_extent_update(&trans, inode,
&disk_res, NULL, iter, &delete,
0, true, true, NULL);
......@@ -2546,6 +2548,8 @@ static long bch2_fcollapse(struct bch_inode_info *inode,
BCH_DISK_RESERVATION_NOFAIL);
BUG_ON(ret);
bch2_trans_begin_updates(&trans);
ret = bch2_extent_update(&trans, inode,
&disk_res, NULL,
dst, &copy.k,
......@@ -2689,6 +2693,8 @@ static long bch2_fallocate(struct bch_inode_info *inode, int mode,
reservation.v.nr_replicas = disk_res.nr_replicas;
}
bch2_trans_begin_updates(&trans);
ret = bch2_extent_update(&trans, inode,
&disk_res, &quota_res,
iter, &reservation.k_i,
......
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