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
9c5d38bb
Commit
9c5d38bb
authored
Feb 16, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Don't print out duplicate fsck errors
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
2798143a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
fs/bcachefs/error.c
fs/bcachefs/error.c
+20
-10
fs/bcachefs/error.h
fs/bcachefs/error.h
+2
-1
No files found.
fs/bcachefs/error.c
View file @
9c5d38bb
...
...
@@ -98,7 +98,6 @@ static struct fsck_err_state *fsck_err_get(struct bch_fs *c, const char *fmt)
INIT_LIST_HEAD
(
&
s
->
list
);
s
->
fmt
=
fmt
;
s
->
buf
=
PRINTBUF
;
list_add
(
&
s
->
list
,
&
c
->
fsck_errors
);
return
s
;
}
...
...
@@ -111,9 +110,23 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...)
struct
printbuf
buf
=
PRINTBUF
,
*
out
=
&
buf
;
int
ret
=
-
BCH_ERR_fsck_ignore
;
va_start
(
args
,
fmt
);
prt_vprintf
(
out
,
fmt
,
args
);
va_end
(
args
);
mutex_lock
(
&
c
->
fsck_error_lock
);
s
=
fsck_err_get
(
c
,
fmt
);
if
(
s
)
{
if
(
s
->
last_msg
&&
!
strcmp
(
buf
.
buf
,
s
->
last_msg
))
{
ret
=
s
->
ret
;
mutex_unlock
(
&
c
->
fsck_error_lock
);
printbuf_exit
(
&
buf
);
return
ret
;
}
kfree
(
s
->
last_msg
);
s
->
last_msg
=
kstrdup
(
buf
.
buf
,
GFP_KERNEL
);
if
(
c
->
opts
.
ratelimit_errors
&&
!
(
flags
&
FSCK_NO_RATELIMIT
)
&&
s
->
nr
>=
FSCK_ERR_RATELIMIT_NR
)
{
...
...
@@ -123,8 +136,6 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...)
print
=
false
;
}
printbuf_reset
(
&
s
->
buf
);
out
=
&
s
->
buf
;
s
->
nr
++
;
}
...
...
@@ -133,10 +144,6 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...)
prt_printf
(
out
,
bch2_log_msg
(
c
,
""
));
#endif
va_start
(
args
,
fmt
);
prt_vprintf
(
out
,
fmt
,
args
);
va_end
(
args
);
if
(
test_bit
(
BCH_FS_FSCK_DONE
,
&
c
->
flags
))
{
if
(
c
->
opts
.
errors
!=
BCH_ON_ERROR_continue
||
!
(
flags
&
(
FSCK_CAN_FIX
|
FSCK_CAN_IGNORE
)))
{
...
...
@@ -190,6 +197,9 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...)
else
if
(
suppressing
)
bch_err
(
c
,
"Ratelimiting new instances of previous error"
);
if
(
s
)
s
->
ret
=
ret
;
mutex_unlock
(
&
c
->
fsck_error_lock
);
printbuf_exit
(
&
buf
);
...
...
@@ -214,11 +224,11 @@ void bch2_flush_fsck_errs(struct bch_fs *c)
mutex_lock
(
&
c
->
fsck_error_lock
);
list_for_each_entry_safe
(
s
,
n
,
&
c
->
fsck_errors
,
list
)
{
if
(
s
->
ratelimited
)
bch_err
(
c
,
"Saw %llu errors like:
\n
%s"
,
s
->
nr
,
s
->
buf
.
buf
);
if
(
s
->
ratelimited
&&
s
->
last_msg
)
bch_err
(
c
,
"Saw %llu errors like:
\n
%s"
,
s
->
nr
,
s
->
last_msg
);
list_del
(
&
s
->
list
);
printbuf_exit
(
&
s
->
buf
);
kfree
(
s
->
last_msg
);
kfree
(
s
);
}
...
...
fs/bcachefs/error.h
View file @
9c5d38bb
...
...
@@ -103,7 +103,8 @@ struct fsck_err_state {
const
char
*
fmt
;
u64
nr
;
bool
ratelimited
;
struct
printbuf
buf
;
int
ret
;
char
*
last_msg
;
};
#define FSCK_CAN_FIX (1 << 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