summaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-02-09 19:20:57 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:15 -0400
commit3577df5f7f25f6669c4b53e76cf159d550a0fd83 (patch)
tree03bbca1bf2983e2ff5e571b14fa7454d8b53c003 /fs/bcachefs/recovery.c
parent3e0745e28363c1675a05775425312c049d5857b3 (diff)
downloadlwn-3577df5f7f25f6669c4b53e76cf159d550a0fd83.tar.gz
lwn-3577df5f7f25f6669c4b53e76cf159d550a0fd83.zip
bcachefs: serialize persistent_reserved
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r--fs/bcachefs/recovery.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index a9b8d565c82f..31d2bce7bb57 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -75,23 +75,32 @@ static int journal_replay_entry_early(struct bch_fs *c,
struct jset_entry_usage *u =
container_of(entry, struct jset_entry_usage, entry);
- switch (u->type) {
- case FS_USAGE_REPLICAS:
- ret = bch2_replicas_set_usage(c, &u->r,
- le64_to_cpu(u->sectors));
+ switch (entry->btree_id) {
+ case FS_USAGE_RESERVED:
+ if (entry->level < BCH_REPLICAS_MAX)
+ percpu_u64_set(&c->usage[0]->
+ persistent_reserved[entry->level],
+ le64_to_cpu(u->v));
break;
case FS_USAGE_INODES:
percpu_u64_set(&c->usage[0]->s.nr_inodes,
- le64_to_cpu(u->sectors));
+ le64_to_cpu(u->v));
break;
case FS_USAGE_KEY_VERSION:
atomic64_set(&c->key_version,
- le64_to_cpu(u->sectors));
+ le64_to_cpu(u->v));
break;
}
break;
}
+ case BCH_JSET_ENTRY_data_usage: {
+ struct jset_entry_data_usage *u =
+ container_of(entry, struct jset_entry_data_usage, entry);
+ ret = bch2_replicas_set_usage(c, &u->r,
+ le64_to_cpu(u->v));
+ break;
+ }
}
return ret;
@@ -156,7 +165,8 @@ static bool journal_empty(struct list_head *journal)
list_for_each_entry(i, journal, list) {
vstruct_for_each(&i->j, entry) {
if (entry->type == BCH_JSET_ENTRY_btree_root ||
- entry->type == BCH_JSET_ENTRY_usage)
+ entry->type == BCH_JSET_ENTRY_usage ||
+ entry->type == BCH_JSET_ENTRY_data_usage)
continue;
if (entry->type == BCH_JSET_ENTRY_btree_keys &&