diff options
| author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-29 15:48:45 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:28 -0400 |
| commit | 91d961badfd123b6759488bc4aa7a4d014b739f1 (patch) | |
| tree | 19fb86f1322c9ecde80fbbc6b48860f814b8612b /fs/bcachefs/move.c | |
| parent | bcachefs: Fix BTREE_TRIGGER_WANTS_OLD_AND_NEW (diff) | |
| download | linux-91d961badfd123b6759488bc4aa7a4d014b739f1.tar.gz linux-91d961badfd123b6759488bc4aa7a4d014b739f1.zip | |
bcachefs: darrays
Inspired by CCAN darray - simple, stupid resizable (dynamic) arrays.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/move.c')
| -rw-r--r-- | fs/bcachefs/move.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 2eb192da8e1d..b916ee35ee37 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -91,10 +91,10 @@ next: if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, old_pos.snapshot)) { struct bkey_i *update; - size_t i; + u32 *i; - for (i = 0; i < s.nr; i++) - if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, s.d[i])) + darray_for_each(s.ids, i) + if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, *i)) goto next; update = bch2_trans_kmalloc(trans, sizeof(struct bkey_i)); @@ -124,7 +124,7 @@ next: } } bch2_trans_iter_exit(trans, &iter); - kfree(s.d); + darray_exit(&s.ids); return ret; } |
