bcachefs: Kill BTREE_ITER_CACHED_(NOFILL|NOCREATE)
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 11 Aug 2022 16:23:21 +0000 (12:23 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:38 +0000 (17:09 -0400)
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>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_key_cache.c
fs/bcachefs/btree_types.h

index 7049077d47bca566f533cb114203163865e34b5d..bd6e35fcbdbdebaaf2e08eb6d8adfad20448aa9a 100644 (file)
@@ -2016,11 +2016,7 @@ inline struct bkey_s_c bch2_btree_path_peek_slot(struct btree_path *path, struct
                EBUG_ON(ck &&
                        (path->btree_id != ck->key.btree_id ||
                         bkey_cmp(path->pos, ck->key.pos)));
-
-               /* BTREE_ITER_CACHED_NOFILL|BTREE_ITER_CACHED_NOCREATE? */
-               if (unlikely(!ck || !ck->valid))
-                       return bkey_s_c_null;
-
+               EBUG_ON(!ck || !ck->valid);
                EBUG_ON(path->uptodate != BTREE_ITER_UPTODATE);
 
                *u = ck->k->k;
index 6e3d988f21129d82f28253210f6fdf8b018df464..f0055f17381d615a9c9bf7da876b48e90f51d6fd 100644 (file)
@@ -372,11 +372,6 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path
 retry:
        ck = bch2_btree_key_cache_find(c, path->btree_id, path->pos);
        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);
                ret = PTR_ERR_OR_ZERO(ck);
                if (ret)
@@ -412,7 +407,7 @@ retry:
        path->l[0].lock_seq     = ck->c.lock.state.seq;
        path->l[0].b            = (void *) ck;
 fill:
-       if (!ck->valid && !(flags & BTREE_ITER_CACHED_NOFILL)) {
+       if (!ck->valid) {
                /*
                 * Using the underscore version because we haven't set
                 * path->uptodate yet:
@@ -433,6 +428,7 @@ fill:
                set_bit(BKEY_CACHED_ACCESSED, &ck->flags);
 
        path->uptodate = BTREE_ITER_UPTODATE;
+       BUG_ON(!ck->valid);
        BUG_ON(btree_node_locked_type(path, 0) != btree_lock_want(path, 0));
 
        return ret;
@@ -462,8 +458,6 @@ static int btree_key_cache_flush_pos(struct btree_trans *trans,
                             BTREE_ITER_ALL_SNAPSHOTS);
        bch2_trans_iter_init(trans, &c_iter, key.btree_id, key.pos,
                             BTREE_ITER_CACHED|
-                            BTREE_ITER_CACHED_NOFILL|
-                            BTREE_ITER_CACHED_NOCREATE|
                             BTREE_ITER_INTENT);
        b_iter.flags &= ~BTREE_ITER_WITH_KEY_CACHE;
 
index edeaf843cd3f569898ca9cf110090e87d96dbbd1..a8917596d777a66fda912c7c8f6d852611fc4228 100644 (file)
@@ -199,15 +199,13 @@ struct btree_node_iter {
 #define BTREE_ITER_IS_EXTENTS          (1 << 4)
 #define BTREE_ITER_NOT_EXTENTS         (1 << 5)
 #define BTREE_ITER_CACHED              (1 << 6)
-#define BTREE_ITER_CACHED_NOFILL       (1 << 7)
-#define BTREE_ITER_CACHED_NOCREATE     (1 << 8)
-#define BTREE_ITER_WITH_KEY_CACHE      (1 << 9)
-#define BTREE_ITER_WITH_UPDATES                (1 << 10)
-#define BTREE_ITER_WITH_JOURNAL                (1 << 11)
-#define __BTREE_ITER_ALL_SNAPSHOTS     (1 << 12)
-#define BTREE_ITER_ALL_SNAPSHOTS       (1 << 13)
-#define BTREE_ITER_FILTER_SNAPSHOTS    (1 << 14)
-#define BTREE_ITER_NOPRESERVE          (1 << 15)
+#define BTREE_ITER_WITH_KEY_CACHE      (1 << 7)
+#define BTREE_ITER_WITH_UPDATES                (1 << 8)
+#define BTREE_ITER_WITH_JOURNAL                (1 << 9)
+#define __BTREE_ITER_ALL_SNAPSHOTS     (1 << 10)
+#define BTREE_ITER_ALL_SNAPSHOTS       (1 << 11)
+#define BTREE_ITER_FILTER_SNAPSHOTS    (1 << 12)
+#define BTREE_ITER_NOPRESERVE          (1 << 13)
 
 enum btree_path_uptodate {
        BTREE_ITER_UPTODATE             = 0,