replicas.c (ed8269cc1d4107985aa92ade34cd3fe71315dd6a) replicas.c (9620c3ec2fa83e18f52e99b3dd2e8451446ca17e)
1// SPDX-License-Identifier: GPL-2.0
2
3#include "bcachefs.h"
4#include "buckets.h"
5#include "journal.h"
6#include "replicas.h"
7#include "super-io.h"
8

--- 1019 unchanged lines hidden (view full) ---

1028 if (e->devs[i] == ca->dev_idx)
1029 ret |= 1 << e->data_type;
1030
1031 percpu_up_read(&c->mark_lock);
1032
1033 return ret;
1034}
1035
1// SPDX-License-Identifier: GPL-2.0
2
3#include "bcachefs.h"
4#include "buckets.h"
5#include "journal.h"
6#include "replicas.h"
7#include "super-io.h"
8

--- 1019 unchanged lines hidden (view full) ---

1028 if (e->devs[i] == ca->dev_idx)
1029 ret |= 1 << e->data_type;
1030
1031 percpu_up_read(&c->mark_lock);
1032
1033 return ret;
1034}
1035
1036void bch2_fs_replicas_exit(struct bch_fs *c)
1037{
1038 unsigned i;
1039
1040 kfree(c->usage_scratch);
1041 for (i = 0; i < ARRAY_SIZE(c->usage); i++)
1042 free_percpu(c->usage[i]);
1043 kfree(c->usage_base);
1044 kfree(c->replicas.entries);
1045 kfree(c->replicas_gc.entries);
1046
1047 mempool_exit(&c->replicas_delta_pool);
1048}
1049
1036int bch2_fs_replicas_init(struct bch_fs *c)
1037{
1038 bch2_journal_entry_res_resize(&c->journal,
1039 &c->replicas_journal_res,
1040 reserve_journal_replicas(c, &c->replicas));
1041
1050int bch2_fs_replicas_init(struct bch_fs *c)
1051{
1052 bch2_journal_entry_res_resize(&c->journal,
1053 &c->replicas_journal_res,
1054 reserve_journal_replicas(c, &c->replicas));
1055
1042 return replicas_table_update(c, &c->replicas);
1056 return mempool_init_kmalloc_pool(&c->replicas_delta_pool, 1,
1057 REPLICAS_DELTA_LIST_MAX) ?:
1058 replicas_table_update(c, &c->replicas);
1043}
1059}