diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 92488977dadc..67ff78c73fe9 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -566,3 +566,4 @@ EXPORT_SYMBOL_GPL(GKI_struct_gic_chip_data); #include const struct swap_slots_cache *GKI_struct_swap_slots_cache; EXPORT_SYMBOL_GPL(GKI_struct_swap_slots_cache); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_io_statistics); diff --git a/fs/direct-io.c b/fs/direct-io.c index b4bf6bb10dd8..8dd15277f05d 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -39,6 +39,9 @@ #include #include #include +#ifndef __GENKSYMS__ +#include +#endif #include "internal.h" @@ -1070,6 +1073,11 @@ static int do_direct_IO(struct dio *dio, struct dio_submit *sdio, put_page(page); goto out; } + trace_android_vh_io_statistics(dio->inode->i_mapping, + sdio->block_in_file >> sdio->blkfactor, + this_chunk_blocks >> sdio->blkfactor, + iov_iter_rw(sdio->iter) == READ, true); + sdio->next_block_for_io += this_chunk_blocks; sdio->block_in_file += this_chunk_blocks; diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index fb7f9ecad231..ae073837ccfa 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -11,6 +11,9 @@ #include #include #include +#ifndef __GENKSYMS__ +#include +#endif #include "trace.h" #include "../internal.h" @@ -277,6 +280,8 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, goto out; } + trace_android_vh_io_statistics(inode->i_mapping, pos >> inode->i_blkbits, + nr_pages, !(dio->flags & IOMAP_DIO_WRITE), true); bio = bio_alloc(GFP_KERNEL, nr_pages); fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits, GFP_KERNEL); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index d502c69069f1..ee3c5aaa0a58 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -370,6 +370,10 @@ DECLARE_HOOK(android_vh_do_swap_page_spf, DECLARE_HOOK(android_vh_tune_fault_around_bytes, TP_PROTO(unsigned long *fault_around_bytes), TP_ARGS(fault_around_bytes)); +DECLARE_HOOK(android_vh_io_statistics, + TP_PROTO(struct address_space *mapping, unsigned int index, + unsigned int nr_page, bool read, bool direct), + TP_ARGS(mapping, index, nr_page, read, direct)); DECLARE_HOOK(android_vh_do_anonymous_page, TP_PROTO(struct vm_area_struct *vma, struct page *page), TP_ARGS(vma, page)); diff --git a/mm/filemap.c b/mm/filemap.c index 580c1b90b605..70f130898938 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3525,6 +3525,7 @@ ssize_t generic_perform_write(struct file *file, break; copied = status; + trace_android_vh_io_statistics(mapping, page->index, 1, false, false); cond_resched(); iov_iter_advance(i, copied); diff --git a/mm/readahead.c b/mm/readahead.c index 2db21cbf7745..404fefc7d311 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -222,7 +222,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, read_pages(ractl, &page_pool, true); continue; } - + trace_android_vh_io_statistics(mapping, index + i, 1, true, false); page = __page_cache_alloc(gfp_mask); if (!page) break;