aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/f2fs/file.c7
-rw-r--r--fs/f2fs/inode.c13
-rw-r--r--fs/f2fs/namei.c3
-rw-r--r--fs/f2fs/super.c5
-rw-r--r--include/trace/events/f2fs.h195
5 files changed, 219 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 07be88ddb9f8..0b0ba26ba76e 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -25,6 +25,7 @@
25#include "segment.h" 25#include "segment.h"
26#include "xattr.h" 26#include "xattr.h"
27#include "acl.h" 27#include "acl.h"
28#include <trace/events/f2fs.h>
28 29
29static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, 30static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
30 struct vm_fault *vmf) 31 struct vm_fault *vmf)
@@ -116,9 +117,12 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
116 if (inode->i_sb->s_flags & MS_RDONLY) 117 if (inode->i_sb->s_flags & MS_RDONLY)
117 return 0; 118 return 0;
118 119
120 trace_f2fs_sync_file_enter(inode);
119 ret = filemap_write_and_wait_range(inode->i_mapping, start, end); 121 ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
120 if (ret) 122 if (ret) {
123 trace_f2fs_sync_file_exit(inode, need_cp, datasync, ret);
121 return ret; 124 return ret;
125 }
122 126
123 /* guarantee free sections for fsync */ 127 /* guarantee free sections for fsync */
124 f2fs_balance_fs(sbi); 128 f2fs_balance_fs(sbi);
@@ -153,6 +157,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
153 } 157 }
154out: 158out:
155 mutex_unlock(&inode->i_mutex); 159 mutex_unlock(&inode->i_mutex);
160 trace_f2fs_sync_file_exit(inode, need_cp, datasync, ret);
156 return ret; 161 return ret;
157} 162}
158 163
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 60105b710958..91ac7f9d88ee 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -16,6 +16,8 @@
16#include "f2fs.h" 16#include "f2fs.h"
17#include "node.h" 17#include "node.h"
18 18
19#include <trace/events/f2fs.h>
20
19void f2fs_set_inode_flags(struct inode *inode) 21void f2fs_set_inode_flags(struct inode *inode)
20{ 22{
21 unsigned int flags = F2FS_I(inode)->i_flags; 23 unsigned int flags = F2FS_I(inode)->i_flags;
@@ -91,13 +93,16 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
91{ 93{
92 struct f2fs_sb_info *sbi = F2FS_SB(sb); 94 struct f2fs_sb_info *sbi = F2FS_SB(sb);
93 struct inode *inode; 95 struct inode *inode;
94 int ret; 96 int ret = 0;
95 97
96 inode = iget_locked(sb, ino); 98 inode = iget_locked(sb, ino);
97 if (!inode) 99 if (!inode)
98 return ERR_PTR(-ENOMEM); 100 return ERR_PTR(-ENOMEM);
99 if (!(inode->i_state & I_NEW)) 101
102 if (!(inode->i_state & I_NEW)) {
103 trace_f2fs_iget(inode);
100 return inode; 104 return inode;
105 }
101 if (ino == F2FS_NODE_INO(sbi) || ino == F2FS_META_INO(sbi)) 106 if (ino == F2FS_NODE_INO(sbi) || ino == F2FS_META_INO(sbi))
102 goto make_now; 107 goto make_now;
103 108
@@ -139,11 +144,12 @@ make_now:
139 goto bad_inode; 144 goto bad_inode;
140 } 145 }
141 unlock_new_inode(inode); 146 unlock_new_inode(inode);
142 147 trace_f2fs_iget(inode);
143 return inode; 148 return inode;
144 149
145bad_inode: 150bad_inode:
146 iget_failed(inode); 151 iget_failed(inode);
152 trace_f2fs_iget_exit(inode, ret);
147 return ERR_PTR(ret); 153 return ERR_PTR(ret);
148} 154}
149 155
@@ -239,6 +245,7 @@ void f2fs_evict_inode(struct inode *inode)
239 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 245 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
240 int ilock; 246 int ilock;
241 247
248 trace_f2fs_evict_inode(inode);
242 truncate_inode_pages(&inode->i_data, 0); 249 truncate_inode_pages(&inode->i_data, 0);
243 250
244 if (inode->i_ino == F2FS_NODE_INO(sbi) || 251 if (inode->i_ino == F2FS_NODE_INO(sbi) ||
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 1dbf11d2bc87..c57fd18b769d 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -18,6 +18,7 @@
18#include "node.h" 18#include "node.h"
19#include "xattr.h" 19#include "xattr.h"
20#include "acl.h" 20#include "acl.h"
21#include <trace/events/f2fs.h>
21 22
22static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) 23static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
23{ 24{
@@ -235,6 +236,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
235 int err = -ENOENT; 236 int err = -ENOENT;
236 int ilock; 237 int ilock;
237 238
239 trace_f2fs_unlink_enter(dir, dentry);
238 f2fs_balance_fs(sbi); 240 f2fs_balance_fs(sbi);
239 241
240 de = f2fs_find_entry(dir, &dentry->d_name, &page); 242 de = f2fs_find_entry(dir, &dentry->d_name, &page);
@@ -255,6 +257,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
255 /* In order to evict this inode, we set it dirty */ 257 /* In order to evict this inode, we set it dirty */
256 mark_inode_dirty(inode); 258 mark_inode_dirty(inode);
257fail: 259fail:
260 trace_f2fs_unlink_exit(inode, err);
258 return err; 261 return err;
259} 262}
260 263
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 541f21ffd8f2..b015b6cd7bd4 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -29,6 +29,9 @@
29#include "segment.h" 29#include "segment.h"
30#include "xattr.h" 30#include "xattr.h"
31 31
32#define CREATE_TRACE_POINTS
33#include <trace/events/f2fs.h>
34
32static struct kmem_cache *f2fs_inode_cachep; 35static struct kmem_cache *f2fs_inode_cachep;
33 36
34enum { 37enum {
@@ -134,6 +137,8 @@ int f2fs_sync_fs(struct super_block *sb, int sync)
134{ 137{
135 struct f2fs_sb_info *sbi = F2FS_SB(sb); 138 struct f2fs_sb_info *sbi = F2FS_SB(sb);
136 139
140 trace_f2fs_sync_fs(sb, sync);
141
137 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) 142 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES))
138 return 0; 143 return 0;
139 144
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
new file mode 100644
index 000000000000..03bb0dbf468d
--- /dev/null
+++ b/include/trace/events/f2fs.h
@@ -0,0 +1,195 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM f2fs
3
4#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_F2FS_H
6
7#include <linux/tracepoint.h>
8
9#define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev)
10#define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino
11
12DECLARE_EVENT_CLASS(f2fs__inode,
13
14 TP_PROTO(struct inode *inode),
15
16 TP_ARGS(inode),
17
18 TP_STRUCT__entry(
19 __field(dev_t, dev)
20 __field(ino_t, ino)
21 __field(ino_t, pino)
22 __field(umode_t, mode)
23 __field(loff_t, size)
24 __field(unsigned int, nlink)
25 __field(blkcnt_t, blocks)
26 __field(__u8, advise)
27 ),
28
29 TP_fast_assign(
30 __entry->dev = inode->i_sb->s_dev;
31 __entry->ino = inode->i_ino;
32 __entry->pino = F2FS_I(inode)->i_pino;
33 __entry->mode = inode->i_mode;
34 __entry->nlink = inode->i_nlink;
35 __entry->size = inode->i_size;
36 __entry->blocks = inode->i_blocks;
37 __entry->advise = F2FS_I(inode)->i_advise;
38 ),
39
40 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
41 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
42 show_dev_ino(__entry),
43 (unsigned long)__entry->pino,
44 __entry->mode,
45 __entry->size,
46 (unsigned int)__entry->nlink,
47 (unsigned long long)__entry->blocks,
48 (unsigned char)__entry->advise)
49);
50
51DECLARE_EVENT_CLASS(f2fs__inode_exit,
52
53 TP_PROTO(struct inode *inode, int ret),
54
55 TP_ARGS(inode, ret),
56
57 TP_STRUCT__entry(
58 __field(dev_t, dev)
59 __field(ino_t, ino)
60 __field(int, ret)
61 ),
62
63 TP_fast_assign(
64 __entry->dev = inode->i_sb->s_dev;
65 __entry->ino = inode->i_ino;
66 __entry->ret = ret;
67 ),
68
69 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
70 show_dev_ino(__entry),
71 __entry->ret)
72);
73
74DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
75
76 TP_PROTO(struct inode *inode),
77
78 TP_ARGS(inode)
79);
80
81TRACE_EVENT(f2fs_sync_file_exit,
82
83 TP_PROTO(struct inode *inode, bool need_cp, int datasync, int ret),
84
85 TP_ARGS(inode, need_cp, datasync, ret),
86
87 TP_STRUCT__entry(
88 __field(dev_t, dev)
89 __field(ino_t, ino)
90 __field(bool, need_cp)
91 __field(int, datasync)
92 __field(int, ret)
93 ),
94
95 TP_fast_assign(
96 __entry->dev = inode->i_sb->s_dev;
97 __entry->ino = inode->i_ino;
98 __entry->need_cp = need_cp;
99 __entry->datasync = datasync;
100 __entry->ret = ret;
101 ),
102
103 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
104 "datasync = %d, ret = %d",
105 show_dev_ino(__entry),
106 __entry->need_cp ? "needed" : "not needed",
107 __entry->datasync,
108 __entry->ret)
109);
110
111TRACE_EVENT(f2fs_sync_fs,
112
113 TP_PROTO(struct super_block *sb, int wait),
114
115 TP_ARGS(sb, wait),
116
117 TP_STRUCT__entry(
118 __field(dev_t, dev)
119 __field(int, dirty)
120 __field(int, wait)
121 ),
122
123 TP_fast_assign(
124 __entry->dev = sb->s_dev;
125 __entry->dirty = F2FS_SB(sb)->s_dirty;
126 __entry->wait = wait;
127 ),
128
129 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
130 show_dev(__entry),
131 __entry->dirty ? "dirty" : "not dirty",
132 __entry->wait)
133);
134
135DEFINE_EVENT(f2fs__inode, f2fs_iget,
136
137 TP_PROTO(struct inode *inode),
138
139 TP_ARGS(inode)
140);
141
142DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
143
144 TP_PROTO(struct inode *inode, int ret),
145
146 TP_ARGS(inode, ret)
147);
148
149DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
150
151 TP_PROTO(struct inode *inode),
152
153 TP_ARGS(inode)
154);
155
156TRACE_EVENT(f2fs_unlink_enter,
157
158 TP_PROTO(struct inode *dir, struct dentry *dentry),
159
160 TP_ARGS(dir, dentry),
161
162 TP_STRUCT__entry(
163 __field(dev_t, dev)
164 __field(ino_t, ino)
165 __field(loff_t, size)
166 __field(blkcnt_t, blocks)
167 __field(const char *, name)
168 ),
169
170 TP_fast_assign(
171 __entry->dev = dir->i_sb->s_dev;
172 __entry->ino = dir->i_ino;
173 __entry->size = dir->i_size;
174 __entry->blocks = dir->i_blocks;
175 __entry->name = dentry->d_name.name;
176 ),
177
178 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
179 "i_blocks = %llu, name = %s",
180 show_dev_ino(__entry),
181 __entry->size,
182 (unsigned long long)__entry->blocks,
183 __entry->name)
184);
185
186DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
187
188 TP_PROTO(struct inode *inode, int ret),
189
190 TP_ARGS(inode, ret)
191);
192#endif /* _TRACE_F2FS_H */
193
194 /* This part must be outside protection */
195#include <trace/define_trace.h>