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
dc3b63dc
Commit
dc3b63dc
authored
Mar 21, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Add time stats for btree updates
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
1a470560
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+4
-3
fs/bcachefs/btree_io.c
fs/bcachefs/btree_io.c
+5
-3
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+1
-0
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+2
-1
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/btree_update_leaf.c
+11
-2
No files found.
fs/bcachefs/bcachefs.h
View file @
dc3b63dc
...
@@ -290,10 +290,11 @@ do { \
...
@@ -290,10 +290,11 @@ do { \
#define BCH_TIME_STATS() \
#define BCH_TIME_STATS() \
x(btree_node_mem_alloc) \
x(btree_node_mem_alloc) \
x(btree_node_split) \
x(btree_node_sort) \
x(btree_node_read) \
x(btree_gc) \
x(btree_gc) \
x(btree_split) \
x(btree_update) \
x(btree_sort) \
x(btree_read) \
x(btree_lock_contended_read) \
x(btree_lock_contended_read) \
x(btree_lock_contended_intent) \
x(btree_lock_contended_intent) \
x(btree_lock_contended_write) \
x(btree_lock_contended_write) \
...
...
fs/bcachefs/btree_io.c
View file @
dc3b63dc
...
@@ -327,7 +327,7 @@ static void btree_node_sort(struct bch_fs *c, struct btree *b,
...
@@ -327,7 +327,7 @@ static void btree_node_sort(struct bch_fs *c, struct btree *b,
BUG_ON
(
vstruct_end
(
&
out
->
keys
)
>
(
void
*
)
out
+
(
PAGE_SIZE
<<
order
));
BUG_ON
(
vstruct_end
(
&
out
->
keys
)
>
(
void
*
)
out
+
(
PAGE_SIZE
<<
order
));
if
(
sorting_entire_node
)
if
(
sorting_entire_node
)
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_sort
],
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_
node_
sort
],
start_time
);
start_time
);
/* Make sure we preserve bset journal_seq: */
/* Make sure we preserve bset journal_seq: */
...
@@ -403,7 +403,8 @@ void bch2_btree_sort_into(struct bch_fs *c,
...
@@ -403,7 +403,8 @@ void bch2_btree_sort_into(struct bch_fs *c,
&
dst
->
format
,
&
dst
->
format
,
true
);
true
);
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_sort
],
start_time
);
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_node_sort
],
start_time
);
set_btree_bset_end
(
dst
,
dst
->
set
);
set_btree_bset_end
(
dst
,
dst
->
set
);
...
@@ -988,7 +989,8 @@ static void btree_node_read_work(struct work_struct *work)
...
@@ -988,7 +989,8 @@ static void btree_node_read_work(struct work_struct *work)
}
}
}
}
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_read
],
rb
->
start_time
);
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_node_read
],
rb
->
start_time
);
bio_put
(
&
rb
->
bio
);
bio_put
(
&
rb
->
bio
);
clear_btree_node_read_in_flight
(
b
);
clear_btree_node_read_in_flight
(
b
);
wake_up_bit
(
&
b
->
flags
,
BTREE_NODE_read_in_flight
);
wake_up_bit
(
&
b
->
flags
,
BTREE_NODE_read_in_flight
);
...
...
fs/bcachefs/btree_types.h
View file @
dc3b63dc
...
@@ -274,6 +274,7 @@ struct btree_insert_entry {
...
@@ -274,6 +274,7 @@ struct btree_insert_entry {
struct
btree_trans
{
struct
btree_trans
{
struct
bch_fs
*
c
;
struct
bch_fs
*
c
;
size_t
nr_restarts
;
size_t
nr_restarts
;
u64
commit_start
;
u64
iters_live
;
u64
iters_live
;
u64
iters_linked
;
u64
iters_linked
;
...
...
fs/bcachefs/btree_update_interior.c
View file @
dc3b63dc
...
@@ -1440,7 +1440,8 @@ static void btree_split(struct btree_update *as, struct btree *b,
...
@@ -1440,7 +1440,8 @@ static void btree_split(struct btree_update *as, struct btree *b,
bch2_btree_iter_verify_locks
(
iter
);
bch2_btree_iter_verify_locks
(
iter
);
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_split
],
start_time
);
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_node_split
],
start_time
);
}
}
static
void
static
void
...
...
fs/bcachefs/btree_update_leaf.c
View file @
dc3b63dc
...
@@ -824,10 +824,10 @@ int bch2_trans_commit(struct btree_trans *trans,
...
@@ -824,10 +824,10 @@ int bch2_trans_commit(struct btree_trans *trans,
{
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
struct
btree_insert_entry
*
i
;
int
ret
;
int
ret
=
0
;
if
(
!
trans
->
nr_updates
)
if
(
!
trans
->
nr_updates
)
return
0
;
goto
out
;
/* for the sake of sanity: */
/* for the sake of sanity: */
BUG_ON
(
trans
->
nr_updates
>
1
&&
!
(
flags
&
BTREE_INSERT_ATOMIC
));
BUG_ON
(
trans
->
nr_updates
>
1
&&
!
(
flags
&
BTREE_INSERT_ATOMIC
));
...
@@ -850,6 +850,9 @@ int bch2_trans_commit(struct btree_trans *trans,
...
@@ -850,6 +850,9 @@ int bch2_trans_commit(struct btree_trans *trans,
!
percpu_ref_tryget
(
&
c
->
writes
)))
!
percpu_ref_tryget
(
&
c
->
writes
)))
return
-
EROFS
;
return
-
EROFS
;
if
(
!
trans
->
commit_start
)
trans
->
commit_start
=
local_clock
();
ret
=
bch2_trans_journal_preres_get
(
trans
);
ret
=
bch2_trans_journal_preres_get
(
trans
);
if
(
ret
)
if
(
ret
)
goto
err
;
goto
err
;
...
@@ -860,6 +863,12 @@ int bch2_trans_commit(struct btree_trans *trans,
...
@@ -860,6 +863,12 @@ int bch2_trans_commit(struct btree_trans *trans,
if
(
unlikely
(
!
(
trans
->
flags
&
BTREE_INSERT_NOCHECK_RW
)))
if
(
unlikely
(
!
(
trans
->
flags
&
BTREE_INSERT_NOCHECK_RW
)))
percpu_ref_put
(
&
c
->
writes
);
percpu_ref_put
(
&
c
->
writes
);
out:
if
(
!
ret
&&
trans
->
commit_start
)
{
bch2_time_stats_update
(
&
c
->
times
[
BCH_TIME_btree_update
],
trans
->
commit_start
);
trans
->
commit_start
=
0
;
}
trans
->
nr_updates
=
0
;
trans
->
nr_updates
=
0
;
...
...
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