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
fdbc9c39
Commit
fdbc9c39
authored
Aug 19, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: bch2_time_stats_reset()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
b36f679c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
fs/bcachefs/sysfs.c
fs/bcachefs/sysfs.c
+8
-1
fs/bcachefs/time_stats.c
fs/bcachefs/time_stats.c
+14
-0
fs/bcachefs/time_stats.h
fs/bcachefs/time_stats.h
+2
-1
No files found.
fs/bcachefs/sysfs.c
View file @
fdbc9c39
...
...
@@ -233,7 +233,7 @@ write_attribute(perf_test);
#define x(_name) \
static struct attribute sysfs_time_stat_##_name = \
{ .name = #_name, .mode = 0
4
44 };
{ .name = #_name, .mode = 0
6
44 };
BCH_TIME_STATS
()
#undef x
...
...
@@ -722,6 +722,13 @@ SHOW(bch2_fs_time_stats)
STORE
(
bch2_fs_time_stats
)
{
struct
bch_fs
*
c
=
container_of
(
kobj
,
struct
bch_fs
,
time_stats
);
#define x(name) \
if (attr == &sysfs_time_stat_##name) \
bch2_time_stats_reset(&c->times[BCH_TIME_##name]);
BCH_TIME_STATS
()
#undef x
return
size
;
}
SYSFS_OPS
(
bch2_fs_time_stats
);
...
...
fs/bcachefs/time_stats.c
View file @
fdbc9c39
...
...
@@ -151,6 +151,20 @@ void __bch2_time_stats_update(struct bch2_time_stats *stats, u64 start, u64 end)
}
}
void
bch2_time_stats_reset
(
struct
bch2_time_stats
*
stats
)
{
spin_lock_irq
(
&
stats
->
lock
);
unsigned
offset
=
offsetof
(
struct
bch2_time_stats
,
min_duration
);
memset
((
void
*
)
stats
+
offset
,
0
,
sizeof
(
*
stats
)
-
offset
);
if
(
stats
->
buffer
)
{
int
cpu
;
for_each_possible_cpu
(
cpu
)
per_cpu_ptr
(
stats
->
buffer
,
cpu
)
->
nr
=
0
;
}
spin_unlock_irq
(
&
stats
->
lock
);
}
void
bch2_time_stats_exit
(
struct
bch2_time_stats
*
stats
)
{
free_percpu
(
stats
->
buffer
);
...
...
fs/bcachefs/time_stats.h
View file @
fdbc9c39
...
...
@@ -70,6 +70,7 @@ struct time_stat_buffer {
struct
bch2_time_stats
{
spinlock_t
lock
;
bool
have_quantiles
;
struct
time_stat_buffer
__percpu
*
buffer
;
/* all fields are in nanoseconds */
u64
min_duration
;
u64
max_duration
;
...
...
@@ -87,7 +88,6 @@ struct bch2_time_stats {
struct
mean_and_variance_weighted
duration_stats_weighted
;
struct
mean_and_variance_weighted
freq_stats_weighted
;
struct
time_stat_buffer
__percpu
*
buffer
;
};
struct
bch2_time_stats_quantiles
{
...
...
@@ -142,6 +142,7 @@ static inline bool track_event_change(struct bch2_time_stats *stats, bool v)
return
false
;
}
void
bch2_time_stats_reset
(
struct
bch2_time_stats
*
);
void
bch2_time_stats_exit
(
struct
bch2_time_stats
*
);
void
bch2_time_stats_init
(
struct
bch2_time_stats
*
);
...
...
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