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
5e5d9bdb
Commit
5e5d9bdb
authored
Jan 22, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Fix fifo overflow in allocator startup
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
7ef2a73a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+24
-0
No files found.
fs/bcachefs/alloc_background.c
View file @
5e5d9bdb
...
@@ -1334,6 +1334,24 @@ static void allocator_start_issue_discards(struct bch_fs *c)
...
@@ -1334,6 +1334,24 @@ static void allocator_start_issue_discards(struct bch_fs *c)
ca
->
mi
.
bucket_size
,
GFP_NOIO
);
ca
->
mi
.
bucket_size
,
GFP_NOIO
);
}
}
static
int
resize_free_inc
(
struct
bch_dev
*
ca
)
{
alloc_fifo
free_inc
;
if
(
!
fifo_full
(
&
ca
->
free_inc
))
return
0
;
if
(
!
init_fifo
(
&
free_inc
,
ca
->
free_inc
.
size
*
2
,
GFP_KERNEL
))
return
-
ENOMEM
;
fifo_move
(
&
free_inc
,
&
ca
->
free_inc
);
swap
(
free_inc
,
ca
->
free_inc
);
free_fifo
(
&
free_inc
);
return
0
;
}
static
int
__bch2_fs_allocator_start
(
struct
bch_fs
*
c
)
static
int
__bch2_fs_allocator_start
(
struct
bch_fs
*
c
)
{
{
struct
bch_dev
*
ca
;
struct
bch_dev
*
ca
;
...
@@ -1409,6 +1427,12 @@ static int __bch2_fs_allocator_start(struct bch_fs *c)
...
@@ -1409,6 +1427,12 @@ static int __bch2_fs_allocator_start(struct bch_fs *c)
while
(
!
fifo_full
(
&
ca
->
free
[
RESERVE_BTREE
])
&&
while
(
!
fifo_full
(
&
ca
->
free
[
RESERVE_BTREE
])
&&
(
bu
=
next_alloc_bucket
(
ca
))
>=
0
)
{
(
bu
=
next_alloc_bucket
(
ca
))
>=
0
)
{
ret
=
resize_free_inc
(
ca
);
if
(
ret
)
{
percpu_ref_put
(
&
ca
->
io_ref
);
return
ret
;
}
bch2_invalidate_one_bucket
(
c
,
ca
,
bu
,
bch2_invalidate_one_bucket
(
c
,
ca
,
bu
,
&
journal_seq
);
&
journal_seq
);
...
...
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