transaction restart handling fixes
cover transaction restart handling fixes
I just started doing automated testing with transaction restarts randomly injected, and that's been shaking out a few bugs. Here's fixes for most of them:
Kent Overstreet (9):
bcachefs: fix restart handling in bch2_rename2()
bcachefs: fix bch2_hash_delete() error path
bcachefs: fix restart handling in bch2_fiemap()
bcachefs: fix missing restart handling in bch2_read_retry_nodecode()
bcachefs: fix restart handling in bch2_do_invalidates_work()
bcachefs: fix restart handling in bch2_alloc_write_key()
bcachefs: fix restart handling in __bch2_resume_logged_op_finsert()
bcachefs: handle restarts in bch2_bucket_io_time_reset()
bcachefs: Don't use commit_do() unnecessarily
fs/bcachefs/alloc_background.c | 37 ++++++++++++++++------------- fs/bcachefs/alloc_foreground.c | 2 +- fs/bcachefs/btree_gc.c | 12 +++++++++- fs/bcachefs/btree_io.c | 2 +- fs/bcachefs/btree_iter.h | 2 ++ fs/bcachefs/btree_update.c | 4 ++-- fs/bcachefs/btree_update.h | 2 +- fs/bcachefs/btree_update_interior.c | 4 +--- fs/bcachefs/disk_accounting.c | 6 +++-- fs/bcachefs/ec.c | 18 +++++++------- fs/bcachefs/fs.c | 16 +++++-------- fs/bcachefs/fsck.c | 2 +- fs/bcachefs/inode.c | 3 +-- fs/bcachefs/io_misc.c | 2 +- fs/bcachefs/io_read.c | 8 +++---- fs/bcachefs/io_write.c | 4 ++-- fs/bcachefs/quota.c | 2 +- fs/bcachefs/rebalance.c | 4 +++- fs/bcachefs/recovery.c | 2 +- fs/bcachefs/str_hash.h | 7 ++++-- fs/bcachefs/subvolume.c | 7 +++--- fs/bcachefs/super.c | 2 +- fs/bcachefs/tests.c | 4 ++-- fs/bcachefs/xattr.c | 2 +- 24 files changed, 85 insertions(+), 69 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/9 bcachefs: fix restart handling in bch2_rename2()
This should be impossible to hit in practice; the first lookup within a transaction won't return a restart due to lock ordering, but we're adding fault injection for transaction restarts and shaking out bugs.
--- fs/bcachefs/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/fs.c +1 -1
@@ -871,7 +871,7 @@ static int bch2_rename2(struct mnt_idmap *idmap, ret =bch2_subvol_is_ro_trans (trans, src_dir->ei_inum.subvol) ?:bch2_subvol_is_ro_trans (trans, dst_dir->ei_inum.subvol);if (ret) - goto err; + goto err_tx_restart;if (inode_attr_changing (dst_dir, src_inode, Inode_opt_project)) { ret = bch2_fs_quota_transfer(c, src_inode,
Signature · 1 line
2.45.2
PATCH 2/9 bcachefs: fix bch2_hash_delete() error path
In reply to Kent Overstreetwe were exiting an iterator that hadn't been initialized
--- fs/bcachefs/str_hash.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/bcachefs/str_hash.h +5 -2
@@ -363,8 +363,11 @@ int bch2_hash_delete(struct btree_trans *trans,struct btree_iter iter;struct bkey_s_c k =bch2_hash_lookup (trans, &iter, desc, info, inum, key, BTREE_ITER_intent); -int ret =bkey_err (k) ?: -bch2_hash_delete_at (trans, desc, info, &iter,0 ); +int ret =bkey_err (k); +if (ret) +return ret; + + ret =bch2_hash_delete_at (trans, desc, info, &iter,0 );bch2_trans_iter_exit (trans, &iter);return ret; }
Signature · 1 line
2.45.2
PATCH 3/9 bcachefs: fix restart handling in bch2_fiemap()
In reply to Kent OverstreetWe were leaking transaction restart errors to userspace.
--- fs/bcachefs/fs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/bcachefs/fs.c +4 -8
@@ -1268,7 +1268,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,bch2_trans_iter_init (trans, &iter, BTREE_ID_extents,POS (ei->v.i_ino, start),0 ); -while (true) { +while (!ret ||bch2_err_matches (ret, BCH_ERR_transaction_restart)) {enum btree_id data_btree = BTREE_ID_extents;bch2_trans_begin (trans);
@@ -1276,14 +1276,14 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,u32 snapshot; ret =bch2_subvolume_get_snapshot (trans, ei->ei_inum.subvol, &snapshot);if (ret) - goto err; +continue ;bch2_btree_iter_set_snapshot (&iter, snapshot); k =bch2_btree_iter_peek_upto (&iter, end); ret =bkey_err (k);if (ret) - goto err; +continue ;if (!k.k)break ;
@@ -1303,7 +1303,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info, ret =bch2_read_indirect_extent (trans, &data_btree, &offset_into_extent, &cur);if (ret) -break ; +continue ; k =bkey_i_to_s_c (cur.k);bch2_bkey_buf_realloc (&prev, c, k.k->u64s);
@@ -1331,10 +1331,6 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,bch2_btree_iter_set_pos (&iter,POS (iter.pos.inode, iter.pos.offset + sectors)); -err: -if (ret && - !bch2_err_matches (ret, BCH_ERR_transaction_restart)) -break ; }bch2_trans_iter_exit (trans, &iter);
Signature · 1 line
2.45.2
PATCH 4/9 bcachefs: fix missing restart handling in bch2_read_retry_nodecode()
In reply to Kent Overstreet--- fs/bcachefs/io_read.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/bcachefs/io_read.c +2 -2
@@ -409,8 +409,8 @@ static void bch2_read_retry_nodecode(struct bch_fs *c, struct bch_read_bio *rbiobch2_trans_begin (trans); rbio->bio.bi_status =0 ; - k =bch2_btree_iter_peek_slot (&iter); -if (bkey_err (k)) + ret =lockrestart_do (trans,bkey_err (k =bch2_btree_iter_peek_slot (&iter))); +if (ret) goto err;bch2_bkey_buf_reassemble (&sk, c, k);
Signature · 1 line
2.45.2
PATCH 5/9 bcachefs: fix restart handling in bch2_do_invalidates_work()
In reply to Kent Overstreetthis one is fairly harmless since the invalidate worker will just run again later if it needs to, but still worth fixing
--- fs/bcachefs/alloc_background.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/bcachefs/alloc_background.c +4 -3
@@ -2137,14 +2137,15 @@ static void bch2_do_invalidates_work(struct work_struct *work)struct bkey_s_c k =next_lru_key (trans, &iter, ca, &wrapped); ret =bkey_err (k); -if (bch2_err_matches (ret, BCH_ERR_transaction_restart)) -continue ;if (ret) -break ; + goto restart_err;if (!k.k)break ; ret =invalidate_one_bucket (trans, &iter, k, &nr_to_invalidate); +restart_err: +if (bch2_err_matches (ret, BCH_ERR_transaction_restart)) +continue ;if (ret)break ;
Signature · 1 line
2.45.2
PATCH 6/9 bcachefs: fix restart handling in bch2_alloc_write_key()
In reply to Kent OverstreetThis is ugly:
We may discover in alloc_write_key that the data type we calculated is wrong, because BCH_DATA_need_discard is checked/set elsewhere, and the disk accounting counters we calculated need to be updated.
But bch2_alloc_key_to_dev_counters(..., BTREE_TRIGGER_gc) is not safe w.r.t. transaction restarts, so we need to propagate the fixup back to our gc state in case we take a transaction restart.
--- fs/bcachefs/btree_gc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/bcachefs/btree_gc.c +11 -1
@@ -820,12 +820,22 @@ static int bch2_alloc_write_key(struct btree_trans *trans,* fix that here: */ alloc_data_type_set (&gc, gc.data_type); -if (gc.data_type != old_gc.data_type || gc.dirty_sectors != old_gc.dirty_sectors) { ret =bch2_alloc_key_to_dev_counters (trans, ca, &old_gc, &gc, BTREE_TRIGGER_gc);if (ret)return ret; + +/* +* Ugly: alloc_key_to_dev_counters(..., BTREE_TRIGGER_gc) is not +* safe w.r.t. transaction restarts, so fixup the gc_bucket so +* we don't run it twice: +*/ +percpu_down_read (&c->mark_lock); +struct bucket *gc_m =gc_bucket (ca, iter->pos.offset); + gc_m->data_type = gc.data_type; + gc_m->dirty_sectors = gc.dirty_sectors; +percpu_up_read (&c->mark_lock); } if (fsck_err_on(new.data_type != gc.data_type,
Signature · 1 line
2.45.2
PATCH 7/9 bcachefs: fix restart handling in __bch2_resume_logged_op_finsert()
In reply to Kent Overstreet--- fs/bcachefs/io_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/io_misc.c +1 -1
@@ -377,7 +377,7 @@ static int __bch2_resume_logged_op_finsert(struct btree_trans *trans,* check for missing subvolume before fpunch, as in resume we don't want * it to be a fatal error */ - ret =__bch2_subvolume_get_snapshot (trans, inum.subvol, &snapshot, warn_errors); + ret =lockrestart_do (trans,__bch2_subvolume_get_snapshot (trans, inum.subvol, &snapshot, warn_errors));if (ret)return ret;
Signature · 1 line
2.45.2
PATCH 8/9 bcachefs: handle restarts in bch2_bucket_io_time_reset()
In reply to Kent Overstreetbch2_bucket_io_time_reset() doesn't need to succeed, which is why it didn't previously retry on transaction restart - but we're now treating these as errors.
--- fs/bcachefs/alloc_background.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
fs/bcachefs/alloc_background.c +16 -12
@@ -2351,24 +2351,19 @@ int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)/* Bucket IO clocks: */ -int bch2_bucket_io_time_reset (struct btree_trans *trans,unsigned dev, -size_t bucket_nr,int rw) +static int __bch2_bucket_io_time_reset (struct btree_trans *trans,unsigned dev, +size_t bucket_nr,int rw) {struct bch_fs *c = trans->c; -struct btree_iter iter; -struct bkey_i_alloc_v4 *a; -u64 now; -int ret =0 ; -if (bch2_trans_relock (trans)) -bch2_trans_begin (trans); - - a =bch2_trans_start_alloc_update_noupdate (trans, &iter,POS (dev, bucket_nr)); - ret =PTR_ERR_OR_ZERO (a); +struct btree_iter iter; +struct bkey_i_alloc_v4 *a = +bch2_trans_start_alloc_update_noupdate (trans, &iter,POS (dev, bucket_nr)); +int ret =PTR_ERR_OR_ZERO (a);if (ret)return ret; - now =bch2_current_io_time (c, rw); +u64 now =bch2_current_io_time (c, rw);if (a->v.io_time[rw] == now) goto out;
@@ -2381,6 +2376,15 @@ int bch2_bucket_io_time_reset(struct btree_trans *trans, unsigned dev,return ret; } +int bch2_bucket_io_time_reset (struct btree_trans *trans,unsigned dev, +size_t bucket_nr,int rw) +{ +if (bch2_trans_relock (trans)) +bch2_trans_begin (trans); + +return nested_lockrestart_do (trans,__bch2_bucket_io_time_reset (trans, dev, bucket_nr, rw)); +} +/* Startup/shutdown (ro/rw): */ void bch2_recalc_capacity (struct bch_fs *c)
Signature · 1 line
2.45.2
PATCH 9/9 bcachefs: Don't use commit_do() unnecessarily
In reply to Kent OverstreetUsing commit_do() to call alloc_sectors_start_trans() breaks when we're randomly injecting transaction restarts - the restart in the commit causes us to leak the lock that alloc_sectorS_start_trans() takes.
--- fs/bcachefs/alloc_background.c | 2 +- fs/bcachefs/alloc_foreground.c | 2 +- fs/bcachefs/btree_io.c | 2 +- fs/bcachefs/btree_iter.h | 2 ++ fs/bcachefs/btree_update.c | 4 ++-- fs/bcachefs/btree_update.h | 2 +- fs/bcachefs/btree_update_interior.c | 4 +--- fs/bcachefs/disk_accounting.c | 6 ++++-- fs/bcachefs/ec.c | 18 +++++++++--------- fs/bcachefs/fs.c | 2 +- fs/bcachefs/fsck.c | 2 +- fs/bcachefs/inode.c | 3 +-- fs/bcachefs/io_read.c | 4 ++-- fs/bcachefs/io_write.c | 4 ++-- fs/bcachefs/quota.c | 2 +- fs/bcachefs/rebalance.c | 4 +++- fs/bcachefs/recovery.c | 2 +- fs/bcachefs/subvolume.c | 7 +++---- fs/bcachefs/super.c | 2 +- fs/bcachefs/tests.c | 4 ++-- fs/bcachefs/xattr.c | 2 +- 21 files changed, 41 insertions(+), 39 deletions(-)
fs/bcachefs/alloc_background.c +1 -1
@@ -1977,7 +1977,7 @@ static void bch2_do_discards_fast_work(struct work_struct *work) ca->mi.bucket_size, GFP_KERNEL); -int ret =bch2_trans_do (c,NULL ,NULL , +int ret =bch2_trans_commit_do (c,NULL ,NULL , BCH_WATERMARK_btree| BCH_TRANS_COMMIT_no_enospc,bch2_clear_bucket_needs_discard (trans,POS (ca->dev_idx, bucket)));
fs/bcachefs/alloc_foreground.c +1 -1
@@ -684,7 +684,7 @@ struct open_bucket *bch2_bucket_alloc(struct bch_fs *c, struct bch_dev *ca,struct bch_dev_usage usage;struct open_bucket *ob; -bch2_trans_do (c,NULL ,NULL ,0 , +bch2_trans_do (c,PTR_ERR_OR_ZERO (ob =bch2_bucket_alloc_trans (trans, ca, watermark, data_type, cl, false, &usage)));return ob;
fs/bcachefs/btree_io.c +1 -1
@@ -1871,7 +1871,7 @@ static void btree_node_write_work(struct work_struct *work) } }else { - ret = bch2_trans_do(c, NULL, NULL, 0, + ret = bch2_trans_do(c, bch2_btree_node_update_key_get_iter(trans, b, &wbio->key, BCH_WATERMARK_interior_updates| BCH_TRANS_COMMIT_journal_reclaim|
fs/bcachefs/btree_iter.h +2 -0
@@ -912,6 +912,8 @@ struct bkey_s_c bch2_btree_iter_peek_and_restart_outlined(struct btree_iter *); _ret; \ }) +#define bch2_trans_do (_c, _do) bch2_trans_run(_c, lockrestart_do(trans, _do)) +struct btree_trans *__bch2_trans_get (struct bch_fs *,unsigned );void bch2_trans_put (struct btree_trans *);
fs/bcachefs/btree_update.c +2 -2
@@ -668,7 +668,7 @@ int bch2_btree_insert(struct bch_fs *c, enum btree_id id, struct bkey_i *k, struct disk_reservation *disk_res, int flags, enum btree_iter_update_trigger_flags iter_flags) { - return bch2_trans_do(c, disk_res, NULL, flags, + return bch2_trans_commit_do(c, disk_res, NULL, flags,bch2_btree_insert_trans (trans ,id ,k ,iter_flags )); }
@@ -865,7 +865,7 @@ __bch2_fs_log_msg(struct bch_fs *c, unsigned commit_flags, const char *fmt,memcpy (l->d, buf.buf, buf.pos); c->journal.early_journal_entries.nr +=jset_u64s (u64s); }else { - ret =bch2_trans_do (c,NULL ,NULL , + ret =bch2_trans_commit_do (c,NULL ,NULL , BCH_TRANS_COMMIT_lazy_rw|commit_flags,__bch2_trans_log_msg (trans, &buf, u64s)); }
fs/bcachefs/btree_update.h +1 -1
@@ -192,7 +192,7 @@ static inline int bch2_trans_commit(struct btree_trans *trans,nested_lockrestart_do (_trans, _do ?:bch2_trans_commit (_trans, (_disk_res),\ (_journal_seq), (_flags))) -#define bch2_trans_do (_c, _disk_res, _journal_seq, _flags, _do) \ +#define bch2_trans_commit_do (_c, _disk_res, _journal_seq, _flags, _do) \ bch2_trans_run(_c, commit_do(trans, _disk_res, _journal_seq, _flags, _do))#define trans_for_each_update (_trans, _i) \
fs/bcachefs/btree_update_interior.c +1 -3
@@ -2239,10 +2239,8 @@ static void async_btree_node_rewrite_work(struct work_struct *work)struct async_btree_rewrite *a = container_of(work, struct async_btree_rewrite, work);struct bch_fs *c = a->c; -int ret; - ret =bch2_trans_do (c,NULL ,NULL ,0 , -async_btree_node_rewrite_trans (trans, a)); +int ret =bch2_trans_do (c,async_btree_node_rewrite_trans (trans, a));bch_err_fn_ratelimited (c, ret);bch2_write_ref_put (c, BCH_WRITE_REF_node_rewrite);kfree (a);
fs/bcachefs/disk_accounting.c +4 -2
@@ -856,8 +856,10 @@ int bch2_dev_usage_init(struct bch_dev *ca, bool gc) };u64 v[3 ] = { ca->mi.nbuckets - ca->mi.first_bucket,0 ,0 }; -int ret =bch2_trans_do (c,NULL ,NULL ,0 , -bch2_disk_accounting_mod (trans, &acc, v,ARRAY_SIZE (v), gc)); +int ret =bch2_trans_do (c, ({ +bch2_disk_accounting_mod (trans, &acc, v,ARRAY_SIZE (v), gc) ?: + (!gc ?bch2_trans_commit (trans,NULL ,NULL ,0 ) :0 ); + }));bch_err_fn (c, ret);return ret; }
fs/bcachefs/ec.c +9 -9
@@ -1186,7 +1186,7 @@ static void ec_stripe_delete_work(struct work_struct *work)if (!idx)break ; -int ret =bch2_trans_do (c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc, +int ret =bch2_trans_commit_do (c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc,ec_stripe_delete (trans, idx));bch_err_fn (c, ret);if (ret)
@@ -1519,14 +1519,14 @@ static void ec_stripe_create(struct ec_stripe_new *s) goto err; } - ret =bch2_trans_do (c, &s->res,NULL , - BCH_TRANS_COMMIT_no_check_rw| - BCH_TRANS_COMMIT_no_enospc, -ec_stripe_key_update (trans, - s->have_existing_stripe - ?bkey_i_to_stripe (&s->existing_stripe.key) - :NULL , -bkey_i_to_stripe (&s->new_stripe.key))); + ret =bch2_trans_commit_do (c, &s->res,NULL , + BCH_TRANS_COMMIT_no_check_rw| + BCH_TRANS_COMMIT_no_enospc, +ec_stripe_key_update (trans, + s->have_existing_stripe + ?bkey_i_to_stripe (&s->existing_stripe.key) + :NULL , +bkey_i_to_stripe (&s->new_stripe.key)));bch_err_msg (c, ret,"creating stripe key" );if (ret) { goto err;
fs/bcachefs/fs.c +1 -1
@@ -658,7 +658,7 @@ static struct dentry *bch2_lookup(struct inode *vdir, struct dentry *dentry,struct bch_hash_info hash =bch2_hash_info_init (c, &dir->ei_inode);struct bch_inode_info *inode; -bch2_trans_do (c,NULL ,NULL ,0 , +bch2_trans_do (c,PTR_ERR_OR_ZERO (inode =bch2_lookup_trans (trans,inode_inum (dir), &hash, &dentry->d_name)));if (IS_ERR (inode))
fs/bcachefs/fsck.c +1 -1
@@ -2509,7 +2509,7 @@ static int check_root_trans(struct btree_trans *trans)/* Get root directory, create if it doesn't exist: */ int bch2_check_root (struct bch_fs *c) { -int ret =bch2_trans_do (c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc, +int ret =bch2_trans_commit_do (c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc,check_root_trans (trans));bch_err_fn (c, ret);return ret;
fs/bcachefs/inode.c +1 -2
@@ -1087,8 +1087,7 @@ int bch2_inode_find_by_inum_trans(struct btree_trans *trans,int bch2_inode_find_by_inum (struct bch_fs *c,subvol_inum inum,struct bch_inode_unpacked *inode) { -return bch2_trans_do (c,NULL ,NULL ,0 , -bch2_inode_find_by_inum_trans (trans, inum, inode)); +return bch2_trans_do (c,bch2_inode_find_by_inum_trans (trans, inum, inode)); }int bch2_inode_nlink_inc (struct bch_inode_unpacked *bi)
fs/bcachefs/io_read.c +2 -2
@@ -557,8 +557,8 @@ static int __bch2_rbio_narrow_crcs(struct btree_trans *trans, static noinline void bch2_rbio_narrow_crcs(struct bch_read_bio *rbio) { -bch2_trans_do (rbio->c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc, -__bch2_rbio_narrow_crcs (trans, rbio)); +bch2_trans_commit_do (rbio->c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc, +__bch2_rbio_narrow_crcs (trans, rbio)); }/* Inner part that may run in process context */
fs/bcachefs/io_write.c +2 -2
@@ -1437,7 +1437,7 @@ static void __bch2_write(struct bch_write_op *op)* freeing up space on specific disks, which means that * allocations for specific disks may hang arbitrarily long: */ - ret = bch2_trans_do(c, NULL, NULL, 0, + ret = bch2_trans_run(c, lockrestart_do(trans, bch2_alloc_sectors_start_trans(trans, op->target, op->opts.erasure_code && !(op->flags & BCH_WRITE_CACHED),
@@ -1447,7 +1447,7 @@ static void __bch2_write(struct bch_write_op *op) op->nr_replicas_required, op->watermark, op->flags, - &op->cl, &wp)); + &op->cl, &wp)));if (unlikely (ret)) {if (bch2_err_matches (ret, BCH_ERR_operation_blocked))break ;
fs/bcachefs/quota.c +1 -1
@@ -869,7 +869,7 @@ static int bch2_set_quota(struct super_block *sb, struct kqid qid,bkey_quota_init (&new_quota.k_i); new_quota.k.p =POS (qid.type,from_kqid (&init_user_ns, qid)); - ret =bch2_trans_do (c,NULL ,NULL ,0 , + ret =bch2_trans_commit_do (c,NULL ,NULL ,0 ,bch2_set_quota_trans (trans, &new_quota, qdq)) ?:__bch2_quota_set (c,bkey_i_to_s_c (&new_quota.k_i), qdq);
fs/bcachefs/rebalance.c +3 -1
@@ -70,7 +70,9 @@ static int __bch2_set_rebalance_needs_scan(struct btree_trans *trans, u64 inum)int bch2_set_rebalance_needs_scan (struct bch_fs *c,u64 inum) { -int ret =bch2_trans_do (c,NULL ,NULL , BCH_TRANS_COMMIT_no_enospc|BCH_TRANS_COMMIT_lazy_rw, +int ret =bch2_trans_commit_do (c,NULL ,NULL , + BCH_TRANS_COMMIT_no_enospc| + BCH_TRANS_COMMIT_lazy_rw,__bch2_set_rebalance_needs_scan (trans, inum));rebalance_wakeup (c);return ret;
fs/bcachefs/recovery.c +1 -1
@@ -1091,7 +1091,7 @@ int bch2_fs_initialize(struct bch_fs *c)bch2_inode_init_early (c, &lostfound_inode); - ret = bch2_trans_do(c, NULL, NULL, 0, + ret = bch2_trans_commit_do(c, NULL, NULL, 0, bch2_create_trans(trans, BCACHEFS_ROOT_SUBVOL_INUM, &root_inode, &lostfound_inode,
fs/bcachefs/subvolume.c +3 -4
@@ -319,8 +319,7 @@ int bch2_subvol_is_ro_trans(struct btree_trans *trans, u32 subvol)int bch2_subvol_is_ro (struct bch_fs *c,u32 subvol) { -return bch2_trans_do (c,NULL ,NULL ,0 , -bch2_subvol_is_ro_trans (trans, subvol)); +return bch2_trans_do (c,bch2_subvol_is_ro_trans (trans, subvol)); } int bch2_snapshot_get_subvol(struct btree_trans *trans, u32 snapshot,
@@ -676,8 +675,8 @@ static int __bch2_fs_upgrade_for_subvolumes(struct btree_trans *trans)/* set bi_subvol on root inode */ int bch2_fs_upgrade_for_subvolumes (struct bch_fs *c) { -int ret =bch2_trans_do (c,NULL ,NULL , BCH_TRANS_COMMIT_lazy_rw, -__bch2_fs_upgrade_for_subvolumes (trans)); +int ret =bch2_trans_commit_do (c,NULL ,NULL , BCH_TRANS_COMMIT_lazy_rw, +__bch2_fs_upgrade_for_subvolumes (trans));bch_err_fn (c, ret);return ret; }
fs/bcachefs/super.c +1 -1
@@ -1972,7 +1972,7 @@ int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets) };u64 v[3 ] = { nbuckets - old_nbuckets,0 ,0 }; - ret =bch2_trans_do (ca->fs,NULL ,NULL ,0 , + ret =bch2_trans_commit_do (ca->fs,NULL ,NULL ,0 ,bch2_disk_accounting_mod (trans, &acc, v,ARRAY_SIZE (v), false)) ?:bch2_dev_freespace_init (c, ca, old_nbuckets, nbuckets);if (ret)
fs/bcachefs/tests.c +2 -2
@@ -450,7 +450,7 @@ static int insert_test_overlapping_extent(struct bch_fs *c, u64 inum, u64 start, k.k_i.k.p.snapshot = snapid; k.k_i.k.size = len; - ret =bch2_trans_do (c,NULL ,NULL ,0 , + ret =bch2_trans_commit_do (c,NULL ,NULL ,0 ,bch2_btree_insert_nonextent (trans, BTREE_ID_extents, &k.k_i, BTREE_UPDATE_internal_snapshot_node));bch_err_fn (c, ret);
@@ -510,7 +510,7 @@ static int test_snapshots(struct bch_fs *c, u64 nr)if (ret)return ret; - ret = bch2_trans_do(c, NULL, NULL, 0, + ret = bch2_trans_commit_do(c, NULL, NULL, 0, bch2_snapshot_node_create(trans, U32_MAX, snapids, snapid_subvols,
fs/bcachefs/xattr.c +1 -1
@@ -330,7 +330,7 @@ static int bch2_xattr_get_handler(const struct xattr_handler *handler, {struct bch_inode_info *inode =to_bch_ei (vinode);struct bch_fs *c = inode->v.i_sb->s_fs_info; -int ret =bch2_trans_do (c,NULL ,NULL ,0 , +int ret =bch2_trans_do (c,bch2_xattr_get_trans (trans, inode, name, buffer, size, handler->flags));if (ret <0 &&bch2_err_matches (ret,ENOENT ))
Signature · 1 line
2.45.2