diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-10-19 14:20:50 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:14 -0400 |
commit | d355c6f4f73060c8f3eba95b9ae72929669f7516 (patch) | |
tree | 0ab609144ad249bad0aa6087989f21070845db6c /fs/bcachefs/migrate.c | |
parent | dfc276df911cb7bf026482a9af7c30a60726daff (diff) | |
download | linux-stable-d355c6f4f73060c8f3eba95b9ae72929669f7516.tar.gz linux-stable-d355c6f4f73060c8f3eba95b9ae72929669f7516.tar.bz2 linux-stable-d355c6f4f73060c8f3eba95b9ae72929669f7516.zip |
bcachefs: for_each_btree_node() now returns errors directly
This changes for_each_btree_node() to work like for_each_btree_key(),
and to that end bch2_btree_iter_peek_node() and next_node() also return
error ptrs.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/migrate.c')
-rw-r--r-- | fs/bcachefs/migrate.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/bcachefs/migrate.c b/fs/bcachefs/migrate.c index 94d5d99ffd2a..111a41159eb2 100644 --- a/fs/bcachefs/migrate.c +++ b/fs/bcachefs/migrate.c @@ -135,9 +135,10 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags) for (id = 0; id < BTREE_ID_NR; id++) { bch2_trans_node_iter_init(&trans, &iter, id, POS_MIN, 0, 0, BTREE_ITER_PREFETCH); - +retry: while (bch2_trans_begin(&trans), - (b = bch2_btree_iter_peek_node(&iter))) { + (b = bch2_btree_iter_peek_node(&iter)) && + !(ret = PTR_ERR_OR_ZERO(b))) { if (!bch2_bkey_has_device(bkey_i_to_s_c(&b->key), dev_idx)) goto next; @@ -164,6 +165,9 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags) next: bch2_btree_iter_next_node(&iter); } + if (ret == -EINTR) + goto retry; + bch2_trans_iter_exit(&trans, &iter); if (ret) |