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
b97de453
Commit
b97de453
authored
Jan 15, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Improve trace_trans_restart_relock
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
46bf2e9c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
24 deletions
+44
-24
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+1
-1
fs/bcachefs/btree_locking.c
fs/bcachefs/btree_locking.c
+33
-7
fs/bcachefs/btree_locking.h
fs/bcachefs/btree_locking.h
+1
-8
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+5
-0
fs/bcachefs/trace.h
fs/bcachefs/trace.h
+4
-8
No files found.
fs/bcachefs/btree_iter.c
View file @
b97de453
...
...
@@ -1337,7 +1337,7 @@ void bch2_path_put(struct btree_trans *trans, btree_path_idx_t path_idx, bool in
if
(
path
->
should_be_locked
&&
!
trans
->
restarted
&&
(
!
dup
||
!
bch2_btree_path_relock_norestart
(
trans
,
dup
,
_THIS_IP_
)))
(
!
dup
||
!
bch2_btree_path_relock_norestart
(
trans
,
dup
)))
return
;
if
(
dup
)
{
...
...
fs/bcachefs/btree_locking.c
View file @
b97de453
...
...
@@ -631,8 +631,7 @@ int bch2_btree_path_relock_intent(struct btree_trans *trans,
}
__flatten
bool
bch2_btree_path_relock_norestart
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
,
unsigned
long
trace_ip
)
bool
bch2_btree_path_relock_norestart
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
)
{
struct
get_locks_fail
f
;
...
...
@@ -642,7 +641,7 @@ bool bch2_btree_path_relock_norestart(struct btree_trans *trans,
int
__bch2_btree_path_relock
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
,
unsigned
long
trace_ip
)
{
if
(
!
bch2_btree_path_relock_norestart
(
trans
,
path
,
trace_ip
))
{
if
(
!
bch2_btree_path_relock_norestart
(
trans
,
path
))
{
trace_and_count
(
trans
->
c
,
trans_restart_relock_path
,
trans
,
trace_ip
,
path
);
return
btree_trans_restart
(
trans
,
BCH_ERR_transaction_restart_relock_path
);
}
...
...
@@ -759,12 +758,39 @@ int bch2_trans_relock(struct btree_trans *trans)
if
(
unlikely
(
trans
->
restarted
))
return
-
((
int
)
trans
->
restarted
);
trans_for_each_path
(
trans
,
path
,
i
)
trans_for_each_path
(
trans
,
path
,
i
)
{
struct
get_locks_fail
f
;
if
(
path
->
should_be_locked
&&
!
bch2_btree_path_relock_norestart
(
trans
,
path
,
_RET_IP_
))
{
trace_and_count
(
trans
->
c
,
trans_restart_relock
,
trans
,
_RET_IP_
,
path
);
!
btree_path_get_locks
(
trans
,
path
,
false
,
&
f
))
{
if
(
trace_trans_restart_relock_enabled
())
{
struct
printbuf
buf
=
PRINTBUF
;
bch2_bpos_to_text
(
&
buf
,
path
->
pos
);
prt_printf
(
&
buf
,
" l=%u seq=%u node seq="
,
f
.
l
,
path
->
l
[
f
.
l
].
lock_seq
);
if
(
IS_ERR_OR_NULL
(
f
.
b
))
{
prt_str
(
&
buf
,
bch2_err_str
(
PTR_ERR
(
f
.
b
)));
}
else
{
prt_printf
(
&
buf
,
"%u"
,
f
.
b
->
c
.
lock
.
seq
);
struct
six_lock_count
c
=
bch2_btree_node_lock_counts
(
trans
,
NULL
,
&
f
.
b
->
c
,
f
.
l
);
prt_printf
(
&
buf
,
" self locked %u.%u.%u"
,
c
.
n
[
0
],
c
.
n
[
1
],
c
.
n
[
2
]);
c
=
six_lock_counts
(
&
f
.
b
->
c
.
lock
);
prt_printf
(
&
buf
,
" total locked %u.%u.%u"
,
c
.
n
[
0
],
c
.
n
[
1
],
c
.
n
[
2
]);
}
trace_trans_restart_relock
(
trans
,
_RET_IP_
,
buf
.
buf
);
printbuf_exit
(
&
buf
);
}
count_event
(
trans
->
c
,
trans_restart_relock
);
return
btree_trans_restart
(
trans
,
BCH_ERR_transaction_restart_relock
);
}
}
return
0
;
}
...
...
@@ -778,7 +804,7 @@ int bch2_trans_relock_notrace(struct btree_trans *trans)
trans_for_each_path
(
trans
,
path
,
i
)
if
(
path
->
should_be_locked
&&
!
bch2_btree_path_relock_norestart
(
trans
,
path
,
_RET_IP_
))
{
!
bch2_btree_path_relock_norestart
(
trans
,
path
))
{
return
btree_trans_restart
(
trans
,
BCH_ERR_transaction_restart_relock
);
}
return
0
;
...
...
fs/bcachefs/btree_locking.h
View file @
b97de453
...
...
@@ -312,8 +312,7 @@ void bch2_btree_node_lock_write_nofail(struct btree_trans *,
/* relock: */
bool
bch2_btree_path_relock_norestart
(
struct
btree_trans
*
,
struct
btree_path
*
,
unsigned
long
);
bool
bch2_btree_path_relock_norestart
(
struct
btree_trans
*
,
struct
btree_path
*
);
int
__bch2_btree_path_relock
(
struct
btree_trans
*
,
struct
btree_path
*
,
unsigned
long
);
...
...
@@ -353,12 +352,6 @@ static inline bool bch2_btree_node_relock_notrace(struct btree_trans *trans,
/* upgrade */
struct
get_locks_fail
{
unsigned
l
;
struct
btree
*
b
;
};
bool
bch2_btree_path_upgrade_noupgrade_sibs
(
struct
btree_trans
*
,
struct
btree_path
*
,
unsigned
,
struct
get_locks_fail
*
);
...
...
fs/bcachefs/btree_types.h
View file @
b97de453
...
...
@@ -741,4 +741,9 @@ enum btree_node_sibling {
btree_next_sib
,
};
struct
get_locks_fail
{
unsigned
l
;
struct
btree
*
b
;
};
#endif
/* _BCACHEFS_BTREE_TYPES_H */
fs/bcachefs/trace.h
View file @
b97de453
...
...
@@ -528,7 +528,7 @@ TRACE_EVENT(btree_path_relock_fail,
__entry
->
level
=
path
->
level
;
TRACE_BPOS_assign
(
pos
,
path
->
pos
);
c
=
bch2_btree_node_lock_counts
(
trans
,
NULL
,
&
path
->
l
[
level
].
b
->
c
,
level
)
,
c
=
bch2_btree_node_lock_counts
(
trans
,
NULL
,
&
path
->
l
[
level
].
b
->
c
,
level
)
;
__entry
->
self_read_count
=
c
.
n
[
SIX_LOCK_read
];
__entry
->
self_intent_count
=
c
.
n
[
SIX_LOCK_intent
];
...
...
@@ -1120,8 +1120,6 @@ DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_split,
TP_ARGS
(
trans
,
caller_ip
,
path
)
);
struct
get_locks_fail
;
TRACE_EVENT
(
trans_restart_upgrade
,
TP_PROTO
(
struct
btree_trans
*
trans
,
unsigned
long
caller_ip
,
...
...
@@ -1169,11 +1167,9 @@ TRACE_EVENT(trans_restart_upgrade,
__entry
->
node_seq
)
);
DEFINE_EVENT
(
transaction_restart_iter
,
trans_restart_relock
,
TP_PROTO
(
struct
btree_trans
*
trans
,
unsigned
long
caller_ip
,
struct
btree_path
*
path
),
TP_ARGS
(
trans
,
caller_ip
,
path
)
DEFINE_EVENT
(
trans_str
,
trans_restart_relock
,
TP_PROTO
(
struct
btree_trans
*
trans
,
unsigned
long
caller_ip
,
const
char
*
str
),
TP_ARGS
(
trans
,
caller_ip
,
str
)
);
DEFINE_EVENT
(
transaction_restart_iter
,
trans_restart_relock_next_node
,
...
...
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