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
f82755e4
Commit
f82755e4
authored
Oct 30, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Data move path now uses bch2_trans_unlock_long()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
c4accde4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+11
-1
fs/bcachefs/move.c
fs/bcachefs/move.c
+8
-5
fs/bcachefs/move.h
fs/bcachefs/move.h
+1
-0
fs/bcachefs/movinggc.c
fs/bcachefs/movinggc.c
+2
-2
fs/bcachefs/rebalance.c
fs/bcachefs/rebalance.c
+1
-1
No files found.
fs/bcachefs/btree_iter.c
View file @
f82755e4
...
...
@@ -2833,6 +2833,13 @@ void *__bch2_trans_kmalloc(struct btree_trans *trans, size_t size)
return
p
;
}
static
inline
void
check_srcu_held_too_long
(
struct
btree_trans
*
trans
)
{
WARN
(
trans
->
srcu_held
&&
time_after
(
jiffies
,
trans
->
srcu_lock_time
+
HZ
*
10
),
"btree trans held srcu lock (delaying memory reclaim) for %lu seconds"
,
(
jiffies
-
trans
->
srcu_lock_time
)
/
HZ
);
}
void
bch2_trans_srcu_unlock
(
struct
btree_trans
*
trans
)
{
if
(
trans
->
srcu_held
)
{
...
...
@@ -2843,6 +2850,7 @@ void bch2_trans_srcu_unlock(struct btree_trans *trans)
if
(
path
->
cached
&&
!
btree_node_locked
(
path
,
0
))
path
->
l
[
0
].
b
=
ERR_PTR
(
-
BCH_ERR_no_btree_node_srcu_reset
);
check_srcu_held_too_long
(
trans
);
srcu_read_unlock
(
&
c
->
btree_trans_barrier
,
trans
->
srcu_idx
);
trans
->
srcu_held
=
false
;
}
...
...
@@ -3074,8 +3082,10 @@ void bch2_trans_put(struct btree_trans *trans)
check_btree_paths_leaked
(
trans
);
if
(
trans
->
srcu_held
)
if
(
trans
->
srcu_held
)
{
check_srcu_held_too_long
(
trans
);
srcu_read_unlock
(
&
c
->
btree_trans_barrier
,
trans
->
srcu_idx
);
}
bch2_journal_preres_put
(
&
c
->
journal
,
&
trans
->
journal_preres
);
...
...
fs/bcachefs/move.c
View file @
f82755e4
...
...
@@ -147,9 +147,8 @@ void bch2_moving_ctxt_do_pending_writes(struct moving_context *ctxt)
{
struct
moving_io
*
io
;
bch2_trans_unlock
(
ctxt
->
trans
);
while
((
io
=
bch2_moving_ctxt_next_pending_write
(
ctxt
)))
{
bch2_trans_unlock_long
(
ctxt
->
trans
);
list_del
(
&
io
->
read_list
);
move_write
(
io
);
}
...
...
@@ -485,8 +484,8 @@ int bch2_move_ratelimit(struct moving_context *ctxt)
struct
bch_fs
*
c
=
ctxt
->
trans
->
c
;
u64
delay
;
if
(
ctxt
->
wait_on_copygc
)
{
bch2_trans_unlock
(
ctxt
->
trans
);
if
(
ctxt
->
wait_on_copygc
&&
!
c
->
copygc_running
)
{
bch2_trans_unlock
_long
(
ctxt
->
trans
);
wait_event_killable
(
c
->
copygc_running_wq
,
!
c
->
copygc_running
||
kthread_should_stop
());
...
...
@@ -495,8 +494,12 @@ int bch2_move_ratelimit(struct moving_context *ctxt)
do
{
delay
=
ctxt
->
rate
?
bch2_ratelimit_delay
(
ctxt
->
rate
)
:
0
;
if
(
delay
)
{
bch2_trans_unlock
(
ctxt
->
trans
);
if
(
delay
>
HZ
/
10
)
bch2_trans_unlock_long
(
ctxt
->
trans
);
else
bch2_trans_unlock
(
ctxt
->
trans
);
set_current_state
(
TASK_INTERRUPTIBLE
);
}
...
...
fs/bcachefs/move.h
View file @
f82755e4
...
...
@@ -45,6 +45,7 @@ do { \
\
if (_cond) \
break; \
bch2_trans_unlock_long((_ctxt)->trans); \
__wait_event((_ctxt)->wait, \
bch2_moving_ctxt_next_pending_write(_ctxt) || \
(cond_finished = (_cond))); \
...
...
fs/bcachefs/movinggc.c
View file @
f82755e4
...
...
@@ -128,7 +128,7 @@ static void move_buckets_wait(struct moving_context *ctxt,
kfree
(
i
);
}
bch2_trans_unlock
(
ctxt
->
trans
);
bch2_trans_unlock
_long
(
ctxt
->
trans
);
}
static
bool
bucket_in_flight
(
struct
buckets_in_flight
*
list
,
...
...
@@ -327,7 +327,7 @@ static int bch2_copygc_thread(void *arg)
while
(
!
ret
&&
!
kthread_should_stop
())
{
bool
did_work
=
false
;
bch2_trans_unlock
(
ctxt
.
trans
);
bch2_trans_unlock
_long
(
ctxt
.
trans
);
cond_resched
();
if
(
!
c
->
copy_gc_enabled
)
{
...
...
fs/bcachefs/rebalance.c
View file @
f82755e4
...
...
@@ -348,7 +348,7 @@ static int do_rebalance(struct moving_context *ctxt)
!
kthread_should_stop
()
&&
!
atomic64_read
(
&
r
->
work_stats
.
sectors_seen
)
&&
!
atomic64_read
(
&
r
->
scan_stats
.
sectors_seen
))
{
bch2_trans_unlock
(
trans
);
bch2_trans_unlock
_long
(
trans
);
rebalance_wait
(
c
);
}
...
...
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