summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_cache.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-14 22:24:41 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:19 +0300
commit8244f3209b5b49a6bde9921d7825af9f57161b23 (patch)
tree344a619bee4976ff0983bf0bb6bba7b81e532a71 /fs/bcachefs/btree_cache.h
parentd05117e36a7290cbfa8ebcc05c6facb60a5bcefb (diff)
downloadlinux-8244f3209b5b49a6bde9921d7825af9f57161b23.tar.xz
bcachefs: Option improvements
This adds flags for options that must be a power of two (block size and btree node size), and options that are stored in the superblock as a power of two (encoded extent max). Also: options are now stored in memory in the same units they're displayed in (bytes): we now convert when getting and setting from the superblock. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_cache.h')
-rw-r--r--fs/bcachefs/btree_cache.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h
index 2f6e0ea87616..a08d12569075 100644
--- a/fs/bcachefs/btree_cache.h
+++ b/fs/bcachefs/btree_cache.h
@@ -69,7 +69,7 @@ static inline bool btree_node_hashed(struct btree *b)
static inline size_t btree_bytes(struct bch_fs *c)
{
- return c->opts.btree_node_size << 9;
+ return c->opts.btree_node_size;
}
static inline size_t btree_max_u64s(struct bch_fs *c)
@@ -84,7 +84,7 @@ static inline size_t btree_pages(struct bch_fs *c)
static inline unsigned btree_blocks(struct bch_fs *c)
{
- return c->opts.btree_node_size >> c->block_bits;
+ return btree_sectors(c) >> c->block_bits;
}
#define BTREE_SPLIT_THRESHOLD(c) (btree_max_u64s(c) * 2 / 3)