diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-04-11 22:39:39 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:20 -0400 |
commit | d07343561e263fcbbdb8042f35ca29a602190e18 (patch) | |
tree | 5dbc1590f373699e01b1f319c072e14d6688d751 /fs/bcachefs/alloc_background.c | |
parent | 644d180b055fa47be7e6ca8b684f45e2350dfafd (diff) |
bcachefs: Deduplicate keys in the journal before replay
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r-- | fs/bcachefs/alloc_background.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index b3a8ff0b1daa..5c8cebc443d1 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -12,7 +12,7 @@ #include "debug.h" #include "ec.h" #include "error.h" -#include "journal_io.h" +#include "recovery.h" #include "trace.h" #include <linux/kthread.h> @@ -261,13 +261,13 @@ static void bch2_alloc_read_key(struct bch_fs *c, struct bkey_s_c k) percpu_up_read(&c->mark_lock); } -int bch2_alloc_read(struct bch_fs *c, struct list_head *journal_replay_list) +int bch2_alloc_read(struct bch_fs *c, struct journal_keys *journal_keys) { - struct journal_replay *r; struct btree_trans trans; struct btree_iter *iter; struct bkey_s_c k; struct bch_dev *ca; + struct journal_key *j; unsigned i; int ret; @@ -282,14 +282,9 @@ int bch2_alloc_read(struct bch_fs *c, struct list_head *journal_replay_list) if (ret) return ret; - list_for_each_entry(r, journal_replay_list, list) { - struct bkey_i *k, *n; - struct jset_entry *entry; - - for_each_jset_key(k, n, entry, &r->j) - if (entry->btree_id == BTREE_ID_ALLOC) - bch2_alloc_read_key(c, bkey_i_to_s_c(k)); - } + for_each_journal_key(*journal_keys, j) + if (j->btree_id == BTREE_ID_ALLOC) + bch2_alloc_read_key(c, bkey_i_to_s_c(j->k)); percpu_down_write(&c->mark_lock); bch2_dev_usage_from_buckets(c); |