]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_locking.h
Update bcachefs sources to 7bf1ac0d46 bcachefs: Correctly initialize new buckets...
[bcachefs-tools-debian] / libbcachefs / btree_locking.h
index 0ad8fd44aba7a79985f002b5bf6b3ca3c502cb52..6231e9ffc5d7497b693febe166e64560a6f024c9 100644 (file)
@@ -10,9 +10,8 @@
  * updating the iterator state
  */
 
-#include <linux/six.h>
-
 #include "btree_iter.h"
+#include "six.h"
 
 void bch2_btree_lock_init(struct btree_bkey_cached_common *, enum six_lock_init_flags);
 
@@ -92,9 +91,9 @@ static inline void mark_btree_node_unlocked(struct btree_path *path,
 static inline void mark_btree_node_locked(struct btree_trans *trans,
                                          struct btree_path *path,
                                          unsigned level,
-                                         enum six_lock_type type)
+                                         enum btree_node_locked_type type)
 {
-       mark_btree_node_locked_noreset(path, level, type);
+       mark_btree_node_locked_noreset(path, level, (enum btree_node_locked_type) type);
 #ifdef CONFIG_BCACHEFS_LOCK_TIME_STATS
        path->l[level].lock_taken_time = local_clock();
 #endif
@@ -181,7 +180,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat
        EBUG_ON(path->l[b->c.level].lock_seq != six_lock_seq(&b->c.lock));
        EBUG_ON(btree_node_locked_type(path, b->c.level) != SIX_LOCK_write);
 
-       mark_btree_node_locked_noreset(path, b->c.level, SIX_LOCK_intent);
+       mark_btree_node_locked_noreset(path, b->c.level, BTREE_NODE_INTENT_LOCKED);
 
        trans_for_each_path_with_node(trans, b, linked)
                linked->l[b->c.level].lock_seq++;
@@ -247,7 +246,7 @@ static inline bool btree_node_lock_increment(struct btree_trans *trans,
        trans_for_each_path(trans, path)
                if (&path->l[level].b->c == b &&
                    btree_node_locked_type(path, level) >= want) {
-                       six_lock_increment(&b->lock, want);
+                       six_lock_increment(&b->lock, (enum six_lock_type) want);
                        return true;
                }
 
@@ -267,7 +266,7 @@ static inline int btree_node_lock(struct btree_trans *trans,
        EBUG_ON(!(trans->paths_allocated & (1ULL << path->idx)));
 
        if (likely(six_trylock_type(&b->lock, type)) ||
-           btree_node_lock_increment(trans, b, level, type) ||
+           btree_node_lock_increment(trans, b, level, (enum btree_node_locked_type) type) ||
            !(ret = btree_node_lock_nopath(trans, b, type, btree_path_ip_allocated(path)))) {
 #ifdef CONFIG_BCACHEFS_LOCK_TIME_STATS
                path->l[b->level].lock_taken_time = local_clock();
@@ -294,7 +293,7 @@ static inline int __btree_node_lock_write(struct btree_trans *trans,
         * write lock: thus, we need to tell the cycle detector we have a write
         * lock _before_ taking the lock:
         */
-       mark_btree_node_locked_noreset(path, b->level, SIX_LOCK_write);
+       mark_btree_node_locked_noreset(path, b->level, BTREE_NODE_WRITE_LOCKED);
 
        return likely(six_trylock_write(&b->lock))
                ? 0