diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-16 05:17:55 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:46 +0200 |
commit | 3bce13837395f1af2fd585ef6dd4b54d80c2d1fb (patch) | |
tree | 1b87bfd71fe17fccb204f281a87f3d07cda28b33 /fs/bcachefs/btree_iter.h | |
parent | bcachefs: Btree split improvement (diff) | |
download | linux-3bce13837395f1af2fd585ef6dd4b54d80c2d1fb.tar.xz linux-3bce13837395f1af2fd585ef6dd4b54d80c2d1fb.zip |
bcachefs: Fix for_each_btree_key2()
Previously, when we exited from the loop body with a break statement
_ret wouldn't have been assigned to yet, and we could spuriously return
a transaction restart error.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_iter.h')
-rw-r--r-- | fs/bcachefs/btree_iter.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index 635cf97f5692..1c60122c5ea5 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -490,11 +490,11 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans, \ while (1) { \ u32 _restart_count = bch2_trans_begin(_trans); \ + \ + _ret = 0; \ (_k) = bch2_btree_iter_peek_type(&(_iter), (_flags)); \ - if (!(_k).k) { \ - _ret = 0; \ + if (!(_k).k) \ break; \ - } \ \ _ret = bkey_err(_k) ?: (_do); \ if (bch2_err_matches(_ret, BCH_ERR_transaction_restart))\ |