diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-01-25 03:09:49 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:15 +0300 |
commit | 42b72e0ba226fa15dda0fb9e9f1646a1ae5d03fd (patch) | |
tree | 4b773c6655146a5d8040fcd771411b92151efa1c /fs/bcachefs/replicas.c | |
parent | 3ccc5c50f29fb6934fb71e12983f1f2beabe29b9 (diff) | |
download | linux-42b72e0ba226fa15dda0fb9e9f1646a1ae5d03fd.tar.xz |
bcachefs: journal_replay_early()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/replicas.c')
-rw-r--r-- | fs/bcachefs/replicas.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c index 8495cac29a14..52a422ac5ace 100644 --- a/fs/bcachefs/replicas.c +++ b/fs/bcachefs/replicas.c @@ -530,6 +530,34 @@ int bch2_replicas_gc_start(struct bch_fs *c, unsigned typemask) return 0; } +int bch2_replicas_set_usage(struct bch_fs *c, + struct bch_replicas_entry *r, + u64 sectors) +{ + int ret, idx = bch2_replicas_entry_idx(c, r); + + if (idx < 0) { + struct bch_replicas_cpu n; + + n = cpu_replicas_add_entry(&c->replicas, r); + if (!n.entries) + return -ENOMEM; + + ret = replicas_table_update(c, &n); + if (ret) + return ret; + + kfree(n.entries); + + idx = bch2_replicas_entry_idx(c, r); + BUG_ON(ret < 0); + } + + percpu_u64_set(&c->usage[0]->data[idx], sectors); + + return 0; +} + /* Replicas tracking - superblock: */ static int |