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

bcachefs: Rename __bch2_trans_do() -> commit_do()

Better/more descriptive naming, and prep for adding
nested_lockrestart_do() and nested_commit_do().
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 80b3bf33
...@@ -787,7 +787,7 @@ int bch2_check_alloc_info(struct bch_fs *c) ...@@ -787,7 +787,7 @@ int bch2_check_alloc_info(struct bch_fs *c)
bch2_trans_iter_init(&trans, &freespace_iter, BTREE_ID_freespace, POS_MIN, bch2_trans_iter_init(&trans, &freespace_iter, BTREE_ID_freespace, POS_MIN,
BTREE_ITER_PREFETCH); BTREE_ITER_PREFETCH);
while (1) { while (1) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bch2_check_alloc_key(&trans, &iter, bch2_check_alloc_key(&trans, &iter,
...@@ -808,7 +808,7 @@ int bch2_check_alloc_info(struct bch_fs *c) ...@@ -808,7 +808,7 @@ int bch2_check_alloc_info(struct bch_fs *c)
bch2_trans_iter_init(&trans, &iter, BTREE_ID_need_discard, POS_MIN, bch2_trans_iter_init(&trans, &iter, BTREE_ID_need_discard, POS_MIN,
BTREE_ITER_PREFETCH); BTREE_ITER_PREFETCH);
while (1) { while (1) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bch2_check_discard_freespace_key(&trans, &iter)); bch2_check_discard_freespace_key(&trans, &iter));
...@@ -825,7 +825,7 @@ int bch2_check_alloc_info(struct bch_fs *c) ...@@ -825,7 +825,7 @@ int bch2_check_alloc_info(struct bch_fs *c)
bch2_trans_iter_init(&trans, &iter, BTREE_ID_freespace, POS_MIN, bch2_trans_iter_init(&trans, &iter, BTREE_ID_freespace, POS_MIN,
BTREE_ITER_PREFETCH); BTREE_ITER_PREFETCH);
while (1) { while (1) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bch2_check_discard_freespace_key(&trans, &iter)); bch2_check_discard_freespace_key(&trans, &iter));
...@@ -930,7 +930,7 @@ int bch2_check_alloc_to_lru_refs(struct bch_fs *c) ...@@ -930,7 +930,7 @@ int bch2_check_alloc_to_lru_refs(struct bch_fs *c)
for_each_btree_key(&trans, iter, BTREE_ID_alloc, POS_MIN, for_each_btree_key(&trans, iter, BTREE_ID_alloc, POS_MIN,
BTREE_ITER_PREFETCH, k, ret) { BTREE_ITER_PREFETCH, k, ret) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bch2_check_alloc_to_lru_ref(&trans, &iter)); bch2_check_alloc_to_lru_ref(&trans, &iter));
...@@ -1060,7 +1060,7 @@ static void bch2_do_discards_work(struct work_struct *work) ...@@ -1060,7 +1060,7 @@ static void bch2_do_discards_work(struct work_struct *work)
continue; continue;
} }
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_USE_RESERVE| BTREE_INSERT_USE_RESERVE|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
bch2_clear_need_discard(&trans, k.k->p, ca, &discard_done)); bch2_clear_need_discard(&trans, k.k->p, ca, &discard_done));
...@@ -1198,7 +1198,7 @@ static void bch2_do_invalidates_work(struct work_struct *work) ...@@ -1198,7 +1198,7 @@ static void bch2_do_invalidates_work(struct work_struct *work)
should_invalidate_buckets(ca, bch2_dev_usage_read(ca)); should_invalidate_buckets(ca, bch2_dev_usage_read(ca));
while (nr_to_invalidate-- >= 0) { while (nr_to_invalidate-- >= 0) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_USE_RESERVE| BTREE_INSERT_USE_RESERVE|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
invalidate_one_bucket(&trans, ca, &bucket, invalidate_one_bucket(&trans, ca, &bucket,
...@@ -1254,7 +1254,7 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca) ...@@ -1254,7 +1254,7 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca)
if (iter.pos.offset >= ca->mi.nbuckets) if (iter.pos.offset >= ca->mi.nbuckets)
break; break;
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bucket_freespace_init(&trans, &iter)); bucket_freespace_init(&trans, &iter));
if (ret) if (ret)
......
...@@ -799,7 +799,7 @@ static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id, ...@@ -799,7 +799,7 @@ static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id,
atomic64_set(&c->key_version, k->k->version.lo); atomic64_set(&c->key_version, k->k->version.lo);
} }
ret = __bch2_trans_do(trans, NULL, NULL, 0, ret = commit_do(trans, NULL, NULL, 0,
bch2_mark_key(trans, old, *k, flags)); bch2_mark_key(trans, old, *k, flags));
fsck_err: fsck_err:
err: err:
...@@ -1435,7 +1435,7 @@ static int bch2_gc_alloc_done(struct bch_fs *c, bool metadata_only) ...@@ -1435,7 +1435,7 @@ static int bch2_gc_alloc_done(struct bch_fs *c, bool metadata_only)
if (bkey_cmp(iter.pos, POS(ca->dev_idx, ca->mi.nbuckets)) >= 0) if (bkey_cmp(iter.pos, POS(ca->dev_idx, ca->mi.nbuckets)) >= 0)
break; break;
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bch2_alloc_write_key(&trans, &iter, bch2_alloc_write_key(&trans, &iter,
metadata_only)); metadata_only));
...@@ -1589,7 +1589,7 @@ static int bch2_gc_reflink_done(struct bch_fs *c, bool metadata_only) ...@@ -1589,7 +1589,7 @@ static int bch2_gc_reflink_done(struct bch_fs *c, bool metadata_only)
else else
*bkey_refcount(new) = cpu_to_le64(r->refcount); *bkey_refcount(new) = cpu_to_le64(r->refcount);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__bch2_btree_insert(&trans, BTREE_ID_reflink, new)); __bch2_btree_insert(&trans, BTREE_ID_reflink, new));
kfree(new); kfree(new);
...@@ -1702,7 +1702,7 @@ static int bch2_gc_stripes_done(struct bch_fs *c, bool metadata_only) ...@@ -1702,7 +1702,7 @@ static int bch2_gc_stripes_done(struct bch_fs *c, bool metadata_only)
for (i = 0; i < new->v.nr_blocks; i++) for (i = 0; i < new->v.nr_blocks; i++)
stripe_blockcount_set(&new->v, i, m ? m->block_sectors[i] : 0); stripe_blockcount_set(&new->v, i, m ? m->block_sectors[i] : 0);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__bch2_btree_insert(&trans, BTREE_ID_reflink, &new->k_i)); __bch2_btree_insert(&trans, BTREE_ID_reflink, &new->k_i));
kfree(new); kfree(new);
} }
...@@ -2009,7 +2009,7 @@ int bch2_gc_gens(struct bch_fs *c) ...@@ -2009,7 +2009,7 @@ int bch2_gc_gens(struct bch_fs *c)
for_each_btree_key(&trans, iter, BTREE_ID_alloc, POS_MIN, for_each_btree_key(&trans, iter, BTREE_ID_alloc, POS_MIN,
BTREE_ITER_PREFETCH, k, ret) { BTREE_ITER_PREFETCH, k, ret) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
bch2_alloc_write_oldest_gen(&trans, &iter)); bch2_alloc_write_oldest_gen(&trans, &iter));
if (ret) { if (ret) {
......
...@@ -118,7 +118,7 @@ static inline int bch2_trans_commit(struct btree_trans *trans, ...@@ -118,7 +118,7 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
_ret; \ _ret; \
}) })
#define __bch2_trans_do(_trans, _disk_res, _journal_seq, _flags, _do) \ #define commit_do(_trans, _disk_res, _journal_seq, _flags, _do) \
lockrestart_do(_trans, _do ?: bch2_trans_commit(_trans, (_disk_res),\ lockrestart_do(_trans, _do ?: bch2_trans_commit(_trans, (_disk_res),\
(_journal_seq), (_flags))) (_journal_seq), (_flags)))
...@@ -128,8 +128,7 @@ static inline int bch2_trans_commit(struct btree_trans *trans, ...@@ -128,8 +128,7 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
int _ret; \ int _ret; \
\ \
bch2_trans_init(&trans, (_c), 0, 0); \ bch2_trans_init(&trans, (_c), 0, 0); \
_ret = __bch2_trans_do(&trans, _disk_res, _journal_seq, _flags, \ _ret = commit_do(&trans, _disk_res, _journal_seq, _flags, _do); \
_do); \
bch2_trans_exit(&trans); \ bch2_trans_exit(&trans); \
\ \
_ret; \ _ret; \
......
...@@ -599,7 +599,7 @@ static void btree_update_nodes_written(struct btree_update *as) ...@@ -599,7 +599,7 @@ static void btree_update_nodes_written(struct btree_update *as)
* which may require allocations as well. * which may require allocations as well.
*/ */
bch2_trans_init(&trans, c, 0, 512); bch2_trans_init(&trans, c, 0, 512);
ret = __bch2_trans_do(&trans, &as->disk_res, &journal_seq, ret = commit_do(&trans, &as->disk_res, &journal_seq,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_NOCHECK_RW| BTREE_INSERT_NOCHECK_RW|
BTREE_INSERT_JOURNAL_RECLAIM| BTREE_INSERT_JOURNAL_RECLAIM|
......
...@@ -1853,7 +1853,7 @@ int bch2_trans_mark_metadata_bucket(struct btree_trans *trans, ...@@ -1853,7 +1853,7 @@ int bch2_trans_mark_metadata_bucket(struct btree_trans *trans,
enum bch_data_type type, enum bch_data_type type,
unsigned sectors) unsigned sectors)
{ {
return __bch2_trans_do(trans, NULL, NULL, 0, return commit_do(trans, NULL, NULL, 0,
__bch2_trans_mark_metadata_bucket(trans, ca, b, type, sectors)); __bch2_trans_mark_metadata_bucket(trans, ca, b, type, sectors));
} }
......
...@@ -443,7 +443,7 @@ static int __bch2_link(struct bch_fs *c, ...@@ -443,7 +443,7 @@ static int __bch2_link(struct bch_fs *c,
mutex_lock(&inode->ei_update_lock); mutex_lock(&inode->ei_update_lock);
bch2_trans_init(&trans, c, 4, 1024); bch2_trans_init(&trans, c, 4, 1024);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_link_trans(&trans, bch2_link_trans(&trans,
inode_inum(dir), &dir_u, inode_inum(dir), &dir_u,
inode_inum(inode), &inode_u, inode_inum(inode), &inode_u,
...@@ -492,7 +492,7 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry, ...@@ -492,7 +492,7 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry,
bch2_lock_inodes(INODE_UPDATE_LOCK, dir, inode); bch2_lock_inodes(INODE_UPDATE_LOCK, dir, inode);
bch2_trans_init(&trans, c, 4, 1024); bch2_trans_init(&trans, c, 4, 1024);
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
bch2_unlink_trans(&trans, bch2_unlink_trans(&trans,
inode_inum(dir), &dir_u, inode_inum(dir), &dir_u,
...@@ -614,7 +614,7 @@ static int bch2_rename2(struct mnt_idmap *idmap, ...@@ -614,7 +614,7 @@ static int bch2_rename2(struct mnt_idmap *idmap,
goto err; goto err;
} }
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_rename_trans(&trans, bch2_rename_trans(&trans,
inode_inum(src_dir), &src_dir_u, inode_inum(src_dir), &src_dir_u,
inode_inum(dst_dir), &dst_dir_u, inode_inum(dst_dir), &dst_dir_u,
......
...@@ -220,7 +220,7 @@ static int write_inode(struct btree_trans *trans, ...@@ -220,7 +220,7 @@ static int write_inode(struct btree_trans *trans,
struct bch_inode_unpacked *inode, struct bch_inode_unpacked *inode,
u32 snapshot) u32 snapshot)
{ {
int ret = __bch2_trans_do(trans, NULL, NULL, int ret = commit_do(trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
__write_inode(trans, inode, snapshot)); __write_inode(trans, inode, snapshot));
...@@ -434,7 +434,7 @@ static int reattach_inode(struct btree_trans *trans, ...@@ -434,7 +434,7 @@ static int reattach_inode(struct btree_trans *trans,
struct bch_inode_unpacked *inode, struct bch_inode_unpacked *inode,
u32 inode_snapshot) u32 inode_snapshot)
{ {
int ret = __bch2_trans_do(trans, NULL, NULL, int ret = commit_do(trans, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
__reattach_inode(trans, inode, inode_snapshot)); __reattach_inode(trans, inode, inode_snapshot));
...@@ -940,7 +940,7 @@ static int check_inodes(struct bch_fs *c, bool full) ...@@ -940,7 +940,7 @@ static int check_inodes(struct bch_fs *c, bool full)
BTREE_ITER_ALL_SNAPSHOTS); BTREE_ITER_ALL_SNAPSHOTS);
do { do {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
check_inode(&trans, &iter, &prev, full)); check_inode(&trans, &iter, &prev, full));
...@@ -1002,7 +1002,7 @@ static int check_subvols(struct bch_fs *c) ...@@ -1002,7 +1002,7 @@ static int check_subvols(struct bch_fs *c)
BTREE_ITER_PREFETCH); BTREE_ITER_PREFETCH);
do { do {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
check_subvol(&trans, &iter)); check_subvol(&trans, &iter));
...@@ -1306,7 +1306,7 @@ static int check_extents(struct bch_fs *c) ...@@ -1306,7 +1306,7 @@ static int check_extents(struct bch_fs *c)
BTREE_ITER_ALL_SNAPSHOTS); BTREE_ITER_ALL_SNAPSHOTS);
do { do {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
check_extent(&trans, &iter, &w, &s)); check_extent(&trans, &iter, &w, &s));
...@@ -1687,7 +1687,7 @@ static int check_dirents(struct bch_fs *c) ...@@ -1687,7 +1687,7 @@ static int check_dirents(struct bch_fs *c)
BTREE_ITER_ALL_SNAPSHOTS); BTREE_ITER_ALL_SNAPSHOTS);
do { do {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
check_dirent(&trans, &iter, &hash_info, check_dirent(&trans, &iter, &hash_info,
...@@ -1774,7 +1774,7 @@ static int check_xattrs(struct bch_fs *c) ...@@ -1774,7 +1774,7 @@ static int check_xattrs(struct bch_fs *c)
BTREE_ITER_ALL_SNAPSHOTS); BTREE_ITER_ALL_SNAPSHOTS);
do { do {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
check_xattr(&trans, &iter, &hash_info, check_xattr(&trans, &iter, &hash_info,
...@@ -1814,7 +1814,7 @@ static int check_root_trans(struct btree_trans *trans) ...@@ -1814,7 +1814,7 @@ static int check_root_trans(struct btree_trans *trans)
root_subvol.v.flags = 0; root_subvol.v.flags = 0;
root_subvol.v.snapshot = cpu_to_le32(snapshot); root_subvol.v.snapshot = cpu_to_le32(snapshot);
root_subvol.v.inode = cpu_to_le64(inum); root_subvol.v.inode = cpu_to_le64(inum);
ret = __bch2_trans_do(trans, NULL, NULL, ret = commit_do(trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
__bch2_btree_insert(trans, BTREE_ID_subvolumes, &root_subvol.k_i)); __bch2_btree_insert(trans, BTREE_ID_subvolumes, &root_subvol.k_i));
...@@ -1977,7 +1977,7 @@ static int check_path(struct btree_trans *trans, ...@@ -1977,7 +1977,7 @@ static int check_path(struct btree_trans *trans,
if (!fsck_err(c, "directory structure loop")) if (!fsck_err(c, "directory structure loop"))
return 0; return 0;
ret = __bch2_trans_do(trans, NULL, NULL, ret = commit_do(trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
remove_backpointer(trans, inode)); remove_backpointer(trans, inode));
...@@ -2366,7 +2366,7 @@ static int fix_reflink_p(struct bch_fs *c) ...@@ -2366,7 +2366,7 @@ static int fix_reflink_p(struct bch_fs *c)
BTREE_ITER_PREFETCH| BTREE_ITER_PREFETCH|
BTREE_ITER_ALL_SNAPSHOTS, k, ret) { BTREE_ITER_ALL_SNAPSHOTS, k, ret) {
if (k.k->type == KEY_TYPE_reflink_p) { if (k.k->type == KEY_TYPE_reflink_p) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
fix_reflink_p_key(&trans, &iter)); fix_reflink_p_key(&trans, &iter));
......
...@@ -204,7 +204,7 @@ int bch2_check_lrus(struct bch_fs *c) ...@@ -204,7 +204,7 @@ int bch2_check_lrus(struct bch_fs *c)
for_each_btree_key(&trans, iter, BTREE_ID_lru, POS_MIN, for_each_btree_key(&trans, iter, BTREE_ID_lru, POS_MIN,
BTREE_ITER_PREFETCH, k, ret) { BTREE_ITER_PREFETCH, k, ret) {
ret = __bch2_trans_do(&trans, NULL, NULL, ret = commit_do(&trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW, BTREE_INSERT_LAZY_RW,
bch2_check_lru_key(&trans, &iter)); bch2_check_lru_key(&trans, &iter));
......
...@@ -605,7 +605,7 @@ static int bch2_snapshot_delete_keys_btree(struct btree_trans *trans, ...@@ -605,7 +605,7 @@ static int bch2_snapshot_delete_keys_btree(struct btree_trans *trans,
bch2_btree_key_cache_flush(trans, btree_id, iter.pos)) bch2_btree_key_cache_flush(trans, btree_id, iter.pos))
continue; continue;
ret = __bch2_trans_do(trans, NULL, NULL, ret = commit_do(trans, NULL, NULL,
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(trans, &iter, bch2_btree_delete_at(trans, &iter,
...@@ -664,7 +664,7 @@ static void bch2_delete_dead_snapshots_work(struct work_struct *work) ...@@ -664,7 +664,7 @@ static void bch2_delete_dead_snapshots_work(struct work_struct *work)
if (ret) if (ret)
continue; continue;
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_snapshot_node_set_deleted(&trans, iter.pos.offset)); bch2_snapshot_node_set_deleted(&trans, iter.pos.offset));
if (ret) { if (ret) {
bch_err(c, "error deleting snapshot %llu: %i", iter.pos.offset, ret); bch_err(c, "error deleting snapshot %llu: %i", iter.pos.offset, ret);
...@@ -713,7 +713,7 @@ static void bch2_delete_dead_snapshots_work(struct work_struct *work) ...@@ -713,7 +713,7 @@ static void bch2_delete_dead_snapshots_work(struct work_struct *work)
} }
for (i = 0; i < deleted.nr; i++) { for (i = 0; i < deleted.nr; i++) {
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_snapshot_node_delete(&trans, deleted.data[i])); bch2_snapshot_node_delete(&trans, deleted.data[i]));
if (ret) { if (ret) {
bch_err(c, "error deleting snapshot %u: %i", bch_err(c, "error deleting snapshot %u: %i",
......
...@@ -42,7 +42,7 @@ static int test_delete(struct bch_fs *c, u64 nr) ...@@ -42,7 +42,7 @@ static int test_delete(struct bch_fs *c, u64 nr)
bch2_trans_iter_init(&trans, &iter, BTREE_ID_xattrs, k.k.p, bch2_trans_iter_init(&trans, &iter, BTREE_ID_xattrs, k.k.p,
BTREE_ITER_INTENT); BTREE_ITER_INTENT);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &k.k_i, 0)); bch2_trans_update(&trans, &iter, &k.k_i, 0));
if (ret) { if (ret) {
...@@ -51,7 +51,7 @@ static int test_delete(struct bch_fs *c, u64 nr) ...@@ -51,7 +51,7 @@ static int test_delete(struct bch_fs *c, u64 nr)
} }
pr_info("deleting once"); pr_info("deleting once");
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(&trans, &iter, 0)); bch2_btree_delete_at(&trans, &iter, 0));
if (ret) { if (ret) {
...@@ -60,7 +60,7 @@ static int test_delete(struct bch_fs *c, u64 nr) ...@@ -60,7 +60,7 @@ static int test_delete(struct bch_fs *c, u64 nr)
} }
pr_info("deleting twice"); pr_info("deleting twice");
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(&trans, &iter, 0)); bch2_btree_delete_at(&trans, &iter, 0));
if (ret) { if (ret) {
...@@ -88,7 +88,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr) ...@@ -88,7 +88,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr)
bch2_trans_iter_init(&trans, &iter, BTREE_ID_xattrs, k.k.p, bch2_trans_iter_init(&trans, &iter, BTREE_ID_xattrs, k.k.p,
BTREE_ITER_INTENT); BTREE_ITER_INTENT);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &k.k_i, 0)); bch2_trans_update(&trans, &iter, &k.k_i, 0));
if (ret) { if (ret) {
...@@ -99,7 +99,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr) ...@@ -99,7 +99,7 @@ static int test_delete_written(struct bch_fs *c, u64 nr)
bch2_trans_unlock(&trans); bch2_trans_unlock(&trans);
bch2_journal_flush_all_pins(&c->journal); bch2_journal_flush_all_pins(&c->journal);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_btree_delete_at(&trans, &iter, 0)); bch2_btree_delete_at(&trans, &iter, 0));
if (ret) { if (ret) {
...@@ -552,7 +552,7 @@ static int rand_insert(struct bch_fs *c, u64 nr) ...@@ -552,7 +552,7 @@ static int rand_insert(struct bch_fs *c, u64 nr)
k.k.p.offset = test_rand(); k.k.p.offset = test_rand();
k.k.p.snapshot = U32_MAX; k.k.p.snapshot = U32_MAX;
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k.k_i)); __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k.k_i));
if (ret) { if (ret) {
bch_err(c, "error in rand_insert: %i", ret); bch_err(c, "error in rand_insert: %i", ret);
...@@ -581,7 +581,7 @@ static int rand_insert_multi(struct bch_fs *c, u64 nr) ...@@ -581,7 +581,7 @@ static int rand_insert_multi(struct bch_fs *c, u64 nr)
k[j].k.p.snapshot = U32_MAX; k[j].k.p.snapshot = U32_MAX;
} }
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[0].k_i) ?: __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[0].k_i) ?:
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[1].k_i) ?: __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[1].k_i) ?:
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[2].k_i) ?: __bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[2].k_i) ?:
...@@ -668,7 +668,7 @@ static int rand_mixed(struct bch_fs *c, u64 nr) ...@@ -668,7 +668,7 @@ static int rand_mixed(struct bch_fs *c, u64 nr)
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
rand = test_rand(); rand = test_rand();
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
rand_mixed_trans(&trans, &iter, &cookie, i, rand)); rand_mixed_trans(&trans, &iter, &cookie, i, rand));
if (ret) { if (ret) {
bch_err(c, "update error in rand_mixed: %i", ret); bch_err(c, "update error in rand_mixed: %i", ret);
...@@ -714,7 +714,7 @@ static int rand_delete(struct bch_fs *c, u64 nr) ...@@ -714,7 +714,7 @@ static int rand_delete(struct bch_fs *c, u64 nr)
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
struct bpos pos = SPOS(0, test_rand(), U32_MAX); struct bpos pos = SPOS(0, test_rand(), U32_MAX);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
__do_delete(&trans, pos)); __do_delete(&trans, pos));
if (ret) { if (ret) {
bch_err(c, "error in rand_delete: %i", ret); bch_err(c, "error in rand_delete: %i", ret);
...@@ -743,7 +743,7 @@ static int seq_insert(struct bch_fs *c, u64 nr) ...@@ -743,7 +743,7 @@ static int seq_insert(struct bch_fs *c, u64 nr)
BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret) { BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret) {
insert.k.p = iter.pos; insert.k.p = iter.pos;
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &insert.k_i, 0)); bch2_trans_update(&trans, &iter, &insert.k_i, 0));
if (ret) { if (ret) {
...@@ -794,7 +794,7 @@ static int seq_overwrite(struct bch_fs *c, u64 nr) ...@@ -794,7 +794,7 @@ static int seq_overwrite(struct bch_fs *c, u64 nr)
bkey_reassemble(&u.k_i, k); bkey_reassemble(&u.k_i, k);
ret = __bch2_trans_do(&trans, NULL, NULL, 0, ret = commit_do(&trans, NULL, NULL, 0,
bch2_btree_iter_traverse(&iter) ?: bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(&trans, &iter, &u.k_i, 0)); bch2_trans_update(&trans, &iter, &u.k_i, 0));
if (ret) { if (ret) {
......
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