summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/bcachefs/btree_update.h12
-rw-r--r--fs/bcachefs/buckets.c3
-rw-r--r--fs/bcachefs/journal.c2
3 files changed, 14 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index e9127dbf7e24..1c3dd012cae8 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -134,6 +134,18 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
_ret; \
})
+#define bch2_trans_run(_c, _do) \
+({ \
+ struct btree_trans trans; \
+ int _ret; \
+ \
+ bch2_trans_init(&trans, (_c), 0, 0); \
+ _ret = (_do); \
+ bch2_trans_exit(&trans); \
+ \
+ _ret; \
+})
+
#define trans_for_each_update(_trans, _i) \
for ((_i) = (_trans)->updates; \
(_i) < (_trans)->updates + (_trans)->nr_updates; \
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 71618f5bfcd5..136e116981d7 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1931,8 +1931,7 @@ static int __bch2_trans_mark_dev_sb(struct btree_trans *trans,
int bch2_trans_mark_dev_sb(struct bch_fs *c, struct bch_dev *ca)
{
- return bch2_trans_do(c, NULL, NULL, BTREE_INSERT_LAZY_RW,
- __bch2_trans_mark_dev_sb(&trans, ca));
+ return bch2_trans_run(c, __bch2_trans_mark_dev_sb(&trans, ca));
}
/* Disk reservations: */
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index a71bd1bb4066..26f60db751ca 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -882,7 +882,7 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
if (!new_fs) {
for (i = 0; i < nr_got; i++) {
- ret = bch2_trans_do(c, NULL, NULL, BTREE_INSERT_NOFAIL,
+ ret = bch2_trans_run(c,
bch2_trans_mark_metadata_bucket(&trans, ca,
bu[i], BCH_DATA_journal,
ca->mi.bucket_size));