]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_update_interior.h
Update bcachefs sources to fd381c355c bcachefs: Fix a null ptr deref in fsck check_ex...
[bcachefs-tools-debian] / libbcachefs / btree_update_interior.h
index 8cf59cee6e4e28461467f670dbad6b73f97c57f2..dcfd7ceacc5926da051a11d72b1bdc12ec59b106 100644 (file)
@@ -52,6 +52,7 @@ struct btree_update {
        unsigned                        took_gc_lock:1;
 
        enum btree_id                   btree_id;
+       unsigned                        update_level;
 
        struct disk_reservation         disk_res;
        struct journal_preres           journal_preres;
@@ -76,18 +77,20 @@ struct btree_update {
        struct journal_entry_pin        journal;
 
        /* Preallocated nodes we reserve when we start the update: */
-       struct btree                    *prealloc_nodes[BTREE_UPDATE_NODES_MAX];
-       unsigned                        nr_prealloc_nodes;
+       struct prealloc_nodes {
+               struct btree            *b[BTREE_UPDATE_NODES_MAX];
+               unsigned                nr;
+       }                               prealloc_nodes[2];
 
        /* Nodes being freed: */
        struct keylist                  old_keys;
        u64                             _old_keys[BTREE_UPDATE_NODES_MAX *
-                                                 BKEY_BTREE_PTR_VAL_U64s_MAX];
+                                                 BKEY_BTREE_PTR_U64s_MAX];
 
        /* Nodes being added: */
        struct keylist                  new_keys;
        u64                             _new_keys[BTREE_UPDATE_NODES_MAX *
-                                                 BKEY_BTREE_PTR_VAL_U64s_MAX];
+                                                 BKEY_BTREE_PTR_U64s_MAX];
 
        /* New nodes, that will be made reachable by this update: */
        struct btree                    *new_nodes[BTREE_UPDATE_NODES_MAX];
@@ -115,6 +118,7 @@ struct btree_update {
 };
 
 struct btree *__bch2_btree_node_alloc_replacement(struct btree_update *,
+                                                 struct btree_trans *,
                                                  struct btree *,
                                                  struct bkey_format);
 
@@ -278,6 +282,7 @@ static inline void push_whiteout(struct bch_fs *c, struct btree *b,
        struct bkey_packed k;
 
        BUG_ON(bch_btree_keys_u64s_remaining(c, b) < BKEY_U64s);
+       EBUG_ON(btree_node_just_written(b));
 
        if (!bkey_pack_pos(&k, pos, b)) {
                struct bkey *u = (void *) &k;
@@ -307,12 +312,15 @@ static inline bool bch2_btree_node_insert_fits(struct bch_fs *c,
 
 void bch2_btree_updates_to_text(struct printbuf *, struct bch_fs *);
 
-size_t bch2_btree_interior_updates_nr_pending(struct bch_fs *);
+bool bch2_btree_interior_updates_flush(struct bch_fs *);
 
-void bch2_journal_entries_to_btree_roots(struct bch_fs *, struct jset *);
+void bch2_journal_entry_to_btree_root(struct bch_fs *, struct jset_entry *);
 struct jset_entry *bch2_btree_roots_to_journal_entries(struct bch_fs *,
                                        struct jset_entry *, struct jset_entry *);
 
+void bch2_do_pending_node_rewrites(struct bch_fs *);
+void bch2_free_pending_node_rewrites(struct bch_fs *);
+
 void bch2_fs_btree_interior_update_exit(struct bch_fs *);
 int bch2_fs_btree_interior_update_init(struct bch_fs *);