]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_cache.h
Add a subcommand for resizing the journal
[bcachefs-tools-debian] / libbcachefs / btree_cache.h
index 132cc95a4c0276b615797fae18a8325990054e3c..8a19e60e9258014816b6d5a8c4ac54e00587a7f2 100644 (file)
@@ -23,7 +23,7 @@ struct btree *bch2_btree_node_mem_alloc(struct bch_fs *);
 
 struct btree *bch2_btree_node_get(struct bch_fs *, struct btree_iter *,
                                  const struct bkey_i *, unsigned,
-                                 enum six_lock_type);
+                                 enum six_lock_type, unsigned long);
 
 struct btree *bch2_btree_node_get_noiter(struct bch_fs *, const struct bkey_i *,
                                         enum btree_id, unsigned);
@@ -79,14 +79,9 @@ static inline size_t btree_max_u64s(struct bch_fs *c)
        return (btree_bytes(c) - sizeof(struct btree_node)) / sizeof(u64);
 }
 
-static inline size_t btree_page_order(struct bch_fs *c)
-{
-       return get_order(btree_bytes(c));
-}
-
 static inline size_t btree_pages(struct bch_fs *c)
 {
-       return 1 << btree_page_order(c);
+       return btree_bytes(c) / PAGE_SIZE;
 }
 
 static inline unsigned btree_blocks(struct bch_fs *c)
@@ -94,14 +89,14 @@ static inline unsigned btree_blocks(struct bch_fs *c)
        return c->opts.btree_node_size >> c->block_bits;
 }
 
-#define BTREE_SPLIT_THRESHOLD(c)               (btree_max_u64s(c) * 3 / 4)
+#define BTREE_SPLIT_THRESHOLD(c)               (btree_max_u64s(c) * 2 / 3)
 
 #define BTREE_FOREGROUND_MERGE_THRESHOLD(c)    (btree_max_u64s(c) * 1 / 3)
 #define BTREE_FOREGROUND_MERGE_HYSTERESIS(c)                   \
        (BTREE_FOREGROUND_MERGE_THRESHOLD(c) +                  \
         (BTREE_FOREGROUND_MERGE_THRESHOLD(c) << 2))
 
-#define btree_node_root(_c, _b)        ((_c)->btree_roots[(_b)->btree_id].b)
+#define btree_node_root(_c, _b)        ((_c)->btree_roots[(_b)->c.btree_id].b)
 
 void bch2_btree_node_to_text(struct printbuf *, struct bch_fs *,
                             struct btree *);