Skip to contentSkip to conversation

erofs: support tracepoint

PATCH New Chao Yu 1 participant 1 message Jul 3, 2018

Subsystems (2)
lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 11/11 erofs: support tracepoint

From: Chao Yu <[email protected]>

Add tracepoints for ->readpage{,s}, ->lookup.

Reviewed-by Gao Xiang <gaoxiang25 at huawei.com>
Signed-off-by Chao Yu <yuchao0 at huawei.com>

---
v2: remove in-loop page defination.

 fs/erofs/data.c              |   8 ++++
 fs/erofs/namei.c             |   5 ++
 fs/erofs/super.c             |   2 +
 fs/erofs/unzip.c             |   6 +++
 include/trace/events/erofs.h | 109 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 130 insertions(+)
 create mode 100644 include/trace/events/erofs.h
fs/erofs/data.c +8 -0
index e76de71c85ff..401b79a6ecd9 100644
@@ -13,6 +13,9 @@
 #include "internal.h"
 #include <linux/prefetch.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/erofs.h>
+
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))
 static inline void read_endio(struct bio *bio, int err)
 #else
@@ -337,6 +340,8 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page)
 	erofs_off_t last_block;
 	struct bio *bio;
 
+	trace_erofs_readpage(page, true);
+
 	bio = erofs_read_raw_page(NULL, page->mapping,
 		page, &last_block, 1, false);
 
@@ -354,6 +359,9 @@ static int erofs_raw_access_readpages(struct file *filp,
 	erofs_off_t last_block;
 	struct bio *bio = NULL;
 	gfp_t gfp = readahead_gfp_mask(mapping);
+	struct page *page = list_last_entry(pages, struct page, lru);
+
+	trace_erofs_readpages(mapping->host, page, nr_pages, true);
 
 	for (; nr_pages; --nr_pages) {
 		struct page *page = list_entry(pages->prev, struct page, lru);
fs/erofs/namei.c +5 -0
index e30294b279d1..b701d9ba52a6 100644
@@ -10,9 +10,12 @@
  * License.  See the file COPYING in the main directory of the Linux
  * distribution for more details.
  */
+
 #include "internal.h"
 #include "xattr.h"
 
+#include <trace/events/erofs.h>
+
 /* based on the value of qn->len is accurate */
 static inline int dirnamecmp(struct qstr *qn,
 	struct qstr *qd, unsigned *matched)
@@ -209,6 +212,8 @@ struct dentry *erofs_lookup(struct inode *dir,
 	/* dentry must be unhashed in lookup, no need to worry about */
 	BUG_ON(!d_unhashed(dentry));
 
+	trace_erofs_lookup(dir, dentry, flags);
+
 	/* file name exceeds fs limit */
 	if (unlikely(dentry->d_name.len > EROFS_NAME_LEN))
 		return ERR_PTR(-ENAMETOOLONG);
fs/erofs/super.c +2 -0
index d6046d4d787b..8b52f08fabe9 100644
@@ -17,6 +17,8 @@
 #include <linux/parser.h>
 #include "internal.h"
 
+#define CREATE_TRACE_POINTS
+
 static struct kmem_cache *erofs_inode_cachep __read_mostly;
 
 static void init_once(void *ptr)
fs/erofs/unzip.c +6 -0
index 66ee5579d2c3..58b3b2bf9e15 100644
@@ -929,6 +929,8 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
 	};
 	LIST_HEAD(pagepool);
 
+	trace_erofs_readpage(page, false);
+
 	int err = z_erofs_vle_do_read_page(page, &z_pvec,
 		&z_iter, &m_iter, &pagepool, &collector);
 
@@ -1027,6 +1029,10 @@ static int z_erofs_vle_normalaccess_readpages(
 	struct address_space *mapping,
 	struct list_head *pages, unsigned nr_pages)
 {
+	struct page *page = list_last_entry(pages, struct page, lru);
+
+	trace_erofs_readpages(mapping->host, page, nr_pages, false);
+
 	return __z_erofs_vle_normalaccess_readpages(filp,
 		mapping, pages, nr_pages,
 		nr_pages < 4 /* sync */);
include/trace/events/erofs.h new file +109 -0

109 lines not on this page · raw message

Signature · 1 line
2.16.2.17.g38e79b1fd