-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
f2fsslower: track IO operations that are slower than a given threshold in F2FS file system #4782
Conversation
…fied functions in the F2FS file system and tracks IO operations that are slower than a given threshold.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reword the subject line and commit message properly.
from time import strftime | ||
|
||
# symbols | ||
kallsyms = "/proc/kallsyms" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move close to where we use it.
tools/f2fsslower.py
Outdated
// calculate delta | ||
u64 ts = bpf_ktime_get_ns(); | ||
u64 delta_us = (ts - valp->ts) / 1000; | ||
entryinfo.delete(&id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do NOT delete the element prematurely. This should be done after perf submit calls.
tools/f2fsslower.py
Outdated
int trace_read_return(struct pt_regs *ctx) | ||
{ | ||
return trace_return(ctx, TRACE_READ); | ||
} | ||
int trace_write_return(struct pt_regs *ctx) | ||
{ | ||
return trace_return(ctx, TRACE_WRITE); | ||
} | ||
int trace_open_return(struct pt_regs *ctx) | ||
{ | ||
return trace_return(ctx, TRACE_OPEN); | ||
} | ||
int trace_fsync_return(struct pt_regs *ctx) | ||
{ | ||
return trace_return(ctx, TRACE_FSYNC); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an empty line between functions.
|
||
# Common file functions. See earlier comment about generic_file_read_iter(). | ||
if BPF.get_kprobe_functions(b'f2fs_file_read_iter'): | ||
b.attach_kprobe(event="f2fs_file_read_iter", fn_name="trace_read_entry") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attach_kretprobe
here we can save an if
block below.
tools/f2fsslower.py
Outdated
else: | ||
b.perf_buffer_poll() | ||
except KeyboardInterrupt: | ||
exit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No newline below ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified the code based on review advice and invite you review again,thank you
tools/f2fsslower.py
Outdated
if (qs.len == 0) | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entryinfo.delete(&id);
before returning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing again,code had modifed based on comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what I asked for. 🤦
entryinfo.delete(&id);
can be done only if valp
is not referenced any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, code had modified for resource clean-up before returning
@chenhengqi @yonghong-song @weibang6liu will you review this bcc tool and commit? |
We have |
add new tool tracing IO operation slower than a given threshold for f2fs file system in Andriod and Linux