summaryrefslogtreecommitdiff
path: root/fs/bcachefs/disk_accounting.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/disk_accounting.c')
-rw-r--r--fs/bcachefs/disk_accounting.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/bcachefs/disk_accounting.c b/fs/bcachefs/disk_accounting.c
index 9da26e11446b..b20ea162bfa3 100644
--- a/fs/bcachefs/disk_accounting.c
+++ b/fs/bcachefs/disk_accounting.c
@@ -817,6 +817,8 @@ int bch2_accounting_read(struct bch_fs *c)
struct journal_keys *keys = &c->journal_keys;
struct journal_key *jk = keys->data;
+ move_gap(keys, keys->nr);
+
while (jk < &darray_top(*keys) &&
__journal_key_cmp(c, BTREE_ID_accounting, 0, POS_MIN, jk) > 0)
jk++;
@@ -832,9 +834,6 @@ int bch2_accounting_read(struct bch_fs *c)
iter.flags &= ~BTREE_ITER_with_journal;
int ret = for_each_btree_key_continue(trans, iter,
BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k, ({
- struct bkey u;
- struct bkey_s_c k = bch2_btree_path_peek_slot_exact(btree_iter_path(trans, &iter), &u);
-
if (k.k->type != KEY_TYPE_accounting)
continue;
@@ -863,7 +862,7 @@ int bch2_accounting_read(struct bch_fs *c)
struct disk_accounting_pos next_acc;
memset(&next_acc, 0, sizeof(next_acc));
next_acc.type = acc_k.type + 1;
- struct bpos next = disk_accounting_pos_to_bpos(&next_acc);
+ struct bpos next = bpos_predecessor(disk_accounting_pos_to_bpos(&next_acc));
if (jk < end)
next = bpos_min(next, journal_key_k(c, jk)->k.p);