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
12795a19
Commit
12795a19
authored
Feb 10, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Add some logging for btree node rewrites due to errors
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
637de729
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
fs/bcachefs/btree_io.c
fs/bcachefs/btree_io.c
+9
-1
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+20
-3
No files found.
fs/bcachefs/btree_io.c
View file @
12795a19
...
...
@@ -1240,8 +1240,16 @@ static void btree_node_read_work(struct work_struct *work)
bio_put
(
&
rb
->
bio
);
printbuf_exit
(
&
buf
);
if
(
saw_error
&&
!
btree_node_read_error
(
b
))
if
(
saw_error
&&
!
btree_node_read_error
(
b
))
{
struct
printbuf
buf
=
PRINTBUF
;
bch2_bpos_to_text
(
&
buf
,
b
->
key
.
k
.
p
);
bch_info
(
c
,
"%s: rewriting btree node at btree=%s level=%u %s due to error"
,
__func__
,
bch2_btree_ids
[
b
->
c
.
btree_id
],
b
->
c
.
level
,
buf
.
buf
);
printbuf_exit
(
&
buf
);
bch2_btree_node_rewrite_async
(
c
,
b
);
}
clear_btree_node_read_in_flight
(
b
);
wake_up_bit
(
&
b
->
flags
,
BTREE_NODE_read_in_flight
);
...
...
fs/bcachefs/btree_update_interior.c
View file @
12795a19
...
...
@@ -2007,6 +2007,7 @@ struct async_btree_rewrite {
static
int
async_btree_node_rewrite_trans
(
struct
btree_trans
*
trans
,
struct
async_btree_rewrite
*
a
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_iter
iter
;
struct
btree
*
b
;
int
ret
;
...
...
@@ -2018,8 +2019,18 @@ static int async_btree_node_rewrite_trans(struct btree_trans *trans,
if
(
ret
)
goto
out
;
if
(
!
b
||
b
->
data
->
keys
.
seq
!=
a
->
seq
)
if
(
!
b
||
b
->
data
->
keys
.
seq
!=
a
->
seq
)
{
struct
printbuf
buf
=
PRINTBUF
;
if
(
b
)
bch2_bkey_val_to_text
(
&
buf
,
c
,
bkey_i_to_s_c
(
&
b
->
key
));
else
prt_str
(
&
buf
,
"(null"
);
bch_info
(
c
,
"%s: node to rewrite not found:, searching for seq %llu, got
\n
%s"
,
__func__
,
a
->
seq
,
buf
.
buf
);
printbuf_exit
(
&
buf
);
goto
out
;
}
ret
=
bch2_btree_node_rewrite
(
trans
,
&
iter
,
b
,
0
);
out:
...
...
@@ -2033,9 +2044,12 @@ void async_btree_node_rewrite_work(struct work_struct *work)
struct
async_btree_rewrite
*
a
=
container_of
(
work
,
struct
async_btree_rewrite
,
work
);
struct
bch_fs
*
c
=
a
->
c
;
int
ret
;
bch2_trans_do
(
c
,
NULL
,
NULL
,
0
,
ret
=
bch2_trans_do
(
c
,
NULL
,
NULL
,
0
,
async_btree_node_rewrite_trans
(
&
trans
,
a
));
if
(
ret
)
bch_err
(
c
,
"%s: error %s"
,
__func__
,
bch2_err_str
(
ret
));
bch2_write_ref_put
(
c
,
BCH_WRITE_REF_node_rewrite
);
kfree
(
a
);
}
...
...
@@ -2044,12 +2058,15 @@ void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b)
{
struct
async_btree_rewrite
*
a
;
if
(
!
bch2_write_ref_tryget
(
c
,
BCH_WRITE_REF_node_rewrite
))
if
(
!
bch2_write_ref_tryget
(
c
,
BCH_WRITE_REF_node_rewrite
))
{
bch_err
(
c
,
"%s: error getting c->writes ref"
,
__func__
);
return
;
}
a
=
kmalloc
(
sizeof
(
*
a
),
GFP_NOFS
);
if
(
!
a
)
{
bch2_write_ref_put
(
c
,
BCH_WRITE_REF_node_rewrite
);
bch_err
(
c
,
"%s: error allocating memory"
,
__func__
);
return
;
}
...
...
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