bcachefs: bch2_btree_node_to_text() const correctness
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 6 Mar 2023 07:34:59 +0000 (02:34 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:56 +0000 (17:09 -0400)
This is for the Rust interface - Rust cares more about const than C
does.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bset.c
fs/bcachefs/bset.h
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_cache.h

index a7cb12ea2a04227e1920061123f8557e202af6b0..a4c06e856c2e67c0cb1202443712fba11d735a07 100644 (file)
@@ -1533,9 +1533,9 @@ struct bkey_s_c bch2_btree_node_iter_peek_unpack(struct btree_node_iter *iter,
 
 /* Mergesort */
 
-void bch2_btree_keys_stats(struct btree *b, struct bset_stats *stats)
+void bch2_btree_keys_stats(const struct btree *b, struct bset_stats *stats)
 {
-       struct bset_tree *t;
+       const struct bset_tree *t;
 
        for_each_bset(b, t) {
                enum bset_aux_tree_type type = bset_aux_tree_type(t);
index 2105e7836557c854c12070f309f5116b8562eaf7..632c2b8c54609b4be37f11e18868e4c41dcb736b 100644 (file)
@@ -213,7 +213,7 @@ static inline size_t btree_aux_data_u64s(const struct btree *b)
             _k != btree_bkey_last(_b, _t);                             \
             _k = bkey_p_next(_k))
 
-static inline bool bset_has_ro_aux_tree(struct bset_tree *t)
+static inline bool bset_has_ro_aux_tree(const struct bset_tree *t)
 {
        return bset_aux_tree_type(t) == BSET_RO_AUX_TREE;
 }
@@ -504,7 +504,7 @@ struct bset_stats {
        size_t failed;
 };
 
-void bch2_btree_keys_stats(struct btree *, struct bset_stats *);
+void bch2_btree_keys_stats(const struct btree *, struct bset_stats *);
 void bch2_bfloat_to_text(struct printbuf *, struct btree *,
                         struct bkey_packed *);
 
index 9b331c319accf174ccd97cbc66806321d937f2a9..6218a00ccb27dc5107ae807c1874e7e0c4e0a831 100644 (file)
@@ -1150,7 +1150,7 @@ wait_on_io:
 }
 
 void bch2_btree_node_to_text(struct printbuf *out, struct bch_fs *c,
-                            struct btree *b)
+                            const struct btree *b)
 {
        const struct bkey_format *f = &b->format;
        struct bset_stats stats;
@@ -1195,7 +1195,7 @@ void bch2_btree_node_to_text(struct printbuf *out, struct bch_fs *c,
               stats.failed);
 }
 
-void bch2_btree_cache_to_text(struct printbuf *out, struct bch_fs *c)
+void bch2_btree_cache_to_text(struct printbuf *out, const struct bch_fs *c)
 {
        prt_printf(out, "nr nodes:\t\t%u\n", c->btree_cache.used);
        prt_printf(out, "nr dirty:\t\t%u\n", atomic_read(&c->btree_cache.dirty));
index 56ea27340771262a7dbd9bc43bc708e548afd1e8..ea375ae25a708af1725b3ae2bc2e647b5500649d 100644 (file)
@@ -100,7 +100,7 @@ static inline unsigned btree_blocks(struct bch_fs *c)
 #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 *);
-void bch2_btree_cache_to_text(struct printbuf *, struct bch_fs *);
+                            const struct btree *);
+void bch2_btree_cache_to_text(struct printbuf *, const struct bch_fs *);
 
 #endif /* _BCACHEFS_BTREE_CACHE_H */