summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-06 02:34:59 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:56 -0400
commita345b0f393da49be9d1110ec9e43066191f0e466 (patch)
tree99812fedf4a08078ccfaaa054fc8bc16c0d23558
parent26bab33b6974d42f5db6d2b7c2198e3af4993cf8 (diff)
bcachefs: bch2_btree_node_to_text() const correctness
This is for the Rust interface - Rust cares more about const than C does. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/bset.c4
-rw-r--r--fs/bcachefs/bset.h4
-rw-r--r--fs/bcachefs/btree_cache.c4
-rw-r--r--fs/bcachefs/btree_cache.h4
4 files changed, 8 insertions, 8 deletions
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c
index a7cb12ea2a04..a4c06e856c2e 100644
--- a/fs/bcachefs/bset.c
+++ b/fs/bcachefs/bset.c
@@ -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);
diff --git a/fs/bcachefs/bset.h b/fs/bcachefs/bset.h
index 2105e7836557..632c2b8c5460 100644
--- a/fs/bcachefs/bset.h
+++ b/fs/bcachefs/bset.h
@@ -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 *);
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 9b331c319acc..6218a00ccb27 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -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));
diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h
index 56ea27340771..ea375ae25a70 100644
--- a/fs/bcachefs/btree_cache.h
+++ b/fs/bcachefs/btree_cache.h
@@ -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 */