summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-03 14:19:23 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-05-21 20:14:20 -0400
commit203852d9db68e14b50b119cbd123def7e7c9efd0 (patch)
tree19b6ba7e726991d29d127291fc9313363cc1645a /fs/bcachefs/super.c
parent576493133f26a172b8db4313448206d30750c9b2 (diff)
downloadlinux-next-203852d9db68e14b50b119cbd123def7e7c9efd0.tar.gz
linux-next-203852d9db68e14b50b119cbd123def7e7c9efd0.zip
bcachefs: BCH_FEATURE_no_alloc_info
If a filesystem is going to only be used read-only, and will be a deployable image, we can strip out alloc info for a substantial reduction in metadata size - around half, due to backpointers. Alloc info will be regenerated on first read-write mount. Remounting RW is disallowed for now, since we don't yet have check_allocations running in RW mode. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 60e632e22b98..6ab3e63ef139 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -443,6 +443,9 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
BUG_ON(!test_bit(BCH_FS_may_go_rw, &c->flags));
+ if (WARN_ON(c->sb.features & BIT_ULL(BCH_FEATURE_no_alloc_info)))
+ return -BCH_ERR_erofs_no_alloc_info;
+
if (test_bit(BCH_FS_initial_gc_unfixed, &c->flags)) {
bch_err(c, "cannot go rw, unfixed btree errors");
return -BCH_ERR_erofs_unfixed_errors;
@@ -535,6 +538,9 @@ int bch2_fs_read_write(struct bch_fs *c)
if (c->opts.nochanges)
return -BCH_ERR_erofs_nochanges;
+ if (c->sb.features & BIT_ULL(BCH_FEATURE_no_alloc_info))
+ return -BCH_ERR_erofs_no_alloc_info;
+
return __bch2_fs_read_write(c, false);
}