bcachefs: Kill BTREE_ITER_CACHED_(NOFILL|NOCREATE)

These were used more prior to getting rid of the in-memory bucket arrays
- they don't serve much purpose anymore, and deleting them lets us write
better assertions.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-08-11 12:23:21 -04:00 committed by Kent Overstreet
parent 9f96568c0a
commit 6fae65c112
3 changed files with 10 additions and 22 deletions

View File

@ -2016,11 +2016,7 @@ inline struct bkey_s_c bch2_btree_path_peek_slot(struct btree_path *path, struct
EBUG_ON(ck && EBUG_ON(ck &&
(path->btree_id != ck->key.btree_id || (path->btree_id != ck->key.btree_id ||
bkey_cmp(path->pos, ck->key.pos))); bkey_cmp(path->pos, ck->key.pos)));
EBUG_ON(!ck || !ck->valid);
/* BTREE_ITER_CACHED_NOFILL|BTREE_ITER_CACHED_NOCREATE? */
if (unlikely(!ck || !ck->valid))
return bkey_s_c_null;
EBUG_ON(path->uptodate != BTREE_ITER_UPTODATE); EBUG_ON(path->uptodate != BTREE_ITER_UPTODATE);
*u = ck->k->k; *u = ck->k->k;

View File

@ -372,11 +372,6 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path
retry: retry:
ck = bch2_btree_key_cache_find(c, path->btree_id, path->pos); ck = bch2_btree_key_cache_find(c, path->btree_id, path->pos);
if (!ck) { if (!ck) {
if (flags & BTREE_ITER_CACHED_NOCREATE) {
path->l[0].b = NULL;
return 0;
}
ck = btree_key_cache_create(c, path->btree_id, path->pos); ck = btree_key_cache_create(c, path->btree_id, path->pos);
ret = PTR_ERR_OR_ZERO(ck); ret = PTR_ERR_OR_ZERO(ck);
if (ret) if (ret)
@ -412,7 +407,7 @@ retry:
path->l[0].lock_seq = ck->c.lock.state.seq; path->l[0].lock_seq = ck->c.lock.state.seq;
path->l[0].b = (void *) ck; path->l[0].b = (void *) ck;
fill: fill:
if (!ck->valid && !(flags & BTREE_ITER_CACHED_NOFILL)) { if (!ck->valid) {
/* /*
* Using the underscore version because we haven't set * Using the underscore version because we haven't set
* path->uptodate yet: * path->uptodate yet:
@ -433,6 +428,7 @@ fill:
set_bit(BKEY_CACHED_ACCESSED, &ck->flags); set_bit(BKEY_CACHED_ACCESSED, &ck->flags);
path->uptodate = BTREE_ITER_UPTODATE; path->uptodate = BTREE_ITER_UPTODATE;
BUG_ON(!ck->valid);
BUG_ON(btree_node_locked_type(path, 0) != btree_lock_want(path, 0)); BUG_ON(btree_node_locked_type(path, 0) != btree_lock_want(path, 0));
return ret; return ret;
@ -462,8 +458,6 @@ static int btree_key_cache_flush_pos(struct btree_trans *trans,
BTREE_ITER_ALL_SNAPSHOTS); BTREE_ITER_ALL_SNAPSHOTS);
bch2_trans_iter_init(trans, &c_iter, key.btree_id, key.pos, bch2_trans_iter_init(trans, &c_iter, key.btree_id, key.pos,
BTREE_ITER_CACHED| BTREE_ITER_CACHED|
BTREE_ITER_CACHED_NOFILL|
BTREE_ITER_CACHED_NOCREATE|
BTREE_ITER_INTENT); BTREE_ITER_INTENT);
b_iter.flags &= ~BTREE_ITER_WITH_KEY_CACHE; b_iter.flags &= ~BTREE_ITER_WITH_KEY_CACHE;

View File

@ -199,15 +199,13 @@ struct btree_node_iter {
#define BTREE_ITER_IS_EXTENTS (1 << 4) #define BTREE_ITER_IS_EXTENTS (1 << 4)
#define BTREE_ITER_NOT_EXTENTS (1 << 5) #define BTREE_ITER_NOT_EXTENTS (1 << 5)
#define BTREE_ITER_CACHED (1 << 6) #define BTREE_ITER_CACHED (1 << 6)
#define BTREE_ITER_CACHED_NOFILL (1 << 7) #define BTREE_ITER_WITH_KEY_CACHE (1 << 7)
#define BTREE_ITER_CACHED_NOCREATE (1 << 8) #define BTREE_ITER_WITH_UPDATES (1 << 8)
#define BTREE_ITER_WITH_KEY_CACHE (1 << 9) #define BTREE_ITER_WITH_JOURNAL (1 << 9)
#define BTREE_ITER_WITH_UPDATES (1 << 10) #define __BTREE_ITER_ALL_SNAPSHOTS (1 << 10)
#define BTREE_ITER_WITH_JOURNAL (1 << 11) #define BTREE_ITER_ALL_SNAPSHOTS (1 << 11)
#define __BTREE_ITER_ALL_SNAPSHOTS (1 << 12) #define BTREE_ITER_FILTER_SNAPSHOTS (1 << 12)
#define BTREE_ITER_ALL_SNAPSHOTS (1 << 13) #define BTREE_ITER_NOPRESERVE (1 << 13)
#define BTREE_ITER_FILTER_SNAPSHOTS (1 << 14)
#define BTREE_ITER_NOPRESERVE (1 << 15)
enum btree_path_uptodate { enum btree_path_uptodate {
BTREE_ITER_UPTODATE = 0, BTREE_ITER_UPTODATE = 0,