From dd46d0403d3c9f458b86a44baae3f67145cab9b8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 25 Mar 2022 17:31:05 +0100 Subject: [PATCH] Revert "ANDROID: fs: FS tracepoints to track IO." 5.18-rc1 has many merge issues and the block io path has been rewritten, so the tracepoints added here do not work properly anymore (and break the build.) If this is really still needed (hint, I strongly doubt it), it can be redesigned and added back after 5.18-rc1 is released. Cc: Mohan Srinivasan Cc: Amit Pundir Cc: Alistair Strachan Fixes: f2fe7bac26dc ("ANDROID: fs: FS tracepoints to track IO.") Signed-off-by: Greg Kroah-Hartman Change-Id: I64981f2f692a434b976e50677d3414037d5ee409 --- fs/ext4/inline.c | 14 ----- fs/ext4/inode.c | 24 -------- fs/ext4/readpage.c | 47 ++------------- fs/f2fs/data.c | 18 ------ fs/f2fs/file.c | 25 -------- fs/f2fs/inline.c | 18 ------ fs/mpage.c | 36 ------------ include/trace/events/android_fs.h | 66 ---------------------- include/trace/events/android_fs_template.h | 64 --------------------- 9 files changed, 4 insertions(+), 308 deletions(-) delete mode 100644 include/trace/events/android_fs.h delete mode 100644 include/trace/events/android_fs_template.h diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index c23b3424f71b..46fdb40c3962 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -13,7 +13,6 @@ #include "ext4.h" #include "xattr.h" #include "truncate.h" -#include #define EXT4_XATTR_SYSTEM_DATA "data" #define EXT4_MIN_INLINE_DATA_SIZE ((sizeof(__le32) * EXT4_N_BLOCKS)) @@ -510,17 +509,6 @@ int ext4_readpage_inline(struct inode *inode, struct page *page) return -EAGAIN; } - if (trace_android_fs_dataread_start_enabled()) { - 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, * So for all the other pages, just set them uptodate. @@ -532,8 +520,6 @@ int ext4_readpage_inline(struct inode *inode, struct page *page) SetPageUptodate(page); } - trace_android_fs_dataread_end(inode, page_offset(page), PAGE_SIZE); - up_read(&EXT4_I(inode)->xattr_sem); unlock_page(page); diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ff1f9c2cfeb4..91aacce39069 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -48,7 +48,6 @@ #include "truncate.h" #include -#include static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw, struct ext4_inode_info *ei) @@ -1146,16 +1145,6 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping, if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) return -EIO; - if (trace_android_fs_datawrite_start_enabled()) { - 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); /* * Reserve one block more for addition to orphan list in case @@ -1298,7 +1287,6 @@ static int ext4_write_end(struct file *file, int i_size_changed = 0; bool verity = ext4_verity_in_progress(inode); - trace_android_fs_datawrite_end(inode, pos, len); trace_ext4_write_end(inode, pos, len, copied); if (ext4_has_inline_data(inode)) @@ -1402,7 +1390,6 @@ static int ext4_journalled_write_end(struct file *file, int size_changed = 0; bool verity = ext4_verity_in_progress(inode); - trace_android_fs_datawrite_end(inode, pos, len); trace_ext4_journalled_write_end(inode, pos, len, copied); from = pos & (PAGE_SIZE - 1); to = from + len; @@ -2964,16 +2951,6 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, len, flags, pagep, fsdata); } *fsdata = (void *)0; - if (trace_android_fs_datawrite_start_enabled()) { - 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); if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { @@ -3058,7 +3035,6 @@ static int ext4_da_write_end(struct file *file, return ext4_write_end(file, mapping, pos, len, copied, page, fsdata); - trace_android_fs_datawrite_end(inode, pos, len); trace_ext4_da_write_end(inode, pos, len, copied); if (write_mode != CONVERT_INLINE_DATA && diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index fdabff565d62..3db923403505 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -46,7 +46,6 @@ #include #include "ext4.h" -#include #define NUM_PREALLOC_POST_READ_CTXS 128 @@ -160,17 +159,6 @@ static bool bio_post_read_required(struct bio *bio) return bio->bi_private && !bio->bi_status; } -static void -ext4_trace_read_completion(struct bio *bio) -{ - struct page *first_page = bio->bi_io_vec[0].bv_page; - - if (first_page != NULL) - trace_android_fs_dataread_end(first_page->mapping->host, - page_offset(first_page), - bio->bi_iter.bi_size); -} - /* * I/O completion handler for multipage BIOs. * @@ -185,9 +173,6 @@ ext4_trace_read_completion(struct bio *bio) */ static void mpage_end_io(struct bio *bio) { - if (trace_android_fs_dataread_start_enabled()) - ext4_trace_read_completion(bio); - if (bio_post_read_required(bio)) { struct bio_post_read_ctx *ctx = bio->bi_private; @@ -236,30 +221,6 @@ static inline loff_t ext4_readpage_limit(struct inode *inode) return i_size_read(inode); } -static void -ext4_submit_bio_read(struct bio *bio) -{ - if (trace_android_fs_dataread_start_enabled()) { - struct page *first_page = bio->bi_io_vec[0].bv_page; - - 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( - first_page->mapping->host, - page_offset(first_page), - bio->bi_iter.bi_size, - current->pid, - path, - current->comm); - } - } - submit_bio(bio); -} - int ext4_mpage_readpages(struct inode *inode, struct readahead_control *rac, struct page *page) { @@ -402,7 +363,7 @@ int ext4_mpage_readpages(struct inode *inode, if (bio && (last_block_in_bio != blocks[0] - 1 || !fscrypt_mergeable_bio(bio, inode, next_block))) { submit_and_realloc: - ext4_submit_bio_read(bio); + submit_bio(bio); bio = NULL; } if (bio == NULL) { @@ -428,14 +389,14 @@ int ext4_mpage_readpages(struct inode *inode, if (((map.m_flags & EXT4_MAP_BOUNDARY) && (relative_block == map.m_len)) || (first_hole != blocks_per_page)) { - ext4_submit_bio_read(bio); + submit_bio(bio); bio = NULL; } else last_block_in_bio = blocks[blocks_per_page - 1]; goto next_page; confused: if (bio) { - ext4_submit_bio_read(bio); + submit_bio(bio); bio = NULL; } if (!PageUptodate(page)) @@ -447,7 +408,7 @@ int ext4_mpage_readpages(struct inode *inode, put_page(page); } if (bio) - ext4_submit_bio_read(bio); + submit_bio(bio); return 0; } diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 92bf7eab3154..a3e391bb1364 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -28,7 +28,6 @@ #include "segment.h" #include "iostat.h" #include -#include #define NUM_PREALLOC_POST_READ_CTXS 128 @@ -3466,22 +3465,6 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, block_t blkaddr = NULL_ADDR; int err = 0; - /* - * Should avoid quota operations which can make deadlock: - * kswapd -> f2fs_evict_inode -> dquot_drop -> - * f2fs_dquot_commit -> f2fs_write_begin -> - * d_obtain_alias -> __d_alloc -> kmem_cache_alloc(GFP_KERNEL) - */ - if (trace_android_fs_datawrite_start_enabled() && !IS_NOQUOTA(inode)) { - 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); if (!f2fs_is_checkpoint_ready(sbi)) { @@ -3606,7 +3589,6 @@ static int f2fs_write_end(struct file *file, { struct inode *inode = page->mapping->host; - trace_android_fs_datawrite_end(inode, pos, len); trace_f2fs_write_end(inode, pos, len, copied); /* diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 30e7d8f3051a..1f7cf321cb60 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -34,7 +34,6 @@ #include "gc.h" #include "iostat.h" #include -#include #include static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf) @@ -4217,16 +4216,6 @@ static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to) return 0; /* skip atime update */ trace_f2fs_direct_IO_enter(inode, iocb, count, READ); - if (trace_android_fs_dataread_start_enabled()) { - char *path, pathbuf[MAX_TRACE_PATHBUF_LEN]; - - path = android_fstrace_get_pathname(pathbuf, - MAX_TRACE_PATHBUF_LEN, - inode); - trace_android_fs_dataread_start(inode, pos, - count, current->pid, path, - current->comm); - } if (iocb->ki_flags & IOCB_NOWAIT) { if (!f2fs_down_read_trylock(&fi->i_gc_rwsem[READ])) { @@ -4257,8 +4246,6 @@ static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to) file_accessed(file); out: - if (trace_android_fs_dataread_start_enabled()) - trace_android_fs_dataread_end(inode, pos, count); trace_f2fs_direct_IO_exit(inode, pos, count, READ, ret); return ret; } @@ -4448,16 +4435,6 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from, ssize_t ret; trace_f2fs_direct_IO_enter(inode, iocb, count, WRITE); - if (trace_android_fs_datawrite_start_enabled()) { - 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, count, - current->pid, path, - current->comm); - } if (iocb->ki_flags & IOCB_NOWAIT) { /* f2fs_convert_inline_inode() and block allocation can block */ @@ -4555,8 +4532,6 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from, *may_need_sync = false; } out: - if (trace_android_fs_datawrite_start_enabled()) - trace_android_fs_datawrite_end(inode, pos, count); trace_f2fs_direct_IO_exit(inode, pos, count, WRITE, ret); return ret; } diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 485f64fe4185..bf46a7dfbea2 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -13,7 +13,6 @@ #include "f2fs.h" #include "node.h" #include -#include static bool support_inline_data(struct inode *inode) { @@ -106,29 +105,14 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page) { struct page *ipage; - if (trace_android_fs_dataread_start_enabled()) { - 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); - } - ipage = f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino); if (IS_ERR(ipage)) { - trace_android_fs_dataread_end(inode, page_offset(page), - PAGE_SIZE); unlock_page(page); return PTR_ERR(ipage); } if (!f2fs_has_inline_data(inode)) { f2fs_put_page(ipage, 1); - trace_android_fs_dataread_end(inode, page_offset(page), - PAGE_SIZE); return -EAGAIN; } @@ -140,8 +124,6 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page) if (!PageUptodate(page)) SetPageUptodate(page); f2fs_put_page(ipage, 1); - trace_android_fs_dataread_end(inode, page_offset(page), - PAGE_SIZE); unlock_page(page); return 0; } diff --git a/fs/mpage.c b/fs/mpage.c index fd74199d16c9..2f48fe4eec95 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -32,14 +32,6 @@ #include #include "internal.h" -#define CREATE_TRACE_POINTS -#include - -EXPORT_TRACEPOINT_SYMBOL(android_fs_datawrite_start); -EXPORT_TRACEPOINT_SYMBOL(android_fs_datawrite_end); -EXPORT_TRACEPOINT_SYMBOL(android_fs_dataread_start); -EXPORT_TRACEPOINT_SYMBOL(android_fs_dataread_end); - /* * I/O completion handler for multipage BIOs. * @@ -57,16 +49,6 @@ static void mpage_end_io(struct bio *bio) struct bio_vec *bv; struct bvec_iter_all iter_all; - if (trace_android_fs_dataread_end_enabled() && - (bio_data_dir(bio) == READ)) { - struct page *first_page = bio->bi_io_vec[0].bv_page; - - if (first_page != NULL) - trace_android_fs_dataread_end(first_page->mapping->host, - page_offset(first_page), - bio->bi_iter.bi_size); - } - bio_for_each_segment_all(bv, bio, iter_all) { struct page *page = bv->bv_page; page_endio(page, bio_op(bio), @@ -78,24 +60,6 @@ static void mpage_end_io(struct bio *bio) static struct bio *mpage_bio_submit(int op, int op_flags, struct bio *bio) { - if (trace_android_fs_dataread_start_enabled() && (op == REQ_OP_READ)) { - struct page *first_page = bio->bi_io_vec[0].bv_page; - - 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( - first_page->mapping->host, - page_offset(first_page), - bio->bi_iter.bi_size, - current->pid, - path, - current->comm); - } - } bio->bi_end_io = mpage_end_io; bio_set_op_attrs(bio, op, op_flags); guard_bio_eod(bio); diff --git a/include/trace/events/android_fs.h b/include/trace/events/android_fs.h deleted file mode 100644 index 7edb6bcfe482..000000000000 --- a/include/trace/events/android_fs.h +++ /dev/null @@ -1,66 +0,0 @@ -#undef TRACE_SYSTEM -#define TRACE_SYSTEM android_fs - -#if !defined(_TRACE_ANDROID_FS_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_ANDROID_FS_H - -#include -#include -#include - -DEFINE_EVENT(android_fs_data_start_template, android_fs_dataread_start, - TP_PROTO(struct inode *inode, loff_t offset, int bytes, - pid_t pid, char *pathname, char *command), - TP_ARGS(inode, offset, bytes, pid, pathname, command)); - -DEFINE_EVENT(android_fs_data_end_template, android_fs_dataread_end, - TP_PROTO(struct inode *inode, loff_t offset, int bytes), - TP_ARGS(inode, offset, bytes)); - -DEFINE_EVENT(android_fs_data_start_template, android_fs_datawrite_start, - TP_PROTO(struct inode *inode, loff_t offset, int bytes, - pid_t pid, char *pathname, char *command), - TP_ARGS(inode, offset, bytes, pid, pathname, command)); - -DEFINE_EVENT(android_fs_data_end_template, android_fs_datawrite_end, - TP_PROTO(struct inode *inode, loff_t offset, int bytes), - TP_ARGS(inode, offset, bytes)); - -#endif /* _TRACE_ANDROID_FS_H */ - -/* This part must be outside protection */ -#include - -#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 diff --git a/include/trace/events/android_fs_template.h b/include/trace/events/android_fs_template.h deleted file mode 100644 index efc487816e83..000000000000 --- a/include/trace/events/android_fs_template.h +++ /dev/null @@ -1,64 +0,0 @@ -#if !defined(_TRACE_ANDROID_FS_TEMPLATE_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_ANDROID_FS_TEMPLATE_H - -#include - -DECLARE_EVENT_CLASS(android_fs_data_start_template, - TP_PROTO(struct inode *inode, loff_t offset, int bytes, - pid_t pid, char *pathname, char *command), - TP_ARGS(inode, offset, bytes, pid, pathname, command), - TP_STRUCT__entry( - __string(pathbuf, pathname) - __field(loff_t, offset) - __field(int, bytes) - __field(loff_t, i_size) - __string(cmdline, command) - __field(pid_t, pid) - __field(ino_t, ino) - ), - TP_fast_assign( - { - /* - * Replace the spaces in filenames and cmdlines - * because this screws up the tooling that parses - * the traces. - */ - __assign_str(pathbuf, pathname); - (void)strreplace(__get_str(pathbuf), ' ', '_'); - __entry->offset = offset; - __entry->bytes = bytes; - __entry->i_size = i_size_read(inode); - __assign_str(cmdline, command); - (void)strreplace(__get_str(cmdline), ' ', '_'); - __entry->pid = pid; - __entry->ino = inode->i_ino; - } - ), - TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s," - " pid %d, i_size %llu, ino %lu", - __get_str(pathbuf), __entry->offset, __entry->bytes, - __get_str(cmdline), __entry->pid, __entry->i_size, - (unsigned long) __entry->ino) -); - -DECLARE_EVENT_CLASS(android_fs_data_end_template, - TP_PROTO(struct inode *inode, loff_t offset, int bytes), - TP_ARGS(inode, offset, bytes), - TP_STRUCT__entry( - __field(ino_t, ino) - __field(loff_t, offset) - __field(int, bytes) - ), - TP_fast_assign( - { - __entry->ino = inode->i_ino; - __entry->offset = offset; - __entry->bytes = bytes; - } - ), - TP_printk("ino %lu, offset %llu, bytes %d", - (unsigned long) __entry->ino, - __entry->offset, __entry->bytes) -); - -#endif /* _TRACE_ANDROID_FS_TEMPLATE_H */