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
ba665494
Commit
ba665494
authored
Apr 06, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: gc_btree_init_recurse() uses gc_mark_node()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
d1adfe4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
42 deletions
+22
-42
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+22
-42
No files found.
fs/bcachefs/btree_gc.c
View file @
ba665494
...
...
@@ -866,8 +866,7 @@ static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id,
static
int
btree_gc_mark_node
(
struct
btree_trans
*
trans
,
struct
btree
*
b
,
bool
initial
)
{
struct
btree_node_iter
iter
;
struct
bkey
unpacked
;
struct
btree_and_journal_iter
iter
;
struct
bkey_s_c
k
;
int
ret
=
0
;
...
...
@@ -875,18 +874,18 @@ static int btree_gc_mark_node(struct btree_trans *trans, struct btree *b, bool i
if
(
ret
)
return
ret
;
bch2_btree_
node_iter_init_from_start
(
&
iter
,
b
);
bch2_btree_
and_journal_iter_init_node_iter
(
trans
,
&
iter
,
b
);
while
((
k
=
bch2_btree_node_iter_peek_unpack
(
&
iter
,
b
,
&
unpacked
)).
k
)
{
ret
=
bch2_gc_mark_key
(
trans
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
false
,
&
k
,
initial
);
while
((
k
=
bch2_btree_and_journal_iter_peek
(
&
iter
)).
k
)
{
ret
=
bch2_gc_mark_key
(
trans
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
false
,
&
k
,
initial
);
if
(
ret
)
return
ret
;
break
;
bch2_btree_
node_iter_advance
(
&
iter
,
b
);
bch2_btree_
and_journal_iter_advance
(
&
iter
);
}
return
0
;
bch2_btree_and_journal_iter_exit
(
&
iter
);
return
ret
;
}
static
int
bch2_gc_btree
(
struct
btree_trans
*
trans
,
enum
btree_id
btree_id
,
...
...
@@ -932,44 +931,26 @@ static int bch2_gc_btree(struct btree_trans *trans, enum btree_id btree_id,
static
int
bch2_gc_btree_init_recurse
(
struct
btree_trans
*
trans
,
struct
btree
*
b
,
unsigned
target_depth
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_and_journal_iter
iter
;
struct
bkey_s_c
k
;
struct
bkey_buf
cur
;
struct
printbuf
buf
=
PRINTBUF
;
int
ret
=
0
;
ret
=
bch2_btree_node_check_topology
(
trans
,
b
);
int
ret
=
btree_gc_mark_node
(
trans
,
b
,
true
);
if
(
ret
)
return
ret
;
bch2_btree_and_journal_iter_init_node_iter
(
trans
,
&
iter
,
b
);
bch2_bkey_buf_init
(
&
cur
);
while
((
k
=
bch2_btree_and_journal_iter_peek
(
&
iter
)).
k
)
{
BUG_ON
(
bpos_lt
(
k
.
k
->
p
,
b
->
data
->
min_key
));
BUG_ON
(
bpos_gt
(
k
.
k
->
p
,
b
->
data
->
max_key
));
ret
=
bch2_gc_mark_key
(
trans
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
false
,
&
k
,
true
);
if
(
ret
)
goto
fsck_err
;
bch2_btree_and_journal_iter_advance
(
&
iter
);
}
if
(
b
->
c
.
level
>
target_depth
)
{
bch2_btree_and_journal_iter_exit
(
&
iter
);
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_and_journal_iter
iter
;
struct
bkey_s_c
k
;
struct
bkey_buf
cur
;
bch2_bkey_buf_init
(
&
cur
);
bch2_btree_and_journal_iter_init_node_iter
(
trans
,
&
iter
,
b
);
iter
.
prefetch
=
true
;
while
((
k
=
bch2_btree_and_journal_iter_peek
(
&
iter
)).
k
)
{
struct
btree
*
child
;
bch2_bkey_buf_reassemble
(
&
cur
,
c
,
k
);
bch2_btree_and_journal_iter_advance
(
&
iter
);
child
=
bch2_btree_node_get_noiter
(
trans
,
cur
.
k
,
struct
btree
*
child
=
bch2_btree_node_get_noiter
(
trans
,
cur
.
k
,
b
->
c
.
btree_id
,
b
->
c
.
level
-
1
,
false
);
ret
=
PTR_ERR_OR_ZERO
(
child
);
...
...
@@ -977,18 +958,17 @@ static int bch2_gc_btree_init_recurse(struct btree_trans *trans, struct btree *b
if
(
ret
)
break
;
ret
=
bch2_gc_btree_init_recurse
(
trans
,
child
,
target_depth
);
ret
=
bch2_gc_btree_init_recurse
(
trans
,
child
,
target_depth
);
six_unlock_read
(
&
child
->
c
.
lock
);
if
(
ret
)
break
;
}
bch2_bkey_buf_exit
(
&
cur
,
c
);
bch2_btree_and_journal_iter_exit
(
&
iter
);
}
fsck_err:
bch2_bkey_buf_exit
(
&
cur
,
c
);
bch2_btree_and_journal_iter_exit
(
&
iter
);
printbuf_exit
(
&
buf
);
return
ret
;
}
...
...
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