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
5ab4beb7
Commit
5ab4beb7
authored
Apr 09, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Don't scan for btree nodes when we can reconstruct
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
359571c3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
18 deletions
+29
-18
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_format.h
+14
-0
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+8
-3
fs/bcachefs/btree_node_scan.c
fs/bcachefs/btree_node_scan.c
+7
-1
fs/bcachefs/recovery.c
fs/bcachefs/recovery.c
+0
-14
No files found.
fs/bcachefs/bcachefs_format.h
View file @
5ab4beb7
...
...
@@ -1535,6 +1535,20 @@ enum btree_id {
BTREE_ID_NR
};
static
inline
bool
btree_id_is_alloc
(
enum
btree_id
id
)
{
switch
(
id
)
{
case
BTREE_ID_alloc
:
case
BTREE_ID_backpointers
:
case
BTREE_ID_need_discard
:
case
BTREE_ID_freespace
:
case
BTREE_ID_bucket_gens
:
return
true
;
default:
return
false
;
}
}
#define BTREE_MAX_DEPTH 4U
/* Btree nodes */
...
...
fs/bcachefs/btree_gc.c
View file @
5ab4beb7
...
...
@@ -368,11 +368,16 @@ static int bch2_btree_repair_topology_recurse(struct btree_trans *trans, struct
buf
.
buf
))
{
bch2_btree_node_evict
(
trans
,
cur_k
.
k
);
cur
=
NULL
;
ret
=
bch2_run_explicit_recovery_pass
(
c
,
BCH_RECOVERY_PASS_scan_for_btree_nodes
)
?:
bch2_journal_key_delete
(
c
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
cur_k
.
k
->
k
.
p
);
ret
=
bch2_journal_key_delete
(
c
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
cur_k
.
k
->
k
.
p
);
if
(
ret
)
break
;
if
(
!
btree_id_is_alloc
(
b
->
c
.
btree_id
))
{
ret
=
bch2_run_explicit_recovery_pass
(
c
,
BCH_RECOVERY_PASS_scan_for_btree_nodes
);
if
(
ret
)
break
;
}
continue
;
}
...
...
fs/bcachefs/btree_node_scan.c
View file @
5ab4beb7
...
...
@@ -133,6 +133,9 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca,
if
(
le64_to_cpu
(
bn
->
magic
)
!=
bset_magic
(
c
))
return
;
if
(
btree_id_is_alloc
(
BTREE_NODE_ID
(
bn
)))
return
;
rcu_read_lock
();
struct
found_btree_node
n
=
{
.
btree_id
=
BTREE_NODE_ID
(
bn
),
...
...
@@ -290,7 +293,7 @@ static int handle_overwrites(struct bch_fs *c,
found_btree_node_to_text
(
&
buf
,
c
,
n
);
bch_err
(
c
,
"%s"
,
buf
.
buf
);
printbuf_exit
(
&
buf
);
return
-
1
;
return
-
BCH_ERR_fsck_repair_unimplemented
;
}
}
...
...
@@ -436,6 +439,9 @@ bool bch2_btree_has_scanned_nodes(struct bch_fs *c, enum btree_id btree)
int
bch2_get_scanned_nodes
(
struct
bch_fs
*
c
,
enum
btree_id
btree
,
unsigned
level
,
struct
bpos
node_min
,
struct
bpos
node_max
)
{
if
(
btree_id_is_alloc
(
btree
))
return
0
;
struct
find_btree_nodes
*
f
=
&
c
->
found_btree_nodes
;
int
ret
=
bch2_run_explicit_recovery_pass
(
c
,
BCH_RECOVERY_PASS_scan_for_btree_nodes
);
...
...
fs/bcachefs/recovery.c
View file @
5ab4beb7
...
...
@@ -47,20 +47,6 @@ void bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree)
}
}
static
bool
btree_id_is_alloc
(
enum
btree_id
id
)
{
switch
(
id
)
{
case
BTREE_ID_alloc
:
case
BTREE_ID_backpointers
:
case
BTREE_ID_need_discard
:
case
BTREE_ID_freespace
:
case
BTREE_ID_bucket_gens
:
return
true
;
default:
return
false
;
}
}
/* for -o reconstruct_alloc: */
static
void
bch2_reconstruct_alloc
(
struct
bch_fs
*
c
)
{
...
...
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