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

Commit 9bcddfac authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

ANDROID: f2fs: add android fsync tracepoint



Change-Id: Id7c23173f85a835a2294ee698597b7d60f1ee356
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
parent 5a54c65c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "gc.h"
#include "trace.h"
#include <trace/events/f2fs.h>
#include <trace/events/android_fs.h>

static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf)
{
@@ -218,6 +219,15 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,

	trace_f2fs_sync_file_enter(inode);

	if (trace_android_fs_fsync_start_enabled()) {
		char *path, pathbuf[MAX_TRACE_PATHBUF_LEN];

		path = android_fstrace_get_pathname(pathbuf,
				MAX_TRACE_PATHBUF_LEN, inode);
		trace_android_fs_fsync_start(inode,
				current->pid, path, current->comm);
	}

	if (S_ISDIR(inode->i_mode))
		goto go_write;

@@ -323,6 +333,8 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
out:
	trace_f2fs_sync_file_exit(inode, cp_reason, datasync, ret);
	f2fs_trace_ios(NULL, 1);
	trace_android_fs_fsync_end(inode, start, end - start);

	return ret;
}

+9 −0
Original line number Diff line number Diff line
@@ -25,6 +25,15 @@ 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));

DEFINE_EVENT(android_fs_fsync_start_template, android_fs_fsync_start,
	TP_PROTO(struct inode *inode,
		 pid_t pid, char *pathname, char *command),
	TP_ARGS(inode, pid, pathname, command));

DEFINE_EVENT(android_fs_data_end_template, android_fs_fsync_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 */
+34 −0
Original line number Diff line number Diff line
@@ -61,4 +61,38 @@ DECLARE_EVENT_CLASS(android_fs_data_end_template,
		  __entry->offset, __entry->bytes)
);

DECLARE_EVENT_CLASS(android_fs_fsync_start_template,
	TP_PROTO(struct inode *inode,
		 pid_t pid, char *pathname, char *command),
	TP_ARGS(inode, pid, pathname, command),
	TP_STRUCT__entry(
		__string(pathbuf, pathname);
		__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->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, cmdline %s,"
		  " pid %d, i_size %llu, ino %lu",
		  __get_str(pathbuf),
		  __get_str(cmdline), __entry->pid, __entry->i_size,
		  (unsigned long) __entry->ino)
);

#endif /* _TRACE_ANDROID_FS_TEMPLATE_H */