summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-09-15 11:15:18 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-05-30 18:16:43 -0400
commitf346676e49d014ba95b5926acf5da2a18763b036 (patch)
tree289c16a96c7693e2431206d078b9548ad11eb6db
parent045de83ff45f990f3f988f541025761222bf455a (diff)
Revert "bcachefs: Add more assertions for locking btree iterators out of order"
Figured out the bug we were chasing, and it had nothing to do with locking btree iterators/paths out of order. This reverts commit ff08733dd298c969aec7c7828095458f73fd5374. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/btree_iter.c23
-rw-r--r--fs/bcachefs/btree_key_cache.c4
-rw-r--r--fs/bcachefs/btree_locking.h17
-rw-r--r--fs/bcachefs/btree_types.h2
4 files changed, 13 insertions, 33 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 0e64009f930f..bd798388366d 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -160,7 +160,7 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
if (six_relock_type(&b->c.lock, want, path->l[level].lock_seq) ||
(btree_node_lock_seq_matches(path, b, level) &&
btree_node_lock_increment(trans, b, level, want))) {
- mark_btree_node_locked(trans, path, level, want);
+ mark_btree_node_locked(path, level, want);
return true;
} else {
return false;
@@ -196,7 +196,7 @@ static bool bch2_btree_node_upgrade(struct btree_trans *trans,
return false;
success:
- mark_btree_node_intent_locked(trans, path, level);
+ mark_btree_node_intent_locked(path, level);
return true;
}
@@ -904,12 +904,12 @@ static inline struct bkey_s_c btree_path_level_peek_all(struct bch_fs *c,
bch2_btree_node_iter_peek_all(&l->iter, l->b));
}
-static inline struct bkey_s_c btree_path_level_peek(struct btree_trans *trans,
+static inline struct bkey_s_c btree_path_level_peek(struct bch_fs *c,
struct btree_path *path,
struct btree_path_level *l,
struct bkey *u)
{
- struct bkey_s_c k = __btree_iter_unpack(trans->c, l, u,
+ struct bkey_s_c k = __btree_iter_unpack(c, l, u,
bch2_btree_node_iter_peek(&l->iter, l->b));
path->pos = k.k ? k.k->p : l->b->key.k.p;
@@ -1049,7 +1049,7 @@ void bch2_trans_node_add(struct btree_trans *trans, struct btree *b)
t != BTREE_NODE_UNLOCKED) {
btree_node_unlock(path, b->c.level);
six_lock_increment(&b->c.lock, t);
- mark_btree_node_locked(trans, path, b->c.level, t);
+ mark_btree_node_locked(path, b->c.level, t);
}
btree_path_level_init(trans, path, b);
@@ -1126,7 +1126,7 @@ static inline int btree_path_lock_root(struct btree_trans *trans,
for (i = path->level + 1; i < BTREE_MAX_DEPTH; i++)
path->l[i].b = NULL;
- mark_btree_node_locked(trans, path, path->level, lock_type);
+ mark_btree_node_locked(path, path->level, lock_type);
btree_path_level_init(trans, path, b);
return 0;
}
@@ -1218,7 +1218,7 @@ static __always_inline int btree_path_down(struct btree_trans *trans,
if (unlikely(ret))
goto err;
- mark_btree_node_locked(trans, path, level, lock_type);
+ mark_btree_node_locked(path, level, lock_type);
btree_path_level_init(trans, path, b);
if (tmp.k->k.type == KEY_TYPE_btree_ptr_v2 &&
@@ -1260,10 +1260,6 @@ retry_all:
btree_trans_verify_sorted(trans);
-#ifdef CONFIG_BCACHEFS_DEBUG
- trans->traverse_all_idx = U8_MAX;
-#endif
-
for (i = trans->nr_sorted - 2; i >= 0; --i) {
struct btree_path *path1 = trans->paths + trans->sorted[i];
struct btree_path *path2 = trans->paths + trans->sorted[i + 1];
@@ -1302,9 +1298,6 @@ retry_all:
path = trans->paths + trans->sorted[i];
EBUG_ON(!(trans->paths_allocated & (1ULL << path->idx)));
-#ifdef CONFIG_BCACHEFS_DEBUG
- trans->traverse_all_idx = path->idx;
-#endif
ret = btree_path_traverse_one(trans, path, 0, _THIS_IP_);
if (ret)
@@ -2074,7 +2067,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter)
goto out;
}
- k = btree_path_level_peek(trans, iter->path,
+ k = btree_path_level_peek(trans->c, iter->path,
&iter->path->l[0], &iter->k);
if (!k.k ||
((iter->flags & BTREE_ITER_IS_EXTENTS)
diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c
index 938ced36af73..2dfa5040d045 100644
--- a/fs/bcachefs/btree_key_cache.c
+++ b/fs/bcachefs/btree_key_cache.c
@@ -296,7 +296,7 @@ retry:
if (!ck)
goto retry;
- mark_btree_node_locked(trans, path, 0, SIX_LOCK_intent);
+ mark_btree_node_locked(path, 0, SIX_LOCK_intent);
path->locks_want = 1;
} else {
enum six_lock_type lock_want = __btree_lock_want(path, 0);
@@ -318,7 +318,7 @@ retry:
goto retry;
}
- mark_btree_node_locked(trans, path, 0, lock_want);
+ mark_btree_node_locked(path, 0, lock_want);
}
path->l[0].lock_seq = ck->c.lock.state.seq;
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index 5c6b758070e1..d599008c5fc1 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -58,8 +58,7 @@ static inline void mark_btree_node_unlocked(struct btree_path *path,
path->nodes_intent_locked &= ~(1 << level);
}
-static inline void mark_btree_node_locked(struct btree_trans *trans,
- struct btree_path *path,
+static inline void mark_btree_node_locked(struct btree_path *path,
unsigned level,
enum six_lock_type type)
{
@@ -69,19 +68,12 @@ static inline void mark_btree_node_locked(struct btree_trans *trans,
path->nodes_locked |= 1 << level;
path->nodes_intent_locked |= type << level;
-#ifdef CONFIG_BCACHEFS_DEBUG
- path->ip_locked = _RET_IP_;
- BUG_ON(trans->in_traverse_all &&
- trans->traverse_all_idx != U8_MAX &&
- path->sorted_idx > trans->paths[trans->traverse_all_idx].sorted_idx);
-#endif
}
-static inline void mark_btree_node_intent_locked(struct btree_trans *trans,
- struct btree_path *path,
+static inline void mark_btree_node_intent_locked(struct btree_path *path,
unsigned level)
{
- mark_btree_node_locked(trans, path, level, SIX_LOCK_intent);
+ mark_btree_node_locked(path, level, SIX_LOCK_intent);
}
static inline enum six_lock_type __btree_lock_want(struct btree_path *path, int level)
@@ -120,9 +112,6 @@ static inline void __bch2_btree_path_unlock(struct btree_path *path)
while (path->nodes_locked)
btree_node_unlock(path, __ffs(path->nodes_locked));
-#ifdef CONFIG_BCACHEFS_DEBUG
- path->ip_locked = 0;
-#endif
}
static inline enum bch_time_stats lock_to_time_stat(enum six_lock_type type)
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h
index ccf91ebd94aa..300cdbb6821d 100644
--- a/fs/bcachefs/btree_types.h
+++ b/fs/bcachefs/btree_types.h
@@ -255,7 +255,6 @@ struct btree_path {
} l[BTREE_MAX_DEPTH];
#ifdef CONFIG_BCACHEFS_DEBUG
unsigned long ip_allocated;
- unsigned long ip_locked;
#endif
};
@@ -369,7 +368,6 @@ struct btree_trans {
struct bpos locking_pos;
u8 locking_btree_id;
u8 locking_level;
- u8 traverse_all_idx;
pid_t pid;
#endif
unsigned long ip;