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
ad52bac2
Commit
ad52bac2
authored
Aug 03, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Log a message when running an explicit recovery pass
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
a1d1072f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
26 deletions
+35
-26
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+0
-16
fs/bcachefs/btree_io.c
fs/bcachefs/btree_io.c
+1
-0
fs/bcachefs/fsck.c
fs/bcachefs/fsck.c
+1
-0
fs/bcachefs/recovery.c
fs/bcachefs/recovery.c
+10
-10
fs/bcachefs/recovery.h
fs/bcachefs/recovery.h
+23
-0
No files found.
fs/bcachefs/bcachefs.h
View file @
ad52bac2
...
...
@@ -1139,22 +1139,6 @@ static inline bool bch2_dev_exists2(const struct bch_fs *c, unsigned dev)
return
dev
<
c
->
sb
.
nr_devices
&&
c
->
devs
[
dev
];
}
/*
* For when we need to rewind recovery passes and run a pass we skipped:
*/
static
inline
int
bch2_run_explicit_recovery_pass
(
struct
bch_fs
*
c
,
enum
bch_recovery_pass
pass
)
{
c
->
recovery_passes_explicit
|=
BIT_ULL
(
pass
);
if
(
c
->
curr_recovery_pass
>=
pass
)
{
c
->
curr_recovery_pass
=
pass
;
return
-
BCH_ERR_restart_recovery
;
}
else
{
return
0
;
}
}
#define BKEY_PADDED_ONSTACK(key, pad) \
struct { struct bkey_i key; __u64 key ## _pad[pad]; }
...
...
fs/bcachefs/btree_io.c
View file @
ad52bac2
...
...
@@ -17,6 +17,7 @@
#include "io.h"
#include "journal_reclaim.h"
#include "journal_seq_blacklist.h"
#include "recovery.h"
#include "super-io.h"
#include "trace.h"
...
...
fs/bcachefs/fsck.c
View file @
ad52bac2
...
...
@@ -11,6 +11,7 @@
#include "fsck.h"
#include "inode.h"
#include "keylist.h"
#include "recovery.h"
#include "subvolume.h"
#include "super.h"
#include "xattr.h"
...
...
fs/bcachefs/recovery.c
View file @
ad52bac2
...
...
@@ -1120,7 +1120,7 @@ static int bch2_fs_upgrade_for_subvolumes(struct bch_fs *c)
return
ret
;
}
static
const
char
*
const
recovery_pass_nam
es
[]
=
{
const
char
*
const
bch2_recovery_pass
es
[]
=
{
#define x(_fn, _when) #_fn,
BCH_RECOVERY_PASSES
()
#undef x
...
...
@@ -1143,7 +1143,7 @@ struct recovery_pass_fn {
unsigned
when
;
};
static
struct
recovery_pass_fn
recovery_pass
e
s
[]
=
{
static
struct
recovery_pass_fn
recovery_pass
_fn
s
[]
=
{
#define x(_fn, _when) { .fn = bch2_##_fn, .when = _when },
BCH_RECOVERY_PASSES
()
#undef x
...
...
@@ -1205,7 +1205,7 @@ static void check_version_upgrade(struct bch_fs *c)
prt_str
(
&
buf
,
"fsck required"
);
else
{
prt_str
(
&
buf
,
"running recovery passses: "
);
prt_bitflags
(
&
buf
,
recovery_pass_nam
es
,
recovery_passes
);
prt_bitflags
(
&
buf
,
bch2_recovery_pass
es
,
recovery_passes
);
}
c
->
recovery_passes_explicit
|=
recovery_passes
;
...
...
@@ -1226,15 +1226,15 @@ u64 bch2_fsck_recovery_passes(void)
{
u64
ret
=
0
;
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
recovery_pass
e
s
);
i
++
)
if
(
recovery_pass
e
s
[
i
].
when
&
PASS_FSCK
)
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
recovery_pass
_fn
s
);
i
++
)
if
(
recovery_pass
_fn
s
[
i
].
when
&
PASS_FSCK
)
ret
|=
BIT_ULL
(
i
);
return
ret
;
}
static
bool
should_run_recovery_pass
(
struct
bch_fs
*
c
,
enum
bch_recovery_pass
pass
)
{
struct
recovery_pass_fn
*
p
=
recovery_pass
e
s
+
c
->
curr_recovery_pass
;
struct
recovery_pass_fn
*
p
=
recovery_pass
_fn
s
+
c
->
curr_recovery_pass
;
if
(
c
->
opts
.
norecovery
&&
pass
>
BCH_RECOVERY_PASS_snapshots_read
)
return
false
;
...
...
@@ -1256,11 +1256,11 @@ static int bch2_run_recovery_pass(struct bch_fs *c, enum bch_recovery_pass pass)
c
->
curr_recovery_pass
=
pass
;
if
(
should_run_recovery_pass
(
c
,
pass
))
{
struct
recovery_pass_fn
*
p
=
recovery_pass
e
s
+
pass
;
struct
recovery_pass_fn
*
p
=
recovery_pass
_fn
s
+
pass
;
if
(
!
(
p
->
when
&
PASS_SILENT
))
printk
(
KERN_INFO
bch2_log_msg
(
c
,
"%s..."
),
recovery_pass_nam
es
[
pass
]);
bch2_recovery_pass
es
[
pass
]);
ret
=
p
->
fn
(
c
);
if
(
ret
)
return
ret
;
...
...
@@ -1275,7 +1275,7 @@ static int bch2_run_recovery_passes(struct bch_fs *c)
{
int
ret
=
0
;
while
(
c
->
curr_recovery_pass
<
ARRAY_SIZE
(
recovery_pass
e
s
))
{
while
(
c
->
curr_recovery_pass
<
ARRAY_SIZE
(
recovery_pass
_fn
s
))
{
ret
=
bch2_run_recovery_pass
(
c
,
c
->
curr_recovery_pass
);
if
(
bch2_err_matches
(
ret
,
BCH_ERR_restart_recovery
))
continue
;
...
...
@@ -1593,7 +1593,7 @@ int bch2_fs_initialize(struct bch_fs *c)
}
mutex_unlock
(
&
c
->
sb_lock
);
c
->
curr_recovery_pass
=
ARRAY_SIZE
(
recovery_pass
e
s
);
c
->
curr_recovery_pass
=
ARRAY_SIZE
(
recovery_pass
_fn
s
);
set_bit
(
BCH_FS_MAY_GO_RW
,
&
c
->
flags
);
set_bit
(
BCH_FS_FSCK_DONE
,
&
c
->
flags
);
...
...
fs/bcachefs/recovery.h
View file @
ad52bac2
...
...
@@ -52,9 +52,32 @@ void bch2_btree_and_journal_iter_init_node_iter(struct btree_and_journal_iter *,
void
bch2_journal_keys_free
(
struct
journal_keys
*
);
void
bch2_journal_entries_free
(
struct
bch_fs
*
);
extern
const
char
*
const
bch2_recovery_passes
[];
/*
* For when we need to rewind recovery passes and run a pass we skipped:
*/
static
inline
int
bch2_run_explicit_recovery_pass
(
struct
bch_fs
*
c
,
enum
bch_recovery_pass
pass
)
{
bch_info
(
c
,
"running explicit recovery pass %s (%u), currently at %s (%u)"
,
bch2_recovery_passes
[
pass
],
pass
,
bch2_recovery_passes
[
c
->
curr_recovery_pass
],
c
->
curr_recovery_pass
);
c
->
recovery_passes_explicit
|=
BIT_ULL
(
pass
);
if
(
c
->
curr_recovery_pass
>=
pass
)
{
c
->
curr_recovery_pass
=
pass
;
return
-
BCH_ERR_restart_recovery
;
}
else
{
return
0
;
}
}
u64
bch2_fsck_recovery_passes
(
void
);
int
bch2_fs_recovery
(
struct
bch_fs
*
);
int
bch2_fs_initialize
(
struct
bch_fs
*
);
#endif
/* _BCACHEFS_RECOVERY_H */
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