mirror of https://github.com/OpenIPC/firmware.git
61 lines
1.8 KiB
Diff
61 lines
1.8 KiB
Diff
diff -drupN a/fs/mpage.c b/fs/mpage.c
|
|
--- a/fs/mpage.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/fs/mpage.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -31,6 +31,14 @@
|
|
#include <linux/cleancache.h>
|
|
#include "internal.h"
|
|
|
|
+#define CREATE_TRACE_POINTS
|
|
+#include <trace/events/android_fs.h>
|
|
+
|
|
+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.
|
|
*
|
|
@@ -48,6 +56,16 @@ static void mpage_end_io(struct bio *bio
|
|
struct bio_vec *bv;
|
|
int i;
|
|
|
|
+ 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, i) {
|
|
struct page *page = bv->bv_page;
|
|
page_endio(page, op_is_write(bio_op(bio)), bio->bi_error);
|
|
@@ -58,6 +76,24 @@ 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(op, bio);
|