mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-26 02:25:00 -05:00
bcachefs: Fixes for usrdata/metadata drop paths
These paths weren't updated for btree_path and snapshots - a couple of minor fixes. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
d697b9abba
commit
56767d66e8
1 changed files with 12 additions and 9 deletions
|
@ -51,7 +51,8 @@ static int __bch2_dev_usrdata_drop(struct bch_fs *c, unsigned dev_idx, int flags
|
|||
BTREE_ITER_PREFETCH|
|
||||
BTREE_ITER_ALL_SNAPSHOTS);
|
||||
|
||||
while ((k = bch2_btree_iter_peek(&iter)).k &&
|
||||
while ((bch2_trans_begin(&trans),
|
||||
(k = bch2_btree_iter_peek(&iter)).k) &&
|
||||
!(ret = bkey_err(k))) {
|
||||
if (!bch2_bkey_has_device(k, dev_idx)) {
|
||||
bch2_btree_iter_advance(&iter);
|
||||
|
@ -72,8 +73,6 @@ static int __bch2_dev_usrdata_drop(struct bch_fs *c, unsigned dev_idx, int flags
|
|||
*/
|
||||
bch2_extent_normalize(c, bkey_i_to_s(sk.k));
|
||||
|
||||
bch2_btree_iter_set_pos(&iter, bkey_start_pos(&sk.k->k));
|
||||
|
||||
ret = bch2_btree_iter_traverse(&iter) ?:
|
||||
bch2_trans_update(&trans, &iter, sk.k,
|
||||
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE) ?:
|
||||
|
@ -125,12 +124,14 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags)
|
|||
closure_init_stack(&cl);
|
||||
|
||||
for (id = 0; id < BTREE_ID_NR; id++) {
|
||||
for_each_btree_node(&trans, iter, id, POS_MIN,
|
||||
BTREE_ITER_PREFETCH, b) {
|
||||
retry:
|
||||
bch2_trans_node_iter_init(&trans, &iter, id, POS_MIN, 0, 0,
|
||||
BTREE_ITER_PREFETCH);
|
||||
|
||||
while (bch2_trans_begin(&trans),
|
||||
(b = bch2_btree_iter_peek_node(&iter))) {
|
||||
if (!bch2_bkey_has_device(bkey_i_to_s_c(&b->key),
|
||||
dev_idx))
|
||||
continue;
|
||||
goto next;
|
||||
|
||||
bch2_bkey_buf_copy(&k, c, &b->key);
|
||||
|
||||
|
@ -143,14 +144,16 @@ retry:
|
|||
|
||||
ret = bch2_btree_node_update_key(&trans, &iter, b, k.k, false);
|
||||
if (ret == -EINTR) {
|
||||
b = bch2_btree_iter_peek_node(&iter);
|
||||
ret = 0;
|
||||
goto retry;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
bch_err(c, "Error updating btree node key: %i", ret);
|
||||
break;
|
||||
}
|
||||
next:
|
||||
bch2_btree_iter_next_node(&iter);
|
||||
}
|
||||
bch2_trans_iter_exit(&trans, &iter);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue