Merge "ANDROID: Refactor fs readpage/write tracepoints."
This commit is contained in:
commit
a4da2aadd9
8 changed files with 147 additions and 61 deletions
|
@ -503,8 +503,16 @@ int ext4_readpage_inline(struct inode *inode, struct page *page)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_android_fs_dataread_start(inode, page_offset(page), PAGE_SIZE,
|
if (trace_android_fs_dataread_start_enabled()) {
|
||||||
current->pid, current->comm);
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_dataread_start(inode, page_offset(page),
|
||||||
|
PAGE_SIZE, current->pid,
|
||||||
|
path, current->comm);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current inline data can only exist in the 1st page,
|
* Current inline data can only exist in the 1st page,
|
||||||
|
|
|
@ -1019,8 +1019,16 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
|
||||||
pgoff_t index;
|
pgoff_t index;
|
||||||
unsigned from, to;
|
unsigned from, to;
|
||||||
|
|
||||||
trace_android_fs_datawrite_start(inode, pos, len,
|
if (trace_android_fs_datawrite_start_enabled()) {
|
||||||
current->pid, current->comm);
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_datawrite_start(inode, pos, len,
|
||||||
|
current->pid, path,
|
||||||
|
current->comm);
|
||||||
|
}
|
||||||
trace_ext4_write_begin(inode, pos, len, flags);
|
trace_ext4_write_begin(inode, pos, len, flags);
|
||||||
/*
|
/*
|
||||||
* Reserve one block more for addition to orphan list in case
|
* Reserve one block more for addition to orphan list in case
|
||||||
|
@ -2747,8 +2755,16 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
|
||||||
len, flags, pagep, fsdata);
|
len, flags, pagep, fsdata);
|
||||||
}
|
}
|
||||||
*fsdata = (void *)0;
|
*fsdata = (void *)0;
|
||||||
trace_android_fs_datawrite_start(inode, pos, len,
|
if (trace_android_fs_datawrite_start_enabled()) {
|
||||||
current->pid, current->comm);
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_datawrite_start(inode, pos, len,
|
||||||
|
current->pid,
|
||||||
|
path, current->comm);
|
||||||
|
}
|
||||||
trace_ext4_da_write_begin(inode, pos, len, flags);
|
trace_ext4_da_write_begin(inode, pos, len, flags);
|
||||||
|
|
||||||
if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) {
|
if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) {
|
||||||
|
@ -3361,16 +3377,27 @@ static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (trace_android_fs_dataread_start_enabled() &&
|
if (trace_android_fs_dataread_start_enabled() &&
|
||||||
(iov_iter_rw(iter) == READ))
|
(iov_iter_rw(iter) == READ)) {
|
||||||
trace_android_fs_dataread_start(inode, offset, count,
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
current->pid,
|
|
||||||
current->comm);
|
|
||||||
if (trace_android_fs_datawrite_start_enabled() &&
|
|
||||||
(iov_iter_rw(iter) == WRITE))
|
|
||||||
trace_android_fs_datawrite_start(inode, offset, count,
|
|
||||||
current->pid,
|
|
||||||
current->comm);
|
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_dataread_start(inode, offset, count,
|
||||||
|
current->pid, path,
|
||||||
|
current->comm);
|
||||||
|
}
|
||||||
|
if (trace_android_fs_datawrite_start_enabled() &&
|
||||||
|
(iov_iter_rw(iter) == WRITE)) {
|
||||||
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_datawrite_start(inode, offset, count,
|
||||||
|
current->pid, path,
|
||||||
|
current->comm);
|
||||||
|
}
|
||||||
trace_ext4_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));
|
trace_ext4_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));
|
||||||
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
|
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
|
||||||
ret = ext4_ext_direct_IO(iocb, iter, offset);
|
ret = ext4_ext_direct_IO(iocb, iter, offset);
|
||||||
|
|
|
@ -158,11 +158,17 @@ ext4_submit_bio_read(struct bio *bio)
|
||||||
struct page *first_page = bio->bi_io_vec[0].bv_page;
|
struct page *first_page = bio->bi_io_vec[0].bv_page;
|
||||||
|
|
||||||
if (first_page != NULL) {
|
if (first_page != NULL) {
|
||||||
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
first_page->mapping->host);
|
||||||
trace_android_fs_dataread_start(
|
trace_android_fs_dataread_start(
|
||||||
first_page->mapping->host,
|
first_page->mapping->host,
|
||||||
page_offset(first_page),
|
page_offset(first_page),
|
||||||
bio->bi_iter.bi_size,
|
bio->bi_iter.bi_size,
|
||||||
current->pid,
|
current->pid,
|
||||||
|
path,
|
||||||
current->comm);
|
current->comm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1406,8 +1406,16 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
|
||||||
struct dnode_of_data dn;
|
struct dnode_of_data dn;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
trace_android_fs_datawrite_start(inode, pos, len,
|
if (trace_android_fs_datawrite_start_enabled()) {
|
||||||
current->pid, current->comm);
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_datawrite_start(inode, pos, len,
|
||||||
|
current->pid, path,
|
||||||
|
current->comm);
|
||||||
|
}
|
||||||
trace_f2fs_write_begin(inode, pos, len, flags);
|
trace_f2fs_write_begin(inode, pos, len, flags);
|
||||||
|
|
||||||
f2fs_balance_fs(sbi);
|
f2fs_balance_fs(sbi);
|
||||||
|
@ -1591,15 +1599,27 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
|
||||||
trace_f2fs_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));
|
trace_f2fs_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));
|
||||||
|
|
||||||
if (trace_android_fs_dataread_start_enabled() &&
|
if (trace_android_fs_dataread_start_enabled() &&
|
||||||
(iov_iter_rw(iter) == READ))
|
(iov_iter_rw(iter) == READ)) {
|
||||||
trace_android_fs_dataread_start(inode, offset,
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
count, current->pid,
|
|
||||||
current->comm);
|
|
||||||
if (trace_android_fs_datawrite_start_enabled() &&
|
|
||||||
(iov_iter_rw(iter) == WRITE))
|
|
||||||
trace_android_fs_datawrite_start(inode, offset, count,
|
|
||||||
current->pid, current->comm);
|
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_dataread_start(inode, offset,
|
||||||
|
count, current->pid, path,
|
||||||
|
current->comm);
|
||||||
|
}
|
||||||
|
if (trace_android_fs_datawrite_start_enabled() &&
|
||||||
|
(iov_iter_rw(iter) == WRITE)) {
|
||||||
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_datawrite_start(inode, offset, count,
|
||||||
|
current->pid, path,
|
||||||
|
current->comm);
|
||||||
|
}
|
||||||
if (iov_iter_rw(iter) == WRITE) {
|
if (iov_iter_rw(iter) == WRITE) {
|
||||||
__allocate_data_blocks(inode, offset, count);
|
__allocate_data_blocks(inode, offset, count);
|
||||||
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) {
|
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) {
|
||||||
|
|
|
@ -85,9 +85,16 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page)
|
||||||
{
|
{
|
||||||
struct page *ipage;
|
struct page *ipage;
|
||||||
|
|
||||||
trace_android_fs_dataread_start(inode, page_offset(page),
|
if (trace_android_fs_dataread_start_enabled()) {
|
||||||
PAGE_SIZE, current->pid,
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
current->comm);
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
inode);
|
||||||
|
trace_android_fs_dataread_start(inode, page_offset(page),
|
||||||
|
PAGE_SIZE, current->pid,
|
||||||
|
path, current->comm);
|
||||||
|
}
|
||||||
|
|
||||||
ipage = get_node_page(F2FS_I_SB(inode), inode->i_ino);
|
ipage = get_node_page(F2FS_I_SB(inode), inode->i_ino);
|
||||||
if (IS_ERR(ipage)) {
|
if (IS_ERR(ipage)) {
|
||||||
|
|
|
@ -79,11 +79,17 @@ static struct bio *mpage_bio_submit(int rw, struct bio *bio)
|
||||||
struct page *first_page = bio->bi_io_vec[0].bv_page;
|
struct page *first_page = bio->bi_io_vec[0].bv_page;
|
||||||
|
|
||||||
if (first_page != NULL) {
|
if (first_page != NULL) {
|
||||||
|
char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];
|
||||||
|
|
||||||
|
path = android_fstrace_get_pathname(pathbuf,
|
||||||
|
MAX_TRACE_PATHBUF_LEN,
|
||||||
|
first_page->mapping->host);
|
||||||
trace_android_fs_dataread_start(
|
trace_android_fs_dataread_start(
|
||||||
first_page->mapping->host,
|
first_page->mapping->host,
|
||||||
page_offset(first_page),
|
page_offset(first_page),
|
||||||
bio->bi_iter.bi_size,
|
bio->bi_iter.bi_size,
|
||||||
current->pid,
|
current->pid,
|
||||||
|
path,
|
||||||
current->comm);
|
current->comm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
DEFINE_EVENT(android_fs_data_start_template, android_fs_dataread_start,
|
DEFINE_EVENT(android_fs_data_start_template, android_fs_dataread_start,
|
||||||
TP_PROTO(struct inode *inode, loff_t offset, int bytes,
|
TP_PROTO(struct inode *inode, loff_t offset, int bytes,
|
||||||
pid_t pid, char *command),
|
pid_t pid, char *pathname, char *command),
|
||||||
TP_ARGS(inode, offset, bytes, pid, command));
|
TP_ARGS(inode, offset, bytes, pid, pathname, command));
|
||||||
|
|
||||||
DEFINE_EVENT(android_fs_data_end_template, android_fs_dataread_end,
|
DEFINE_EVENT(android_fs_data_end_template, android_fs_dataread_end,
|
||||||
TP_PROTO(struct inode *inode, loff_t offset, int bytes),
|
TP_PROTO(struct inode *inode, loff_t offset, int bytes),
|
||||||
|
@ -18,14 +18,48 @@ DEFINE_EVENT(android_fs_data_end_template, android_fs_dataread_end,
|
||||||
|
|
||||||
DEFINE_EVENT(android_fs_data_start_template, android_fs_datawrite_start,
|
DEFINE_EVENT(android_fs_data_start_template, android_fs_datawrite_start,
|
||||||
TP_PROTO(struct inode *inode, loff_t offset, int bytes,
|
TP_PROTO(struct inode *inode, loff_t offset, int bytes,
|
||||||
pid_t pid, char *command),
|
pid_t pid, char *pathname, char *command),
|
||||||
TP_ARGS(inode, offset, bytes, pid, command));
|
TP_ARGS(inode, offset, bytes, pid, pathname, command));
|
||||||
|
|
||||||
DEFINE_EVENT(android_fs_data_end_template, android_fs_datawrite_end,
|
DEFINE_EVENT(android_fs_data_end_template, android_fs_datawrite_end,
|
||||||
TP_PROTO(struct inode *inode, loff_t offset, int bytes),
|
TP_PROTO(struct inode *inode, loff_t offset, int bytes),
|
||||||
TP_ARGS(inode, offset, bytes));
|
TP_ARGS(inode, offset, bytes));
|
||||||
|
|
||||||
#endif /* _TRACE_ANDROID_FS_H */
|
#endif /* _TRACE_ANDROID_FS_H */
|
||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
||||||
|
#ifndef ANDROID_FSTRACE_GET_PATHNAME
|
||||||
|
#define ANDROID_FSTRACE_GET_PATHNAME
|
||||||
|
|
||||||
|
/* Sizes an on-stack array, so careful if sizing this up ! */
|
||||||
|
#define MAX_TRACE_PATHBUF_LEN 256
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
android_fstrace_get_pathname(char *buf, int buflen, struct inode *inode)
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
struct dentry *d;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* d_obtain_alias() will either iput() if it locates an existing
|
||||||
|
* dentry or transfer the reference to the new dentry created.
|
||||||
|
* So get an extra reference here.
|
||||||
|
*/
|
||||||
|
ihold(inode);
|
||||||
|
d = d_obtain_alias(inode);
|
||||||
|
if (likely(!IS_ERR(d))) {
|
||||||
|
path = dentry_path_raw(d, buf, buflen);
|
||||||
|
if (unlikely(IS_ERR(path))) {
|
||||||
|
strcpy(buf, "ERROR");
|
||||||
|
path = buf;
|
||||||
|
}
|
||||||
|
dput(d);
|
||||||
|
} else {
|
||||||
|
strcpy(buf, "ERROR");
|
||||||
|
path = buf;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -5,11 +5,10 @@
|
||||||
|
|
||||||
DECLARE_EVENT_CLASS(android_fs_data_start_template,
|
DECLARE_EVENT_CLASS(android_fs_data_start_template,
|
||||||
TP_PROTO(struct inode *inode, loff_t offset, int bytes,
|
TP_PROTO(struct inode *inode, loff_t offset, int bytes,
|
||||||
pid_t pid, char *command),
|
pid_t pid, char *pathname, char *command),
|
||||||
TP_ARGS(inode, offset, bytes, pid, command),
|
TP_ARGS(inode, offset, bytes, pid, pathname, command),
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
__array(char, path, MAX_FILTER_STR_VAL);
|
__string(pathbuf, pathname);
|
||||||
__field(char *, pathname);
|
|
||||||
__field(loff_t, offset);
|
__field(loff_t, offset);
|
||||||
__field(int, bytes);
|
__field(int, bytes);
|
||||||
__field(loff_t, i_size);
|
__field(loff_t, i_size);
|
||||||
|
@ -19,27 +18,7 @@ DECLARE_EVENT_CLASS(android_fs_data_start_template,
|
||||||
),
|
),
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
{
|
{
|
||||||
struct dentry *d;
|
__assign_str(pathbuf, pathname);
|
||||||
|
|
||||||
/*
|
|
||||||
* Grab a reference to the inode here because
|
|
||||||
* d_obtain_alias() will either drop the inode
|
|
||||||
* reference if it locates an existing dentry
|
|
||||||
* or transfer the reference to the new dentry
|
|
||||||
* created. In our case, the file is still open,
|
|
||||||
* so the dentry is guaranteed to exist (connected),
|
|
||||||
* so d_obtain_alias() drops the reference we
|
|
||||||
* grabbed here.
|
|
||||||
*/
|
|
||||||
ihold(inode);
|
|
||||||
d = d_obtain_alias(inode);
|
|
||||||
if (!IS_ERR(d)) {
|
|
||||||
__entry->pathname = dentry_path(d,
|
|
||||||
__entry->path,
|
|
||||||
MAX_FILTER_STR_VAL);
|
|
||||||
dput(d);
|
|
||||||
} else
|
|
||||||
__entry->pathname = ERR_PTR(-EINVAL);
|
|
||||||
__entry->offset = offset;
|
__entry->offset = offset;
|
||||||
__entry->bytes = bytes;
|
__entry->bytes = bytes;
|
||||||
__entry->i_size = i_size_read(inode);
|
__entry->i_size = i_size_read(inode);
|
||||||
|
@ -50,9 +29,8 @@ DECLARE_EVENT_CLASS(android_fs_data_start_template,
|
||||||
),
|
),
|
||||||
TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
|
TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
|
||||||
" pid %d, i_size %llu, ino %lu",
|
" pid %d, i_size %llu, ino %lu",
|
||||||
(IS_ERR(__entry->pathname) ? "ERROR" : __entry->pathname),
|
__get_str(pathbuf), __entry->offset, __entry->bytes,
|
||||||
__entry->offset, __entry->bytes, __get_str(cmdline),
|
__get_str(cmdline), __entry->pid, __entry->i_size,
|
||||||
__entry->pid, __entry->i_size,
|
|
||||||
(unsigned long) __entry->ino)
|
(unsigned long) __entry->ino)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue