OSDN Git Service

Merge 4.20-rc1-4.9 into android-4.9
[android-x86/kernel.git] / fs / f2fs / data.c
index 93b3ef5..4e5aaa9 100644 (file)
@@ -23,6 +23,7 @@
 #include "segment.h"
 #include "trace.h"
 #include <trace/events/f2fs.h>
+#include <trace/events/android_fs.h>
 
 #define NUM_PREALLOC_POST_READ_CTXS    128
 
@@ -2399,6 +2400,16 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
        block_t blkaddr = NULL_ADDR;
        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, path,
+                                                current->comm);
+       }
        trace_f2fs_write_begin(inode, pos, len, flags);
 
        err = f2fs_is_checkpoint_ready(sbi);
@@ -2499,6 +2510,7 @@ static int f2fs_write_end(struct file *file,
 {
        struct inode *inode = page->mapping->host;
 
+       trace_android_fs_datawrite_end(inode, pos, len);
        trace_f2fs_write_end(inode, pos, len, copied);
 
        /*
@@ -2570,6 +2582,28 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 
        trace_f2fs_direct_IO_enter(inode, offset, count, rw);
 
+       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, path,
+                                               current->comm);
+       }
+       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, path,
+                                                current->comm);
+       }
        if (rw == WRITE && whint_mode == WHINT_MODE_OFF)
                iocb->ki_hint = WRITE_LIFE_NOT_SET;
 
@@ -2610,8 +2644,14 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
                        f2fs_write_failed(mapping, offset + count);
                }
        }
-
 out:
+       if (trace_android_fs_dataread_start_enabled() &&
+           (rw == READ))
+               trace_android_fs_dataread_end(inode, offset, count);
+       if (trace_android_fs_datawrite_start_enabled() &&
+           (rw == WRITE))
+               trace_android_fs_datawrite_end(inode, offset, count);
+
        trace_f2fs_direct_IO_exit(inode, offset, count, rw, err);
 
        return err;