]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_types.h
Update bcachefs sources to d82da7126f fixup! bcachefs: for_each_btree_key2()
[bcachefs-tools-debian] / libbcachefs / btree_types.h
index a1c0441940a56e48414ebfbf5a38d20a951b9ffb..be12c9ff7ea3cf7d823d8a6dff0ce162892c6d23 100644 (file)
@@ -301,6 +301,11 @@ struct btree_iter {
 #endif
 };
 
+struct btree_key_cache_freelist {
+       struct bkey_cached      *objs[16];
+       unsigned                nr;
+};
+
 struct btree_key_cache {
        struct mutex            lock;
        struct rhashtable       table;
@@ -308,8 +313,9 @@ struct btree_key_cache {
        struct list_head        freed;
        struct shrinker         shrink;
        unsigned                shrink_iter;
+       struct btree_key_cache_freelist __percpu *pcpu_freed;
 
-       size_t                  nr_freed;
+       atomic_long_t           nr_freed;
        atomic_long_t           nr_keys;
        atomic_long_t           nr_dirty;
 };
@@ -348,6 +354,7 @@ struct btree_insert_entry {
        bool                    cached:1;
        bool                    insert_trigger_run:1;
        bool                    overwrite_trigger_run:1;
+       bool                    key_cache_already_flushed:1;
        /*
         * @old_k may be a key from the journal; @old_btree_u64s always refers
         * to the size of the key being overwritten in the btree:
@@ -375,19 +382,22 @@ struct btree_trans_commit_hook {
        struct btree_trans_commit_hook  *next;
 };
 
-#define BTREE_TRANS_MEM_MAX    (1U << 14)
+#define BTREE_TRANS_MEM_MAX    (1U << 16)
+
+#define BTREE_TRANS_MAX_LOCK_HOLD_TIME_NS      10000
 
 struct btree_trans {
        struct bch_fs           *c;
        const char              *fn;
        struct list_head        list;
+       u64                     last_begin_time;
        struct btree            *locking;
        unsigned                locking_path_idx;
        struct bpos             locking_pos;
        u8                      locking_btree_id;
        u8                      locking_level;
        u8                      locking_lock_type;
-       pid_t                   pid;
+       struct task_struct      *task;
        int                     srcu_idx;
 
        u8                      nr_sorted;
@@ -637,6 +647,11 @@ static inline bool btree_type_has_snapshots(enum btree_id id)
        return (1 << id) & BTREE_ID_HAS_SNAPSHOTS;
 }
 
+static inline bool btree_type_has_ptrs(enum btree_id id)
+{
+       return (1 << id) & BTREE_ID_HAS_PTRS;
+}
+
 static inline bool btree_node_type_needs_gc(enum btree_node_type type)
 {
        return BTREE_NODE_TYPE_HAS_TRIGGERS & (1U << type);