summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-11 00:23:33 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 11:47:44 -0500
commit398c98347d464f7675216c5ea974a82bcdb2bef9 (patch)
tree7a77dddc59d448ac3f49271803b227f778699f5b /fs/bcachefs
parentd7e14035a4b43440a5ba741759501d86e96005d2 (diff)
downloadlinux-stable-398c98347d464f7675216c5ea974a82bcdb2bef9.tar.gz
linux-stable-398c98347d464f7675216c5ea974a82bcdb2bef9.tar.bz2
linux-stable-398c98347d464f7675216c5ea974a82bcdb2bef9.zip
bcachefs: kill btree_path.idx
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/btree_iter.c7
-rw-r--r--fs/bcachefs/btree_iter.h28
-rw-r--r--fs/bcachefs/btree_locking.c2
-rw-r--r--fs/bcachefs/btree_locking.h1
-rw-r--r--fs/bcachefs/btree_types.h1
5 files changed, 8 insertions, 31 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 30242e95e617..cfe81db883cc 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1324,8 +1324,6 @@ void bch2_path_put(struct btree_trans *trans, btree_path_idx_t path_idx, bool in
{
struct btree_path *path = trans->paths + path_idx, *dup;
- EBUG_ON(path->idx != path_idx);
-
if (!__btree_path_put(path, intent))
return;
@@ -1352,8 +1350,6 @@ void bch2_path_put(struct btree_trans *trans, btree_path_idx_t path_idx, bool in
static void bch2_path_put_nokeep(struct btree_trans *trans, btree_path_idx_t path,
bool intent)
{
- EBUG_ON(trans->paths[path].idx != path);
-
if (!__btree_path_put(trans->paths + path, intent))
return;
@@ -1542,7 +1538,6 @@ static inline btree_path_idx_t btree_path_alloc(struct btree_trans *trans,
__set_bit(idx, trans->paths_allocated);
struct btree_path *path = &trans->paths[idx];
- path->idx = idx;
path->ref = 0;
path->intent_ref = 0;
path->nodes_locked = 0;
@@ -3090,7 +3085,7 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans)
prt_printf(out, "%i %s\n", task ? task->pid : 0, trans->fn);
- trans_for_each_path_safe(trans, path, idx) {
+ trans_for_each_path(trans, path, idx) {
if (!path->nodes_locked)
continue;
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h
index eb9aa3930ca2..5ee118d3eaa5 100644
--- a/fs/bcachefs/btree_iter.h
+++ b/fs/bcachefs/btree_iter.h
@@ -64,40 +64,24 @@ static inline void btree_trans_sort_paths(struct btree_trans *trans)
}
static inline struct btree_path *
-__trans_next_path_safe(struct btree_trans *trans, unsigned *idx)
+__trans_next_path(struct btree_trans *trans, unsigned *idx)
{
*idx = find_next_bit(trans->paths_allocated, BTREE_ITER_MAX, *idx);
- if (*idx == BTREE_ITER_MAX)
- return NULL;
- EBUG_ON(*idx > BTREE_ITER_MAX);
- return &trans->paths[*idx];
+ return *idx < BTREE_ITER_MAX ? &trans->paths[*idx] : NULL;
}
/*
* This version is intended to be safe for use on a btree_trans that is owned by
* another thread, for bch2_btree_trans_to_text();
*/
-#define trans_for_each_path_safe_from(_trans, _path, _idx, _start) \
+#define trans_for_each_path_from(_trans, _path, _idx, _start) \
for (_idx = _start; \
- (_path = __trans_next_path_safe((_trans), &_idx)); \
+ (_path = __trans_next_path((_trans), &_idx)); \
_idx++)
-#define trans_for_each_path_safe(_trans, _path, _idx) \
- trans_for_each_path_safe_from(_trans, _path, _idx, 1)
-
-static inline struct btree_path *
-__trans_next_path(struct btree_trans *trans, unsigned *idx)
-{
- struct btree_path *path = __trans_next_path_safe(trans, idx);
- EBUG_ON(path && path->idx != *idx);
- return path;
-}
-
-#define trans_for_each_path(_trans, _path, _iter) \
- for (_iter = 1; \
- (_path = __trans_next_path((_trans), &_iter)); \
- _iter++)
+#define trans_for_each_path(_trans, _path, _idx) \
+ trans_for_each_path_from(_trans, _path, _idx, 1)
static inline struct btree_path *next_btree_path(struct btree_trans *trans, struct btree_path *path)
{
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c
index e38b2b9570a8..e4a436bfaeee 100644
--- a/fs/bcachefs/btree_locking.c
+++ b/fs/bcachefs/btree_locking.c
@@ -302,7 +302,7 @@ next:
top = &g.g[g.nr - 1];
- trans_for_each_path_safe_from(top->trans, path, path_idx, top->path_idx) {
+ trans_for_each_path_from(top->trans, path, path_idx, top->path_idx) {
if (!path->nodes_locked)
continue;
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index fc92781e97ba..64810ea544c9 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -265,7 +265,6 @@ static inline int btree_node_lock(struct btree_trans *trans,
int ret = 0;
EBUG_ON(level >= BTREE_MAX_DEPTH);
- EBUG_ON(!test_bit(path->idx, trans->paths_allocated));
if (likely(six_trylock_type(&b->lock, type)) ||
btree_node_lock_increment(trans, b, level, (enum btree_node_locked_type) type) ||
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h
index da7b836cbcf8..54156a05ebf5 100644
--- a/fs/bcachefs/btree_types.h
+++ b/fs/bcachefs/btree_types.h
@@ -225,7 +225,6 @@ enum btree_path_uptodate {
typedef u16 btree_path_idx_t;
struct btree_path {
- btree_path_idx_t idx;
btree_path_idx_t sorted_idx;
u8 ref;
u8 intent_ref;