bcachefs: Fix bch2_dev_remove_alloc()
It was missing a lockrestart_do(), to call bch2_trans_begin() and also handle transaction restarts. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
committed by
Kent Overstreet
parent
97996ddfdb
commit
a9cb0a6706
@ -1458,15 +1458,18 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)
|
|||||||
bch2_trans_init(&trans, c, 0, 0);
|
bch2_trans_init(&trans, c, 0, 0);
|
||||||
|
|
||||||
for (i = 0; i < ca->mi.nbuckets; i++) {
|
for (i = 0; i < ca->mi.nbuckets; i++) {
|
||||||
ret = bch2_btree_key_cache_flush(&trans,
|
ret = lockrestart_do(&trans,
|
||||||
BTREE_ID_alloc, POS(ca->dev_idx, i));
|
bch2_btree_key_cache_flush(&trans,
|
||||||
|
BTREE_ID_alloc, POS(ca->dev_idx, i)));
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bch2_trans_exit(&trans);
|
bch2_trans_exit(&trans);
|
||||||
|
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
bch_err(c, "error %i removing dev alloc info", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return bch2_btree_delete_range(c, BTREE_ID_alloc,
|
return bch2_btree_delete_range(c, BTREE_ID_alloc,
|
||||||
POS(ca->dev_idx, 0),
|
POS(ca->dev_idx, 0),
|
||||||
|
Reference in New Issue
Block a user