Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b894d59b authored by Mohan Srinivasan's avatar Mohan Srinivasan
Browse files

ANDROID: Refactor fs readpage/write tracepoints.



Refactor the fs readpage/write tracepoints to move the
inode->path lookup outside the tracepoint code, and pass a pointer
to the path into the tracepoint code instead. This is necessary
because the tracepoint code runs non-preemptible. Thanks to
Trilok Soni for catching this in 4.4. Backported from 4.4

Signed-off-by: default avatarMohan Srinivasan <srmohan@google.com>
parent eb0ddffc
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -502,8 +502,16 @@ int ext4_readpage_inline(struct inode *inode, struct page *page)
		return -EAGAIN;
	}

	trace_android_fs_dataread_start(inode, page_offset(page), PAGE_SIZE,
					current->pid, current->comm);
	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,
+36 −8
Original line number Diff line number Diff line
@@ -979,8 +979,16 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
	pgoff_t index;
	unsigned from, to;

	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, current->comm);
						 current->pid, path,
						 current->comm);
	}
	trace_ext4_write_begin(inode, pos, len, flags);
	/*
	 * Reserve one block more for addition to orphan list in case
@@ -2638,8 +2646,16 @@ 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, current->comm);
						 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)) {
@@ -3235,14 +3251,26 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
	if (ext4_has_inline_data(inode))
		return 0;

	if (trace_android_fs_dataread_start_enabled() && (rw == READ))
	if (trace_android_fs_dataread_start_enabled() && (rw == READ)) {
		char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];

		path = android_fstrace_get_pathname(pathbuf,
						    MAX_TRACE_PATHBUF_LEN,
						    inode);
		trace_android_fs_dataread_start(inode, offset, count,
						current->pid,
						current->pid, path,
						current->comm);
	if (trace_android_fs_datawrite_start_enabled() && (rw == WRITE))
	}
	if (trace_android_fs_datawrite_start_enabled() && (rw == 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,
						 current->pid, path,
						 current->comm);
	}

	trace_ext4_direct_IO_enter(inode, offset, count, rw);
	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
+6 −0
Original line number Diff line number Diff line
@@ -152,11 +152,17 @@ ext4_submit_bio_read(struct bio *bio)
		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);
		}
	}
+27 −6
Original line number Diff line number Diff line
@@ -957,8 +957,16 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
	struct dnode_of_data dn;
	int err = 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, current->comm);
						 current->pid, path,
						 current->comm);
	}
	trace_f2fs_write_begin(inode, pos, len, flags);

	f2fs_balance_fs(sbi);
@@ -1104,13 +1112,26 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb,
	if (check_direct_IO(inode, rw, iter, offset))
		return 0;

	if (trace_android_fs_dataread_start_enabled() && (rw == READ))
	if (trace_android_fs_dataread_start_enabled() && (rw == READ)) {
		char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];

		path = android_fstrace_get_pathname(pathbuf,
						    MAX_TRACE_PATHBUF_LEN,
						    inode);
		trace_android_fs_dataread_start(inode, offset,
						count, current->pid,
						count, current->pid, path,
						current->comm);
	if (trace_android_fs_datawrite_start_enabled() && (rw == WRITE))
	}
	if (trace_android_fs_datawrite_start_enabled() && (rw == 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, current->comm);
						 current->pid, path,
						 current->comm);
	}

	trace_f2fs_direct_IO_enter(inode, offset, count, rw);

+10 −3
Original line number Diff line number Diff line
@@ -41,9 +41,16 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page)
	struct page *ipage;
	void *src_addr, *dst_addr;

	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,
					current->comm);
						path, current->comm);
	}

	if (page->index) {
		zero_user_segment(page, 0, PAGE_CACHE_SIZE);
Loading