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
97446a24
Commit
97446a24
authored
Jul 20, 2018
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Fix device add
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
1c7a0adf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+9
-0
fs/bcachefs/journal.c
fs/bcachefs/journal.c
+8
-3
No files found.
fs/bcachefs/btree_gc.c
View file @
97446a24
...
...
@@ -327,9 +327,16 @@ void bch2_mark_dev_superblock(struct bch_fs *c, struct bch_dev *ca,
unsigned
i
;
u64
b
;
/*
* This conditional is kind of gross, but we may be called from the
* device add path, before the new device has actually been added to the
* running filesystem:
*/
if
(
c
)
{
lockdep_assert_held
(
&
c
->
sb_lock
);
percpu_down_read
(
&
c
->
usage_lock
);
}
else
{
preempt_disable
();
}
for
(
i
=
0
;
i
<
layout
->
nr_superblocks
;
i
++
)
{
...
...
@@ -357,6 +364,8 @@ void bch2_mark_dev_superblock(struct bch_fs *c, struct bch_dev *ca,
if
(
c
)
{
spin_unlock
(
&
c
->
journal
.
lock
);
percpu_up_read
(
&
c
->
usage_lock
);
}
else
{
preempt_enable
();
}
}
...
...
fs/bcachefs/journal.c
View file @
97446a24
...
...
@@ -727,6 +727,10 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
if
(
!
journal_buckets
)
goto
err
;
/*
* We may be called from the device add path, before the new device has
* actually been added to the running filesystem:
*/
if
(
c
)
spin_lock
(
&
c
->
journal
.
lock
);
...
...
@@ -743,10 +747,7 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
long
bucket
;
if
(
new_fs
)
{
percpu_down_read
(
&
c
->
usage_lock
);
bucket
=
bch2_bucket_alloc_new_fs
(
ca
);
percpu_up_read
(
&
c
->
usage_lock
);
if
(
bucket
<
0
)
{
ret
=
-
ENOSPC
;
goto
err
;
...
...
@@ -765,6 +766,8 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
if
(
c
)
{
percpu_down_read
(
&
c
->
usage_lock
);
spin_lock
(
&
c
->
journal
.
lock
);
}
else
{
preempt_disable
();
}
__array_insert_item
(
ja
->
buckets
,
ja
->
nr
,
ja
->
last_idx
);
...
...
@@ -792,6 +795,8 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
if
(
c
)
{
spin_unlock
(
&
c
->
journal
.
lock
);
percpu_up_read
(
&
c
->
usage_lock
);
}
else
{
preempt_enable
();
}
if
(
!
new_fs
)
...
...
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