@@ -1740,6 +1740,10 @@ btree_path_idx_t bch2_path_get(struct btree_trans *trans,
1740
1740
1741
1741
btree_trans_sort_paths (trans );
1742
1742
1743
+ if (intent )
1744
+ locks_want = max (locks_want , level + 1 );
1745
+ locks_want = min (locks_want , BTREE_MAX_DEPTH );
1746
+
1743
1747
trans_for_each_path_inorder (trans , path , iter ) {
1744
1748
if (__btree_path_cmp (path ,
1745
1749
btree_id ,
@@ -1754,7 +1758,8 @@ btree_path_idx_t bch2_path_get(struct btree_trans *trans,
1754
1758
if (path_pos &&
1755
1759
trans -> paths [path_pos ].cached == cached &&
1756
1760
trans -> paths [path_pos ].btree_id == btree_id &&
1757
- trans -> paths [path_pos ].level == level ) {
1761
+ trans -> paths [path_pos ].level == level &&
1762
+ bch2_btree_path_upgrade_norestart (trans , trans -> paths + path_pos , locks_want )) {
1758
1763
trace_btree_path_get (trans , trans -> paths + path_pos , & pos );
1759
1764
1760
1765
__btree_path_get (trans , trans -> paths + path_pos , intent );
@@ -1786,9 +1791,6 @@ btree_path_idx_t bch2_path_get(struct btree_trans *trans,
1786
1791
if (!(flags & BTREE_ITER_nopreserve ))
1787
1792
path -> preserve = true;
1788
1793
1789
- if (path -> intent_ref )
1790
- locks_want = max (locks_want , level + 1 );
1791
-
1792
1794
/*
1793
1795
* If the path has locks_want greater than requested, we don't downgrade
1794
1796
* it here - on transaction restart because btree node split needs to
@@ -1797,10 +1799,6 @@ btree_path_idx_t bch2_path_get(struct btree_trans *trans,
1797
1799
* a successful transaction commit.
1798
1800
*/
1799
1801
1800
- locks_want = min (locks_want , BTREE_MAX_DEPTH );
1801
- if (locks_want > path -> locks_want )
1802
- bch2_btree_path_upgrade_norestart (trans , path , locks_want );
1803
-
1804
1802
return path_idx ;
1805
1803
}
1806
1804
0 commit comments