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
3a0e06db
Commit
3a0e06db
authored
Dec 24, 2022
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Assorted preemption fixes
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
d5f70c1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
12 deletions
+14
-12
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+2
-0
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+1
-6
fs/bcachefs/buckets.c
fs/bcachefs/buckets.c
+11
-2
fs/bcachefs/journal.c
fs/bcachefs/journal.c
+0
-4
No files found.
fs/bcachefs/alloc_background.c
View file @
3a0e06db
...
...
@@ -291,8 +291,10 @@ int bch2_alloc_read(struct bch_fs *c, struct list_head *journal_replay_list)
bch2_alloc_read_key
(
c
,
bkey_i_to_s_c
(
k
));
}
percpu_down_write
(
&
c
->
mark_lock
);
for_each_member_device
(
ca
,
c
,
i
)
bch2_dev_usage_from_buckets
(
c
,
ca
);
percpu_up_write
(
&
c
->
mark_lock
);
mutex_lock
(
&
c
->
bucket_clock
[
READ
].
lock
);
for_each_member_device
(
ca
,
c
,
i
)
{
...
...
fs/bcachefs/btree_gc.c
View file @
3a0e06db
...
...
@@ -354,8 +354,6 @@ void bch2_mark_dev_superblock(struct bch_fs *c, struct bch_dev *ca,
if
(
c
)
{
lockdep_assert_held
(
&
c
->
sb_lock
);
percpu_down_read
(
&
c
->
mark_lock
);
}
else
{
preempt_disable
();
}
for
(
i
=
0
;
i
<
layout
->
nr_superblocks
;
i
++
)
{
...
...
@@ -377,11 +375,8 @@ void bch2_mark_dev_superblock(struct bch_fs *c, struct bch_dev *ca,
gc_phase
(
GC_PHASE_SB
),
flags
);
}
if
(
c
)
{
if
(
c
)
percpu_up_read
(
&
c
->
mark_lock
);
}
else
{
preempt_enable
();
}
}
static
void
bch2_mark_superblocks
(
struct
bch_fs
*
c
)
...
...
fs/bcachefs/buckets.c
View file @
3a0e06db
...
...
@@ -393,14 +393,19 @@ void bch2_dev_usage_from_buckets(struct bch_fs *c, struct bch_dev *ca)
struct
bucket_array
*
buckets
;
struct
bucket
*
g
;
percpu_down_read
(
&
c
->
mark_lock
);
/*
* This is only called during startup, before there's any multithreaded
* access to c->usage:
*/
preempt_disable
();
fs_usage
=
this_cpu_ptr
(
c
->
usage
[
0
]);
preempt_enable
();
buckets
=
bucket_array
(
ca
);
for_each_bucket
(
g
,
buckets
)
if
(
g
->
mark
.
data_type
)
bch2_dev_usage_update
(
c
,
ca
,
fs_usage
,
old
,
g
->
mark
,
false
);
percpu_up_read
(
&
c
->
mark_lock
);
}
#define bucket_data_cmpxchg(c, ca, fs_usage, g, new, expr) \
...
...
@@ -513,8 +518,12 @@ void bch2_mark_alloc_bucket(struct bch_fs *c, struct bch_dev *ca,
size_t
b
,
bool
owned_by_allocator
,
struct
gc_pos
pos
,
unsigned
flags
)
{
preempt_disable
();
do_mark_fn
(
__bch2_mark_alloc_bucket
,
c
,
pos
,
flags
,
ca
,
b
,
owned_by_allocator
);
preempt_enable
();
}
static
int
bch2_mark_alloc
(
struct
bch_fs
*
c
,
struct
bkey_s_c
k
,
...
...
fs/bcachefs/journal.c
View file @
3a0e06db
...
...
@@ -835,8 +835,6 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
if
(
c
)
{
percpu_down_read
(
&
c
->
mark_lock
);
spin_lock
(
&
c
->
journal
.
lock
);
}
else
{
preempt_disable
();
}
pos
=
ja
->
nr
?
(
ja
->
cur_idx
+
1
)
%
ja
->
nr
:
0
;
...
...
@@ -866,8 +864,6 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
if
(
c
)
{
spin_unlock
(
&
c
->
journal
.
lock
);
percpu_up_read
(
&
c
->
mark_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