summaryrefslogtreecommitdiff
path: root/fs/bcachefs/data_update.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-14 09:34:48 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:35 +0300
commit597dee1cd67d591cd5aeba184fdb69d0da0ceb78 (patch)
tree9d922948f1e07843ec08d3b21aae2aeab83eb645 /fs/bcachefs/data_update.c
parent416cc426c0d79c65d85de52d3548a32de06ab3e8 (diff)
downloadlinux-597dee1cd67d591cd5aeba184fdb69d0da0ceb78.tar.xz
bcachefs: Switch data_update path to snapshot_id_list
snapshots_seen is becoming private to fsck, and snapshot_id_list is actually what the data update path needs. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/data_update.c')
-rw-r--r--fs/bcachefs/data_update.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c
index f7bce89f84ed..6726bd6b9b07 100644
--- a/fs/bcachefs/data_update.c
+++ b/fs/bcachefs/data_update.c
@@ -22,13 +22,13 @@ static int insert_snapshot_whiteouts(struct btree_trans *trans,
struct bch_fs *c = trans->c;
struct btree_iter iter, update_iter;
struct bkey_s_c k;
- struct snapshots_seen s;
+ snapshot_id_list s;
int ret;
if (!btree_type_has_snapshots(id))
return 0;
- snapshots_seen_init(&s);
+ darray_init(&s);
if (!bkey_cmp(old_pos, new_pos))
return 0;
@@ -40,7 +40,6 @@ static int insert_snapshot_whiteouts(struct btree_trans *trans,
BTREE_ITER_NOT_EXTENTS|
BTREE_ITER_ALL_SNAPSHOTS);
while (1) {
-next:
k = bch2_btree_iter_prev(&iter);
ret = bkey_err(k);
if (ret)
@@ -51,11 +50,9 @@ next:
if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, old_pos.snapshot)) {
struct bkey_i *update;
- u32 *i;
- darray_for_each(s.ids, i)
- if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, *i))
- goto next;
+ if (snapshot_list_has_ancestor(c, &s, k.k->p.snapshot))
+ continue;
update = bch2_trans_kmalloc(trans, sizeof(struct bkey_i));
@@ -78,13 +75,13 @@ next:
if (ret)
break;
- ret = snapshots_seen_add(c, &s, k.k->p.snapshot);
+ ret = snapshot_list_add(c, &s, k.k->p.snapshot);
if (ret)
break;
}
}
bch2_trans_iter_exit(trans, &iter);
- darray_exit(&s.ids);
+ darray_exit(&s);
return ret;
}