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
665e8b32
Commit
665e8b32
authored
Apr 07, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: for_each_btree_key_continue()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
a21107ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
29 deletions
+20
-29
fs/bcachefs/backpointers.c
fs/bcachefs/backpointers.c
+5
-23
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+15
-6
No files found.
fs/bcachefs/backpointers.c
View file @
665e8b32
...
...
@@ -793,31 +793,13 @@ static int bch2_check_extents_to_backpointers_pass(struct btree_trans *trans,
while
(
level
>=
depth
)
{
struct
btree_iter
iter
;
bch2_trans_node_iter_init
(
trans
,
&
iter
,
btree_id
,
POS_MIN
,
0
,
level
,
bch2_trans_node_iter_init
(
trans
,
&
iter
,
btree_id
,
POS_MIN
,
0
,
level
,
BTREE_ITER_PREFETCH
);
while
(
1
)
{
bch2_trans_begin
(
trans
);
struct
bkey_s_c
k
=
bch2_btree_iter_peek
(
&
iter
);
if
(
!
k
.
k
)
break
;
ret
=
bkey_err
(
k
)
?:
check_extent_to_backpointers
(
trans
,
s
,
btree_id
,
level
,
k
)
?:
bch2_trans_commit
(
trans
,
NULL
,
NULL
,
BCH_TRANS_COMMIT_no_enospc
);
if
(
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
{
ret
=
0
;
continue
;
}
if
(
ret
)
break
;
if
(
bpos_eq
(
iter
.
pos
,
SPOS_MAX
))
break
;
bch2_btree_iter_advance
(
&
iter
);
}
bch2_trans_iter_exit
(
trans
,
&
iter
);
ret
=
for_each_btree_key_continue
(
trans
,
iter
,
0
,
k
,
({
check_extent_to_backpointers
(
trans
,
s
,
btree_id
,
level
,
k
)
?:
bch2_trans_commit
(
trans
,
NULL
,
NULL
,
BCH_TRANS_COMMIT_no_enospc
);
}));
if
(
ret
)
return
ret
;
...
...
fs/bcachefs/btree_iter.h
View file @
665e8b32
...
...
@@ -699,16 +699,12 @@ transaction_restart: \
_ret2 ?: trans_was_restarted(_trans, _restart_count); \
})
#define for_each_btree_key_upto
(_trans, _iter, _btree_id,
\
_start,
_end, _flags, _k, _do) \
#define for_each_btree_key_upto
_continue(_trans, _iter,
\
_end, _flags, _k, _do) \
({ \
struct btree_iter _iter; \
struct bkey_s_c _k; \
int _ret3 = 0; \
\
bch2_trans_iter_init((_trans), &(_iter), (_btree_id), \
(_start), (_flags)); \
\
do { \
_ret3 = lockrestart_do(_trans, ({ \
(_k) = bch2_btree_iter_peek_upto_type(&(_iter), \
...
...
@@ -724,6 +720,19 @@ transaction_restart: \
_ret3; \
})
#define for_each_btree_key_continue(_trans, _iter, _flags, _k, _do) \
for_each_btree_key_upto_continue(_trans, _iter, SPOS_MAX, _flags, _k, _do)
#define for_each_btree_key_upto(_trans, _iter, _btree_id, \
_start, _end, _flags, _k, _do) \
({ \
struct btree_iter _iter; \
bch2_trans_iter_init((_trans), &(_iter), (_btree_id), \
(_start), (_flags)); \
\
for_each_btree_key_upto_continue(_trans, _iter, _end, _flags, _k, _do);\
})
#define for_each_btree_key(_trans, _iter, _btree_id, \
_start, _flags, _k, _do) \
for_each_btree_key_upto(_trans, _iter, _btree_id, _start, \
...
...
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