summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-11-15 23:02:13 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:17 +0300
commitc714614bd06cc422f56c02475adf03dc618bf385 (patch)
tree82e12f009dd33d431d66dd19ee3195c8457d4e3e /fs/bcachefs/super-io.c
parent0a84a066f9a1455ce703850ac5918270d7a4019d (diff)
downloadlinux-c714614bd06cc422f56c02475adf03dc618bf385.tar.xz
bcachefs: Disk space accounting fix on brand-new fs
The filesystem initialization path first marks superblock and journal buckets non transactionally, since the btree isn't functional yet. That path was updating the per-journal-buf percpu counters via bch2_dev_usage_update(), and updating the wrong set of counters so those updates didn't get written out until journal entry 4. The relevant code is going to get significantly rewritten in the future as we transition away from the in memory bucket array, so this just hacks around it for now. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r--fs/bcachefs/super-io.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index 637408d76270..3cc5d8ea743f 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -447,8 +447,16 @@ int bch2_sb_to_fs(struct bch_fs *c, struct bch_sb *src)
if (BCH_SB_HAS_ERRORS(c->disk_sb.sb))
set_bit(BCH_FS_ERROR, &c->flags);
+ else
+ clear_bit(BCH_FS_ERROR, &c->flags);
+
if (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb))
set_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags);
+ else
+ clear_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags);
+
+ if (BCH_SB_INITIALIZED(c->disk_sb.sb))
+ set_bit(BCH_FS_INITIALIZED, &c->flags);
ret = bch2_sb_replicas_to_cpu_replicas(c);
if (ret)