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
ba5c6557
Commit
ba5c6557
authored
Apr 23, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Add actual tracepoints for transaction restarts
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
69eb5390
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
4 deletions
+92
-4
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_cache.c
+2
-0
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+10
-4
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+1
-0
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/btree_update_leaf.c
+7
-0
fs/bcachefs/trace.h
fs/bcachefs/trace.h
+72
-0
No files found.
fs/bcachefs/btree_cache.c
View file @
ba5c6557
...
...
@@ -734,6 +734,8 @@ struct btree *bch2_btree_node_get(struct bch_fs *c, struct btree_iter *iter,
goto
retry
;
trans_restart
();
trace_trans_restart_btree_node_reused
(
c
,
iter
->
trans
->
ip
);
return
ERR_PTR
(
-
EINTR
);
}
}
...
...
fs/bcachefs/btree_iter.c
View file @
ba5c6557
...
...
@@ -252,12 +252,15 @@ bool __bch2_btree_node_lock(struct btree *b, struct bpos pos,
}
}
if
(
ret
)
__btree_node_lock_type
(
iter
->
trans
->
c
,
b
,
type
);
else
if
(
unlikely
(
!
ret
))
{
trans_restart
();
trace_trans_restart_would_deadlock
(
iter
->
trans
->
c
,
iter
->
trans
->
ip
);
return
false
;
}
return
ret
;
__btree_node_lock_type
(
iter
->
trans
->
c
,
b
,
type
);
return
true
;
}
/* Btree iterator locking: */
...
...
@@ -1695,6 +1698,7 @@ static int btree_trans_realloc_iters(struct btree_trans *trans,
if
(
trans
->
iters_live
)
{
trans_restart
();
trace_trans_restart_iters_realloced
(
trans
->
c
,
trans
->
ip
);
return
-
EINTR
;
}
...
...
@@ -1863,6 +1867,7 @@ void *bch2_trans_kmalloc(struct btree_trans *trans,
if
(
old_bytes
)
{
trans_restart
();
trace_trans_restart_mem_realloced
(
trans
->
c
,
trans
->
ip
);
return
ERR_PTR
(
-
EINTR
);
}
}
...
...
@@ -1939,6 +1944,7 @@ void bch2_trans_init(struct btree_trans *trans, struct bch_fs *c)
memset
(
trans
,
0
,
offsetof
(
struct
btree_trans
,
iters_onstack
));
trans
->
c
=
c
;
trans
->
ip
=
_RET_IP_
;
trans
->
size
=
ARRAY_SIZE
(
trans
->
iters_onstack
);
trans
->
iters
=
trans
->
iters_onstack
;
trans
->
updates
=
trans
->
updates_onstack
;
...
...
fs/bcachefs/btree_types.h
View file @
ba5c6557
...
...
@@ -267,6 +267,7 @@ struct btree_insert_entry {
struct
btree_trans
{
struct
bch_fs
*
c
;
unsigned
long
ip
;
size_t
nr_restarts
;
u64
commit_start
;
...
...
fs/bcachefs/btree_update_leaf.c
View file @
ba5c6557
...
...
@@ -440,6 +440,7 @@ static int bch2_trans_journal_preres_get(struct btree_trans *trans)
if
(
!
bch2_btree_trans_relock
(
trans
))
{
trans_restart
(
" (iter relock after journal preres get blocked)"
);
trace_trans_restart_journal_preres_get
(
c
,
trans
->
ip
);
return
-
EINTR
;
}
...
...
@@ -564,6 +565,7 @@ static inline int do_btree_insert_at(struct btree_trans *trans,
if
(
race_fault
())
{
ret
=
-
EINTR
;
trans_restart
(
" (race)"
);
trace_trans_restart_fault_inject
(
c
,
trans
->
ip
);
goto
out
;
}
...
...
@@ -680,6 +682,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
*/
if
(
!
ret
||
(
flags
&
BTREE_INSERT_NOUNLOCK
))
{
trans_restart
(
" (split)"
);
trace_trans_restart_btree_node_split
(
c
,
trans
->
ip
);
ret
=
-
EINTR
;
}
break
;
...
...
@@ -699,6 +702,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
return
0
;
trans_restart
(
" (iter relock after marking replicas)"
);
trace_trans_restart_mark_replicas
(
c
,
trans
->
ip
);
ret
=
-
EINTR
;
break
;
case
BTREE_INSERT_NEED_JOURNAL_RES
:
...
...
@@ -712,6 +716,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
return
0
;
trans_restart
(
" (iter relock after journal res get blocked)"
);
trace_trans_restart_journal_res_get
(
c
,
trans
->
ip
);
ret
=
-
EINTR
;
break
;
default:
...
...
@@ -724,6 +729,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
if
(
ret2
)
{
trans_restart
(
" (traverse)"
);
trace_trans_restart_traverse
(
c
,
trans
->
ip
);
return
ret2
;
}
...
...
@@ -735,6 +741,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
return
0
;
trans_restart
(
" (atomic)"
);
trace_trans_restart_atomic
(
c
,
trans
->
ip
);
}
return
ret
;
...
...
fs/bcachefs/trace.h
View file @
ba5c6557
...
...
@@ -499,6 +499,78 @@ TRACE_EVENT(copygc,
__entry
->
buckets_moved
,
__entry
->
buckets_not_moved
)
);
DECLARE_EVENT_CLASS
(
transaction_restart
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
),
TP_STRUCT__entry
(
__array
(
char
,
name
,
16
)
__field
(
unsigned
long
,
ip
)
),
TP_fast_assign
(
memcpy
(
__entry
->
name
,
c
->
name
,
16
);
__entry
->
ip
=
ip
;
),
TP_printk
(
"%pS"
,
(
void
*
)
__entry
->
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_btree_node_reused
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_would_deadlock
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_iters_realloced
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_mem_realloced
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_journal_res_get
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_journal_preres_get
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_mark_replicas
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_fault_inject
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_btree_node_split
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_traverse
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
DEFINE_EVENT
(
transaction_restart
,
trans_restart_atomic
,
TP_PROTO
(
struct
bch_fs
*
c
,
unsigned
long
ip
),
TP_ARGS
(
c
,
ip
)
);
#endif
/* _TRACE_BCACHEFS_H */
/* This part must be outside protection */
...
...
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