diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-19 23:56:26 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-03 20:44:18 +0200 |
commit | bdbf953b3c9036e284e28c9484dda5c81b2a45fa (patch) | |
tree | 246f3dc2f6b0363c7d7f3d7c255e07a65d7b1fac /fs/bcachefs/btree_journal_iter.c | |
parent | bcachefs: Clear recovery_passes_required as they complete without errors (diff) | |
download | linux-bdbf953b3c9036e284e28c9484dda5c81b2a45fa.tar.xz linux-bdbf953b3c9036e284e28c9484dda5c81b2a45fa.zip |
bcachefs: bch2_shoot_down_journal_keys()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_journal_iter.c')
-rw-r--r-- | fs/bcachefs/btree_journal_iter.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_journal_iter.c b/fs/bcachefs/btree_journal_iter.c index 1f588264575d..5cbcbfe85235 100644 --- a/fs/bcachefs/btree_journal_iter.c +++ b/fs/bcachefs/btree_journal_iter.c @@ -567,3 +567,22 @@ int bch2_journal_keys_sort(struct bch_fs *c) bch_verbose(c, "Journal keys: %zu read, %zu after sorting and compacting", nr_read, keys->nr); return 0; } + +void bch2_shoot_down_journal_keys(struct bch_fs *c, enum btree_id btree, + unsigned level_min, unsigned level_max, + struct bpos start, struct bpos end) +{ + struct journal_keys *keys = &c->journal_keys; + size_t dst = 0; + + move_gap(keys, keys->nr); + + darray_for_each(*keys, i) + if (!(i->btree_id == btree && + i->level >= level_min && + i->level <= level_max && + bpos_ge(i->k->k.p, start) && + bpos_le(i->k->k.p, end))) + keys->data[dst++] = *i; + keys->nr = keys->gap = dst; +} |