Commit 385f0c05 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: kill key cache arg to bch2_assert_pos_locked()

this is an internal implementation detail - and we're improving key
cache coherency
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c30402e5
...@@ -325,7 +325,7 @@ static int bch2_btree_iter_verify_ret(struct btree_iter *iter, struct bkey_s_c k ...@@ -325,7 +325,7 @@ static int bch2_btree_iter_verify_ret(struct btree_iter *iter, struct bkey_s_c k
} }
void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id, void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id,
struct bpos pos, bool key_cache) struct bpos pos)
{ {
bch2_trans_verify_not_unlocked(trans); bch2_trans_verify_not_unlocked(trans);
...@@ -336,19 +336,12 @@ void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id, ...@@ -336,19 +336,12 @@ void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id,
btree_trans_sort_paths(trans); btree_trans_sort_paths(trans);
trans_for_each_path_inorder(trans, path, iter) { trans_for_each_path_inorder(trans, path, iter) {
int cmp = cmp_int(path->btree_id, id) ?: if (path->btree_id != id ||
cmp_int(path->cached, key_cache); !btree_node_locked(path, 0) ||
if (cmp > 0)
break;
if (cmp < 0)
continue;
if (!btree_node_locked(path, 0) ||
!path->should_be_locked) !path->should_be_locked)
continue; continue;
if (!key_cache) { if (!path->cached) {
if (bkey_ge(pos, path->l[0].b->data->min_key) && if (bkey_ge(pos, path->l[0].b->data->min_key) &&
bkey_le(pos, path->l[0].b->key.k.p)) bkey_le(pos, path->l[0].b->key.k.p))
return; return;
...@@ -361,9 +354,7 @@ void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id, ...@@ -361,9 +354,7 @@ void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id,
bch2_dump_trans_paths_updates(trans); bch2_dump_trans_paths_updates(trans);
bch2_bpos_to_text(&buf, pos); bch2_bpos_to_text(&buf, pos);
panic("not locked: %s %s%s\n", panic("not locked: %s %s\n", bch2_btree_id_str(id), buf.buf);
bch2_btree_id_str(id), buf.buf,
key_cache ? " cached" : "");
} }
#else #else
...@@ -1482,6 +1473,14 @@ static void bch2_btree_path_to_text_short(struct printbuf *out, struct btree_tra ...@@ -1482,6 +1473,14 @@ static void bch2_btree_path_to_text_short(struct printbuf *out, struct btree_tra
path->level); path->level);
bch2_bpos_to_text(out, path->pos); bch2_bpos_to_text(out, path->pos);
if (!path->cached && btree_node_locked(path, path->level)) {
prt_char(out, ' ');
struct btree *b = path_l(path)->b;
bch2_bpos_to_text(out, b->data->min_key);
prt_char(out, '-');
bch2_bpos_to_text(out, b->key.k.p);
}
#ifdef TRACK_PATH_ALLOCATED #ifdef TRACK_PATH_ALLOCATED
prt_printf(out, " %pS", (void *) path->ip_allocated); prt_printf(out, " %pS", (void *) path->ip_allocated);
#endif #endif
......
...@@ -268,12 +268,11 @@ static inline int bch2_trans_mutex_lock(struct btree_trans *trans, struct mutex ...@@ -268,12 +268,11 @@ static inline int bch2_trans_mutex_lock(struct btree_trans *trans, struct mutex
#ifdef CONFIG_BCACHEFS_DEBUG #ifdef CONFIG_BCACHEFS_DEBUG
void bch2_trans_verify_paths(struct btree_trans *); void bch2_trans_verify_paths(struct btree_trans *);
void bch2_assert_pos_locked(struct btree_trans *, enum btree_id, void bch2_assert_pos_locked(struct btree_trans *, enum btree_id, struct bpos);
struct bpos, bool);
#else #else
static inline void bch2_trans_verify_paths(struct btree_trans *trans) {} static inline void bch2_trans_verify_paths(struct btree_trans *trans) {}
static inline void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id, static inline void bch2_assert_pos_locked(struct btree_trans *trans, enum btree_id id,
struct bpos pos, bool key_cache) {} struct bpos pos) {}
#endif #endif
void bch2_btree_path_fix_key_modified(struct btree_trans *trans, void bch2_btree_path_fix_key_modified(struct btree_trans *trans,
......
...@@ -58,9 +58,7 @@ void bch2_inode_update_after_write(struct btree_trans *trans, ...@@ -58,9 +58,7 @@ void bch2_inode_update_after_write(struct btree_trans *trans,
BUG_ON(bi->bi_inum != inode->v.i_ino); BUG_ON(bi->bi_inum != inode->v.i_ino);
bch2_assert_pos_locked(trans, BTREE_ID_inodes, bch2_assert_pos_locked(trans, BTREE_ID_inodes, POS(0, bi->bi_inum));
POS(0, bi->bi_inum),
c->opts.inodes_use_key_cache);
set_nlink(&inode->v, bch2_inode_nlink_get(bi)); set_nlink(&inode->v, bch2_inode_nlink_get(bi));
i_uid_write(&inode->v, bi->bi_uid); i_uid_write(&inode->v, bi->bi_uid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment