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
bdbf953b
Commit
bdbf953b
authored
Mar 19, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: bch2_shoot_down_journal_keys()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
27fcec6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
10 deletions
+35
-10
fs/bcachefs/btree_journal_iter.c
fs/bcachefs/btree_journal_iter.c
+19
-0
fs/bcachefs/btree_journal_iter.h
fs/bcachefs/btree_journal_iter.h
+4
-0
fs/bcachefs/recovery.c
fs/bcachefs/recovery.c
+12
-10
No files found.
fs/bcachefs/btree_journal_iter.c
View file @
bdbf953b
...
@@ -567,3 +567,22 @@ int bch2_journal_keys_sort(struct bch_fs *c)
...
@@ -567,3 +567,22 @@ int bch2_journal_keys_sort(struct bch_fs *c)
bch_verbose
(
c
,
"Journal keys: %zu read, %zu after sorting and compacting"
,
nr_read
,
keys
->
nr
);
bch_verbose
(
c
,
"Journal keys: %zu read, %zu after sorting and compacting"
,
nr_read
,
keys
->
nr
);
return
0
;
return
0
;
}
}
void
bch2_shoot_down_journal_keys
(
struct
bch_fs
*
c
,
enum
btree_id
btree
,
unsigned
level_min
,
unsigned
level_max
,
struct
bpos
start
,
struct
bpos
end
)
{
struct
journal_keys
*
keys
=
&
c
->
journal_keys
;
size_t
dst
=
0
;
move_gap
(
keys
,
keys
->
nr
);
darray_for_each
(
*
keys
,
i
)
if
(
!
(
i
->
btree_id
==
btree
&&
i
->
level
>=
level_min
&&
i
->
level
<=
level_max
&&
bpos_ge
(
i
->
k
->
k
.
p
,
start
)
&&
bpos_le
(
i
->
k
->
k
.
p
,
end
)))
keys
->
data
[
dst
++
]
=
*
i
;
keys
->
nr
=
keys
->
gap
=
dst
;
}
fs/bcachefs/btree_journal_iter.h
View file @
bdbf953b
...
@@ -66,4 +66,8 @@ void bch2_journal_entries_free(struct bch_fs *);
...
@@ -66,4 +66,8 @@ void bch2_journal_entries_free(struct bch_fs *);
int
bch2_journal_keys_sort
(
struct
bch_fs
*
);
int
bch2_journal_keys_sort
(
struct
bch_fs
*
);
void
bch2_shoot_down_journal_keys
(
struct
bch_fs
*
,
enum
btree_id
,
unsigned
,
unsigned
,
struct
bpos
,
struct
bpos
);
#endif
/* _BCACHEFS_BTREE_JOURNAL_ITER_H */
#endif
/* _BCACHEFS_BTREE_JOURNAL_ITER_H */
fs/bcachefs/recovery.c
View file @
bdbf953b
...
@@ -47,7 +47,7 @@ static bool btree_id_is_alloc(enum btree_id id)
...
@@ -47,7 +47,7 @@ static bool btree_id_is_alloc(enum btree_id id)
}
}
/* for -o reconstruct_alloc: */
/* for -o reconstruct_alloc: */
static
void
do
_reconstruct_alloc
(
struct
bch_fs
*
c
)
static
void
bch2
_reconstruct_alloc
(
struct
bch_fs
*
c
)
{
{
bch2_journal_log_msg
(
c
,
"dropping alloc info"
);
bch2_journal_log_msg
(
c
,
"dropping alloc info"
);
bch_info
(
c
,
"dropping and reconstructing all alloc info"
);
bch_info
(
c
,
"dropping and reconstructing all alloc info"
);
...
@@ -82,15 +82,17 @@ static void do_reconstruct_alloc(struct bch_fs *c)
...
@@ -82,15 +82,17 @@ static void do_reconstruct_alloc(struct bch_fs *c)
c
->
recovery_passes_explicit
|=
bch2_recovery_passes_from_stable
(
le64_to_cpu
(
ext
->
recovery_passes_required
[
0
]));
c
->
recovery_passes_explicit
|=
bch2_recovery_passes_from_stable
(
le64_to_cpu
(
ext
->
recovery_passes_required
[
0
]));
struct
journal_keys
*
keys
=
&
c
->
journal_keys
;
size_t
src
,
dst
;
move_gap
(
keys
,
keys
->
nr
);
for
(
src
=
0
,
dst
=
0
;
src
<
keys
->
nr
;
src
++
)
bch2_shoot_down_journal_keys
(
c
,
BTREE_ID_alloc
,
if
(
!
btree_id_is_alloc
(
keys
->
data
[
src
].
btree_id
))
0
,
BTREE_MAX_DEPTH
,
POS_MIN
,
SPOS_MAX
);
keys
->
data
[
dst
++
]
=
keys
->
data
[
src
];
bch2_shoot_down_journal_keys
(
c
,
BTREE_ID_backpointers
,
keys
->
nr
=
keys
->
gap
=
dst
;
0
,
BTREE_MAX_DEPTH
,
POS_MIN
,
SPOS_MAX
);
bch2_shoot_down_journal_keys
(
c
,
BTREE_ID_need_discard
,
0
,
BTREE_MAX_DEPTH
,
POS_MIN
,
SPOS_MAX
);
bch2_shoot_down_journal_keys
(
c
,
BTREE_ID_freespace
,
0
,
BTREE_MAX_DEPTH
,
POS_MIN
,
SPOS_MAX
);
bch2_shoot_down_journal_keys
(
c
,
BTREE_ID_bucket_gens
,
0
,
BTREE_MAX_DEPTH
,
POS_MIN
,
SPOS_MAX
);
}
}
/*
/*
...
@@ -731,7 +733,7 @@ int bch2_fs_recovery(struct bch_fs *c)
...
@@ -731,7 +733,7 @@ int bch2_fs_recovery(struct bch_fs *c)
c
->
journal_replay_seq_end
=
blacklist_seq
-
1
;
c
->
journal_replay_seq_end
=
blacklist_seq
-
1
;
if
(
c
->
opts
.
reconstruct_alloc
)
if
(
c
->
opts
.
reconstruct_alloc
)
do
_reconstruct_alloc
(
c
);
bch2
_reconstruct_alloc
(
c
);
zero_out_btree_mem_ptr
(
&
c
->
journal_keys
);
zero_out_btree_mem_ptr
(
&
c
->
journal_keys
);
...
...
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