Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f0d2e9f2
Commit
f0d2e9f2
authored
Jul 07, 2022
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Add assertions for unexpected transaction restarts
Signed-off-by:
Kent Overstreet
<
kent.overstreet@gmail.com
>
parent
223b560e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+9
-3
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+2
-0
No files found.
fs/bcachefs/btree_iter.h
View file @
f0d2e9f2
...
...
@@ -427,13 +427,17 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
#define lockrestart_do(_trans, _do) \
({ \
u32 _restart_count; \
int _ret; \
\
do { \
bch2_trans_begin(_trans);
\
_restart_count = bch2_trans_begin(_trans);
\
_ret = (_do); \
} while (bch2_err_matches(_ret, BCH_ERR_transaction_restart)); \
\
if (!_ret) \
bch2_trans_verify_not_restarted(_trans, _restart_count);\
\
_ret; \
})
...
...
@@ -474,7 +478,7 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
(_start), (_flags)); \
\
while (1) { \
bch2_trans_begin(_trans);
\
u32 _restart_count = bch2_trans_begin(_trans);
\
(_k) = bch2_btree_iter_peek_type(&(_iter), (_flags)); \
if (!(_k).k) { \
_ret = 0; \
...
...
@@ -486,6 +490,7 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
continue; \
if (_ret) \
break; \
bch2_trans_verify_not_restarted(_trans, _restart_count);\
if (!bch2_btree_iter_advance(&(_iter))) \
break; \
} \
...
...
@@ -503,7 +508,7 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
(_start), (_flags)); \
\
while (1) { \
bch2_trans_begin(_trans);
\
u32 _restart_count = bch2_trans_begin(_trans);
\
(_k) = bch2_btree_iter_peek_prev_type(&(_iter), (_flags));\
if (!(_k).k) { \
_ret = 0; \
...
...
@@ -515,6 +520,7 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
continue; \
if (_ret) \
break; \
bch2_trans_verify_not_restarted(_trans, _restart_count);\
if (!bch2_btree_iter_rewind(&(_iter))) \
break; \
} \
...
...
fs/bcachefs/btree_update_interior.c
View file @
f0d2e9f2
...
...
@@ -969,6 +969,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
unsigned
update_level
=
level
;
int
journal_flags
=
flags
&
JOURNAL_WATERMARK_MASK
;
int
ret
=
0
;
u32
restart_count
=
trans
->
restart_count
;
BUG_ON
(
!
path
->
should_be_locked
);
...
...
@@ -1094,6 +1095,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
if
(
ret
)
goto
err
;
bch2_trans_verify_not_restarted
(
trans
,
restart_count
);
return
as
;
err:
bch2_btree_update_free
(
as
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment