]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_locking.h
Update upstream source from tag 'v1.6.3'
[bcachefs-tools-debian] / libbcachefs / btree_locking.h
index a49f1dd1d223613c5f9c59b28a6a53f1410a5143..f2e2c5881b7e4bd2551018708d7bcadee1d53083 100644 (file)
@@ -122,12 +122,9 @@ static void btree_trans_lock_hold_time_update(struct btree_trans *trans,
                                              struct btree_path *path, unsigned level)
 {
 #ifdef CONFIG_BCACHEFS_LOCK_TIME_STATS
-       struct btree_transaction_stats *s = btree_trans_stats(trans);
-
-       if (s)
-               __bch2_time_stats_update(&s->lock_hold_times,
-                                        path->l[level].lock_taken_time,
-                                        local_clock());
+       __time_stats_update(&btree_trans_stats(trans)->lock_hold_times,
+                                path->l[level].lock_taken_time,
+                                local_clock());
 #endif
 }
 
@@ -175,6 +172,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat
                                     struct btree *b)
 {
        struct btree_path *linked;
+       unsigned i;
 
        EBUG_ON(path->l[b->c.level].b != b);
        EBUG_ON(path->l[b->c.level].lock_seq != six_lock_seq(&b->c.lock));
@@ -182,7 +180,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat
 
        mark_btree_node_locked_noreset(path, b->c.level, BTREE_NODE_INTENT_LOCKED);
 
-       trans_for_each_path_with_node(trans, b, linked)
+       trans_for_each_path_with_node(trans, b, linked, i)
                linked->l[b->c.level].lock_seq++;
 
        six_unlock_write(&b->c.lock);
@@ -242,8 +240,9 @@ static inline bool btree_node_lock_increment(struct btree_trans *trans,
                                             enum btree_node_locked_type want)
 {
        struct btree_path *path;
+       unsigned i;
 
-       trans_for_each_path(trans, path)
+       trans_for_each_path(trans, path, i)
                if (&path->l[level].b->c == b &&
                    btree_node_locked_type(path, level) >= want) {
                        six_lock_increment(&b->lock, (enum six_lock_type) want);
@@ -263,7 +262,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) ||
@@ -314,8 +312,7 @@ void bch2_btree_node_lock_write_nofail(struct btree_trans *,
 
 /* relock: */
 
-bool bch2_btree_path_relock_norestart(struct btree_trans *,
-                                     struct btree_path *, unsigned long);
+bool bch2_btree_path_relock_norestart(struct btree_trans *, struct btree_path *);
 int __bch2_btree_path_relock(struct btree_trans *,
                             struct btree_path *, unsigned long);
 
@@ -355,12 +352,6 @@ static inline bool bch2_btree_node_relock_notrace(struct btree_trans *trans,
 
 /* upgrade */
 
-
-struct get_locks_fail {
-       unsigned        l;
-       struct btree    *b;
-};
-
 bool bch2_btree_path_upgrade_noupgrade_sibs(struct btree_trans *,
                               struct btree_path *, unsigned,
                               struct get_locks_fail *);