]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Kill dead BTREE_INSERT flags
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 11 Nov 2023 21:20:58 +0000 (16:20 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:37 +0000 (11:47 -0500)
BTREE_INSERT_NOWAIT and BTREE_INSERT_GC_LOCK_HELD are no longer used,
and can be deleted.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_trans_commit.c
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update_interior.c

index 403b7310d21aa36b7a29f3ab7de40e02b6268b77..117ce5352242625c86343ce7ec8fc6f8823c6575 100644 (file)
@@ -982,7 +982,6 @@ int bch2_trans_commit_error(struct btree_trans *trans, unsigned flags,
        BUG_ON(bch2_err_matches(ret, BCH_ERR_transaction_restart) != !!trans->restarted);
 
        bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOSPC) &&
-                               !(flags & BTREE_INSERT_NOWAIT) &&
                                (flags & BTREE_INSERT_NOFAIL), c,
                "%s: incorrectly got %s\n", __func__, bch2_err_str(ret));
 
@@ -1040,9 +1039,6 @@ int __bch2_trans_commit(struct btree_trans *trans, unsigned flags)
            !trans->extra_journal_entries.nr)
                goto out_reset;
 
-       if (flags & BTREE_INSERT_GC_LOCK_HELD)
-               lockdep_assert_held(&c->gc_lock);
-
        ret = bch2_trans_commit_run_triggers(trans);
        if (ret)
                goto out_reset;
index 9816d22865403043c6caa819b3f249a2e10ea6fa..a67105c1e5f7ec855860a7e6456361dd0e87d07a 100644 (file)
@@ -28,8 +28,6 @@ enum btree_insert_flags {
        __BTREE_INSERT_LAZY_RW,
        __BTREE_INSERT_JOURNAL_REPLAY,
        __BTREE_INSERT_JOURNAL_RECLAIM,
-       __BTREE_INSERT_NOWAIT,
-       __BTREE_INSERT_GC_LOCK_HELD,
        __BCH_HASH_SET_MUST_CREATE,
        __BCH_HASH_SET_MUST_REPLACE,
 };
@@ -46,10 +44,6 @@ enum btree_insert_flags {
 /* Insert is being called from journal reclaim path: */
 #define BTREE_INSERT_JOURNAL_RECLAIM   BIT(__BTREE_INSERT_JOURNAL_RECLAIM)
 
-/* Don't block on allocation failure (for new btree nodes: */
-#define BTREE_INSERT_NOWAIT            BIT(__BTREE_INSERT_NOWAIT)
-#define BTREE_INSERT_GC_LOCK_HELD      BIT(__BTREE_INSERT_GC_LOCK_HELD)
-
 #define BCH_HASH_SET_MUST_CREATE       BIT(__BCH_HASH_SET_MUST_CREATE)
 #define BCH_HASH_SET_MUST_REPLACE      BIT(__BCH_HASH_SET_MUST_REPLACE)
 
index 6482c07ae479c3dc2d2569e48fb3966e79e6e05d..ae09cc00c19a3bb2cee003c8eac3042e2214e892 100644 (file)
@@ -476,9 +476,6 @@ static int bch2_btree_reserve_get(struct btree_trans *trans,
        /*
         * Protects reaping from the btree node cache and using the btree node
         * open bucket reserve:
-        *
-        * BTREE_INSERT_NOWAIT only applies to btree node allocation, not
-        * blocking on this lock:
         */
        ret = bch2_btree_cache_cannibalize_lock(c, cl);
        if (ret)
@@ -488,9 +485,8 @@ static int bch2_btree_reserve_get(struct btree_trans *trans,
                struct prealloc_nodes *p = as->prealloc_nodes + interior;
 
                while (p->nr < nr_nodes[interior]) {
-                       b = __bch2_btree_node_alloc(trans, &as->disk_res,
-                                       flags & BTREE_INSERT_NOWAIT ? NULL : cl,
-                                       interior, flags);
+                       b = __bch2_btree_node_alloc(trans, &as->disk_res, cl,
+                                                   interior, flags);
                        if (IS_ERR(b)) {
                                ret = PTR_ERR(b);
                                goto err;
@@ -1109,9 +1105,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
                split = path->l[update_level].b->nr.live_u64s > BTREE_SPLIT_THRESHOLD(c);
        }
 
-       if (flags & BTREE_INSERT_GC_LOCK_HELD)
-               lockdep_assert_held(&c->gc_lock);
-       else if (!down_read_trylock(&c->gc_lock)) {
+       if (!down_read_trylock(&c->gc_lock)) {
                ret = drop_locks_do(trans, (down_read(&c->gc_lock), 0));
                if (ret) {
                        up_read(&c->gc_lock);
@@ -1125,7 +1119,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
        as->c           = c;
        as->start_time  = start_time;
        as->mode        = BTREE_INTERIOR_NO_UPDATE;
-       as->took_gc_lock = !(flags & BTREE_INSERT_GC_LOCK_HELD);
+       as->took_gc_lock = true;
        as->btree_id    = path->btree_id;
        as->update_level = update_level;
        INIT_LIST_HEAD(&as->list);