summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r--fs/bcachefs/fs-io.c78
1 files changed, 22 insertions, 56 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 18356cbe0794..da4976344d49 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -324,69 +324,36 @@ int bch2_extent_update(struct btree_trans *trans,
if (!may_allocate && allocating)
return -ENOSPC;
- bch2_trans_update(trans, BTREE_INSERT_ENTRY(extent_iter, k));
+ bch2_trans_update(trans, extent_iter, k);
new_i_size = min(k->k.p.offset << 9, new_i_size);
/* XXX: inode->i_size locking */
if (i_sectors_delta ||
new_i_size > inode->ei_inode.bi_size) {
- if (c->opts.new_inode_updates) {
- bch2_trans_unlock(trans);
- mutex_lock(&inode->ei_update_lock);
-
- if (!bch2_trans_relock(trans)) {
- mutex_unlock(&inode->ei_update_lock);
- return -EINTR;
- }
-
- inode_locked = true;
-
- if (!inode->ei_inode_update)
- inode->ei_inode_update =
- bch2_deferred_update_alloc(c,
- BTREE_ID_INODES, 64);
-
- inode_u = inode->ei_inode;
- inode_u.bi_sectors += i_sectors_delta;
-
- /* XXX: this is slightly suspect */
- if (!(inode_u.bi_flags & BCH_INODE_I_SIZE_DIRTY) &&
- new_i_size > inode_u.bi_size) {
- inode_u.bi_size = new_i_size;
- extended = true;
- }
-
- bch2_inode_pack(&inode_p, &inode_u);
- bch2_trans_update(trans,
- BTREE_INSERT_DEFERRED(inode->ei_inode_update,
- &inode_p.inode.k_i));
- } else {
- inode_iter = bch2_trans_get_iter(trans,
- BTREE_ID_INODES,
- POS(k->k.p.inode, 0),
- BTREE_ITER_SLOTS|BTREE_ITER_INTENT);
- if (IS_ERR(inode_iter))
- return PTR_ERR(inode_iter);
-
- ret = bch2_btree_iter_traverse(inode_iter);
- if (ret)
- goto err;
+ inode_iter = bch2_trans_get_iter(trans,
+ BTREE_ID_INODES,
+ POS(k->k.p.inode, 0),
+ BTREE_ITER_SLOTS|BTREE_ITER_INTENT);
+ if (IS_ERR(inode_iter))
+ return PTR_ERR(inode_iter);
- inode_u = inode->ei_inode;
- inode_u.bi_sectors += i_sectors_delta;
+ ret = bch2_btree_iter_traverse(inode_iter);
+ if (ret)
+ goto err;
- /* XXX: this is slightly suspect */
- if (!(inode_u.bi_flags & BCH_INODE_I_SIZE_DIRTY) &&
- new_i_size > inode_u.bi_size) {
- inode_u.bi_size = new_i_size;
- extended = true;
- }
+ inode_u = inode->ei_inode;
+ inode_u.bi_sectors += i_sectors_delta;
- bch2_inode_pack(&inode_p, &inode_u);
- bch2_trans_update(trans,
- BTREE_INSERT_ENTRY(inode_iter, &inode_p.inode.k_i));
+ /* XXX: this is slightly suspect */
+ if (!(inode_u.bi_flags & BCH_INODE_I_SIZE_DIRTY) &&
+ new_i_size > inode_u.bi_size) {
+ inode_u.bi_size = new_i_size;
+ extended = true;
}
+
+ bch2_inode_pack(&inode_p, &inode_u);
+ bch2_trans_update(trans, inode_iter, &inode_p.inode.k_i);
}
ret = bch2_trans_commit(trans, disk_res,
@@ -2793,9 +2760,8 @@ reassemble:
bkey_start_pos(&delete.k));
}
- bch2_trans_update(&trans, BTREE_INSERT_ENTRY(dst, &copy.k));
- bch2_trans_update(&trans,
- BTREE_INSERT_ENTRY(del ?: src, &delete));
+ bch2_trans_update(&trans, dst, &copy.k);
+ bch2_trans_update(&trans, del ?: src, &delete);
if (copy.k.k.size == k.k->size) {
/*