]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_types.h
Update bcachefs sources to e48731a188 bcachefs: Fix BTREE_TRIGGER_WANTS_OLD_AND_NEW
[bcachefs-tools-debian] / libbcachefs / btree_types.h
index 9ae5c8d56b2a38187e9099e55b02e919794fad27..575635b5fa102187e27f81f36ac3e040d0b7ef67 100644 (file)
@@ -152,7 +152,8 @@ struct btree_cache {
        struct mutex            lock;
        struct list_head        live;
        struct list_head        freeable;
-       struct list_head        freed;
+       struct list_head        freed_pcpu;
+       struct list_head        freed_nonpcpu;
 
        /* Number of elements in live + freeable lists */
        unsigned                used;
@@ -343,12 +344,20 @@ struct btree_insert_entry {
        unsigned                flags;
        u8                      bkey_type;
        enum btree_id           btree_id:8;
-       u8                      level;
+       u8                      level:4;
        bool                    cached:1;
        bool                    insert_trigger_run:1;
        bool                    overwrite_trigger_run: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:
+        */
+       u8                      old_btree_u64s;
        struct bkey_i           *k;
        struct btree_path       *path;
+       /* key being overwritten: */
+       struct bkey             old_k;
+       const struct bch_val    *old_v;
        unsigned long           ip_allocated;
 };
 
@@ -383,11 +392,13 @@ struct btree_trans {
 
        u8                      nr_sorted;
        u8                      nr_updates;
+       u8                      traverse_all_idx;
        bool                    used_mempool:1;
        bool                    in_traverse_all:1;
        bool                    restarted:1;
        bool                    memory_allocation_failure:1;
        bool                    journal_transaction_names:1;
+       bool                    is_initial_gc:1;
        /*
         * For when bch2_trans_update notices we'll be splitting a compressed
         * extent:
@@ -420,7 +431,31 @@ struct btree_trans {
        struct replicas_delta_list *fs_usage_deltas;
 };
 
-#define BTREE_FLAG(flag)                                               \
+#define BTREE_FLAGS()                                                  \
+       x(read_in_flight)                                               \
+       x(read_error)                                                   \
+       x(dirty)                                                        \
+       x(need_write)                                                   \
+       x(write_blocked)                                                \
+       x(will_make_reachable)                                          \
+       x(noevict)                                                      \
+       x(write_idx)                                                    \
+       x(accessed)                                                     \
+       x(write_in_flight)                                              \
+       x(write_in_flight_inner)                                        \
+       x(just_written)                                                 \
+       x(dying)                                                        \
+       x(fake)                                                         \
+       x(need_rewrite)                                                 \
+       x(never_write)
+
+enum btree_flags {
+#define x(flag)        BTREE_NODE_##flag,
+       BTREE_FLAGS()
+#undef x
+};
+
+#define x(flag)                                                                \
 static inline bool btree_node_ ## flag(struct btree *b)                        \
 {      return test_bit(BTREE_NODE_ ## flag, &b->flags); }              \
                                                                        \
@@ -430,36 +465,8 @@ static inline void set_btree_node_ ## flag(struct btree *b)                \
 static inline void clear_btree_node_ ## flag(struct btree *b)          \
 {      clear_bit(BTREE_NODE_ ## flag, &b->flags); }
 
-enum btree_flags {
-       BTREE_NODE_read_in_flight,
-       BTREE_NODE_read_error,
-       BTREE_NODE_dirty,
-       BTREE_NODE_need_write,
-       BTREE_NODE_noevict,
-       BTREE_NODE_write_idx,
-       BTREE_NODE_accessed,
-       BTREE_NODE_write_in_flight,
-       BTREE_NODE_write_in_flight_inner,
-       BTREE_NODE_just_written,
-       BTREE_NODE_dying,
-       BTREE_NODE_fake,
-       BTREE_NODE_need_rewrite,
-       BTREE_NODE_never_write,
-};
-
-BTREE_FLAG(read_in_flight);
-BTREE_FLAG(read_error);
-BTREE_FLAG(need_write);
-BTREE_FLAG(noevict);
-BTREE_FLAG(write_idx);
-BTREE_FLAG(accessed);
-BTREE_FLAG(write_in_flight);
-BTREE_FLAG(write_in_flight_inner);
-BTREE_FLAG(just_written);
-BTREE_FLAG(dying);
-BTREE_FLAG(fake);
-BTREE_FLAG(need_rewrite);
-BTREE_FLAG(never_write);
+BTREE_FLAGS()
+#undef x
 
 static inline struct btree_write *btree_current_write(struct btree *b)
 {