mirror of https://github.com/OpenIPC/firmware.git
111 lines
2.8 KiB
Diff
111 lines
2.8 KiB
Diff
diff -drupN a/fs/ext4/readpage.c b/fs/ext4/readpage.c
|
|
--- a/fs/ext4/readpage.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/fs/ext4/readpage.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -45,6 +45,7 @@
|
|
#include <linux/cleancache.h>
|
|
|
|
#include "ext4.h"
|
|
+#include <trace/events/android_fs.h>
|
|
|
|
static inline bool ext4_bio_encrypted(struct bio *bio)
|
|
{
|
|
@@ -55,6 +56,17 @@ static inline bool ext4_bio_encrypted(st
|
|
#endif
|
|
}
|
|
|
|
+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.
|
|
*
|
|
@@ -72,11 +84,14 @@ static void mpage_end_io(struct bio *bio
|
|
struct bio_vec *bv;
|
|
int i;
|
|
|
|
+ if (trace_android_fs_dataread_start_enabled())
|
|
+ ext4_trace_read_completion(bio);
|
|
+
|
|
if (ext4_bio_encrypted(bio)) {
|
|
if (bio->bi_error) {
|
|
fscrypt_release_ctx(bio->bi_private);
|
|
} else {
|
|
- fscrypt_decrypt_bio_pages(bio->bi_private, bio);
|
|
+ fscrypt_enqueue_decrypt_bio(bio->bi_private, bio);
|
|
return;
|
|
}
|
|
}
|
|
@@ -95,6 +110,30 @@ static void mpage_end_io(struct bio *bio
|
|
bio_put(bio);
|
|
}
|
|
|
|
+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 address_space *mapping,
|
|
struct list_head *pages, struct page *page,
|
|
unsigned nr_pages)
|
|
@@ -235,7 +274,7 @@ int ext4_mpage_readpages(struct address_
|
|
*/
|
|
if (bio && (last_block_in_bio != blocks[0] - 1)) {
|
|
submit_and_realloc:
|
|
- submit_bio(bio);
|
|
+ ext4_submit_bio_read(bio);
|
|
bio = NULL;
|
|
}
|
|
if (bio == NULL) {
|
|
@@ -268,14 +307,14 @@ int ext4_mpage_readpages(struct address_
|
|
if (((map.m_flags & EXT4_MAP_BOUNDARY) &&
|
|
(relative_block == map.m_len)) ||
|
|
(first_hole != blocks_per_page)) {
|
|
- submit_bio(bio);
|
|
+ ext4_submit_bio_read(bio);
|
|
bio = NULL;
|
|
} else
|
|
last_block_in_bio = blocks[blocks_per_page - 1];
|
|
goto next_page;
|
|
confused:
|
|
if (bio) {
|
|
- submit_bio(bio);
|
|
+ ext4_submit_bio_read(bio);
|
|
bio = NULL;
|
|
}
|
|
if (!PageUptodate(page))
|
|
@@ -288,6 +327,6 @@ int ext4_mpage_readpages(struct address_
|
|
}
|
|
BUG_ON(pages && !list_empty(pages));
|
|
if (bio)
|
|
- submit_bio(bio);
|
|
+ ext4_submit_bio_read(bio);
|
|
return 0;
|
|
}
|