bcachefs: bch2_bucket_ref_update()

If we hit an inconsistency when updating allocation information, we
don't want to fail the update if it's for a deletion - only if it's for
a new key.

Rename check_bucket_ref() -> bucket_ref_update() so we can centralize
the logic to do this.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2024-04-19 19:03:58 -04:00
parent 9cc455d1bc
commit 70e3e039cf
3 changed files with 42 additions and 33 deletions

View File

@ -243,13 +243,13 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
}
}
ret = bch2_check_bucket_ref(trans, s.s_c, ptr, sectors, data_type,
bucket_gen, *bucket_data_type,
*bucket_dirty_sectors);
if (ret)
goto err;
*bucket_dirty_sectors += sectors;
if (sectors) {
ret = bch2_bucket_ref_update(trans, s.s_c, ptr, sectors, data_type,
bucket_gen, *bucket_data_type,
bucket_dirty_sectors);
if (ret)
goto err;
}
if (!deleting) {
*bucket_stripe = s.k->p.offset;