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
d1adfe4e
Commit
d1adfe4e
authored
Apr 06, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: move root node topo checks to node_check_topology()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
b982d645
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
23 deletions
+19
-23
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+1
-23
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+18
-0
No files found.
fs/bcachefs/btree_gc.c
View file @
d1adfe4e
...
...
@@ -996,36 +996,16 @@ static int bch2_gc_btree_init(struct btree_trans *trans,
enum
btree_id
btree_id
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree
*
b
;
/*
* We need to make sure every leaf node is readable before going RW
unsigned target_depth = btree_node_type_needs_gc(__btree_node_type(0, btree_id)) ? 0 : 1;
*/
unsigned
target_depth
=
0
;
struct
printbuf
buf
=
PRINTBUF
;
int
ret
=
0
;
b
=
bch2_btree_id_root
(
c
,
btree_id
)
->
b
;
struct
btree
*
b
=
bch2_btree_id_root
(
c
,
btree_id
)
->
b
;
six_lock_read
(
&
b
->
c
.
lock
,
NULL
,
NULL
);
printbuf_reset
(
&
buf
);
bch2_bpos_to_text
(
&
buf
,
b
->
data
->
min_key
);
if
(
mustfix_fsck_err_on
(
!
bpos_eq
(
b
->
data
->
min_key
,
POS_MIN
),
c
,
btree_root_bad_min_key
,
"btree root with incorrect min_key: %s"
,
buf
.
buf
))
{
ret
=
bch2_run_explicit_recovery_pass
(
c
,
BCH_RECOVERY_PASS_check_topology
);
goto
fsck_err
;
}
printbuf_reset
(
&
buf
);
bch2_bpos_to_text
(
&
buf
,
b
->
data
->
max_key
);
if
(
mustfix_fsck_err_on
(
!
bpos_eq
(
b
->
data
->
max_key
,
SPOS_MAX
),
c
,
btree_root_bad_max_key
,
"btree root with incorrect max_key: %s"
,
buf
.
buf
))
{
ret
=
bch2_run_explicit_recovery_pass
(
c
,
BCH_RECOVERY_PASS_check_topology
);
goto
fsck_err
;
}
if
(
b
->
c
.
level
>=
target_depth
)
ret
=
bch2_gc_btree_init_recurse
(
trans
,
b
,
target_depth
);
...
...
@@ -1035,11 +1015,9 @@ static int bch2_gc_btree_init(struct btree_trans *trans,
ret
=
bch2_gc_mark_key
(
trans
,
b
->
c
.
btree_id
,
b
->
c
.
level
+
1
,
true
,
&
k
,
true
);
}
fsck_err:
six_unlock_read
(
&
b
->
c
.
lock
);
bch_err_fn
(
c
,
ret
);
printbuf_exit
(
&
buf
);
return
ret
;
}
...
...
fs/bcachefs/btree_update_interior.c
View file @
d1adfe4e
...
...
@@ -73,6 +73,24 @@ int bch2_btree_node_check_topology(struct btree_trans *trans, struct btree *b)
!
bpos_eq
(
bkey_i_to_btree_ptr_v2
(
&
b
->
key
)
->
v
.
min_key
,
b
->
data
->
min_key
));
if
(
b
==
btree_node_root
(
c
,
b
))
{
if
(
!
bpos_eq
(
b
->
data
->
min_key
,
POS_MIN
))
{
printbuf_reset
(
&
buf
);
bch2_bpos_to_text
(
&
buf
,
b
->
data
->
min_key
);
need_fsck_err
(
c
,
btree_root_bad_min_key
,
"btree root with incorrect min_key: %s"
,
buf
.
buf
);
goto
topology_repair
;
}
if
(
!
bpos_eq
(
b
->
data
->
max_key
,
SPOS_MAX
))
{
printbuf_reset
(
&
buf
);
bch2_bpos_to_text
(
&
buf
,
b
->
data
->
max_key
);
need_fsck_err
(
c
,
btree_root_bad_max_key
,
"btree root with incorrect max_key: %s"
,
buf
.
buf
);
goto
topology_repair
;
}
}
if
(
!
b
->
c
.
level
)
return
0
;
...
...
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