diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-18 23:18:39 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:18 +0300 |
commit | 1a470560c9ab8d6dd13363d5a6bae38d2c3d5261 (patch) | |
tree | 0defba1541e97f48e5528faee6ffadfffc0d0f78 | |
parent | 49a67206e4e481a097a3586fbd88ce0deb646307 (diff) | |
download | linux-1a470560c9ab8d6dd13363d5a6bae38d2c3d5261.tar.xz |
bcachefs: BTREE_INSERT_ATOMIC must be used for extents now
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/btree_update_leaf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c index 5349790547f4..d940fdf01478 100644 --- a/fs/bcachefs/btree_update_leaf.c +++ b/fs/bcachefs/btree_update_leaf.c @@ -406,9 +406,10 @@ bch2_deferred_update_alloc(struct bch_fs *c, /* Normal update interface: */ -static inline void btree_insert_entry_checks(struct bch_fs *c, +static inline void btree_insert_entry_checks(struct btree_trans *trans, struct btree_insert_entry *i) { + struct bch_fs *c = trans->c; enum btree_id btree_id = !i->deferred ? i->iter->btree_id : i->d->btree_id; @@ -419,6 +420,9 @@ static inline void btree_insert_entry_checks(struct bch_fs *c, EBUG_ON((i->iter->flags & BTREE_ITER_IS_EXTENTS) && !bch2_extent_is_atomic(i->k, i->iter)); + EBUG_ON((i->iter->flags & BTREE_ITER_IS_EXTENTS) && + !(trans->flags & BTREE_INSERT_ATOMIC)); + bch2_btree_iter_verify_locks(i->iter); } @@ -840,7 +844,7 @@ int bch2_trans_commit(struct btree_trans *trans, bubble_sort(trans->updates, trans->nr_updates, btree_trans_cmp); trans_for_each_update(trans, i) - btree_insert_entry_checks(c, i); + btree_insert_entry_checks(trans, i); if (unlikely(!(trans->flags & BTREE_INSERT_NOCHECK_RW) && !percpu_ref_tryget(&c->writes))) @@ -954,7 +958,10 @@ int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id, bch2_trans_update(&trans, BTREE_INSERT_ENTRY(iter, &delete)); ret = bch2_trans_commit(&trans, NULL, journal_seq, + BTREE_INSERT_ATOMIC| BTREE_INSERT_NOFAIL); + if (ret == -EINTR) + ret = 0; if (ret) break; |