Skip to contentSkip to conversation

erofs: support tracepoint

PATCH RESEND New Chao Yu 2 participants 2 messages Jul 3, 2018 – Jul 20, 2018

Subsystems (2)
lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH RESEND 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              |  10 +++-
 fs/erofs/namei.c             |   5 ++
 fs/erofs/super.c             |   2 +
 fs/erofs/unzip.c             |   6 +++
 include/trace/events/erofs.h | 109 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 include/trace/events/erofs.h
fs/erofs/data.c +9 -1
index e76de71c85ff..1277beef6531 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,9 +359,12 @@ 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);
+		page = list_entry(pages->prev, struct page, lru);
 
 		prefetchw(&page->flags);
 		list_del(&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
#1 lore raw

PATCH v3 1/1 erofs: support tracepoint

From: Chao Yu <[email protected]>

Add basic tracepoints for ->readpage{,s}, ->lookup, ->destroy_inode, fill_inode and map_blocks.

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

---
v3: 1) add tracepoints for ->destroy_inode, fill_inode and map_blocks;
2) rename ino to nid;
3) move '#define CREATE_TRACE_POINTS' to super.c;
4) tracepoints for unzip subsystem will be added separately later.

v2: remove in-loop page defination.

Hi Chao,
Could you please review this patch again when you are free?

Thanks,

 fs/erofs/data.c              |  13 ++-
 fs/erofs/inode.c             |   4 +
 fs/erofs/namei.c             |   5 +
 fs/erofs/super.c             |   5 +
 fs/erofs/unzip.c             |   6 ++
 include/trace/events/erofs.h | 240 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 270 insertions(+), 3 deletions(-)
 create mode 100644 include/trace/events/erofs.h
fs/erofs/data.c +10 -3
index e76de71..ead83b6 100644
@@ -13,6 +13,8 @@
 #include "internal.h"
 #include <linux/prefetch.h>
 
+#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
@@ -144,6 +146,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
 	u64 offset = map->m_la;
 	struct erofs_vnode *vi = EROFS_V(inode);
 
+	trace_erofs_map_blocks_flatmode_enter(inode, map, flags);
 	BUG_ON(is_inode_layout_compression(inode));
 
 	nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
@@ -181,8 +184,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
 
 out:
 	map->m_llen = map->m_plen;
-	debugln("%s, m_la 0x%llx m_pa %llx m_len %llu",
-		__func__, map->m_la, map->m_pa, map->m_plen);
+	trace_erofs_map_blocks_flatmode_exit(inode, map, flags, 0);
 	return 0;
 }
 
@@ -337,6 +339,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,9 +358,12 @@ 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);
+		page = list_entry(pages->prev, struct page, lru);
 
 		prefetchw(&page->flags);
 		list_del(&page->lru);
fs/erofs/inode.c +4 -0
index af23f8b..01eec816 100644
@@ -13,6 +13,8 @@
 #include "internal.h"
 #include "xattr.h"
 
+#include <trace/events/erofs.h>
+
 /* no locking */
 static int read_inode(struct inode *inode, void *data)
 {
@@ -146,6 +148,8 @@ int fill_inode(struct inode *inode, int isdir)
 	erofs_blk_t blkaddr;
 	unsigned ofs;
 
+	trace_erofs_fill_inode(inode, isdir);
+
 	blkaddr = erofs_blknr(iloc(sbi, vi->nid));
 	ofs = erofs_blkoff(iloc(sbi, vi->nid));
 
fs/erofs/namei.c +5 -0
index e30294b..b701d9b 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 +5 -0
index d6046d4..2a21d81 100644
@@ -17,6 +17,9 @@
 #include <linux/parser.h>
 #include "internal.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/erofs.h>
+
 static struct kmem_cache *erofs_inode_cachep __read_mostly;
 
 static void init_once(void *ptr)
@@ -68,6 +71,8 @@ static void i_callback(struct rcu_head *head)
 
 static void destroy_inode(struct inode *inode)
 {
+	trace_erofs_destroy_inode(inode);
+
 	call_rcu(&inode->i_rcu, i_callback);
 }
 
fs/erofs/unzip.c +6 -0
index 66ee557..58b3b2b 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 +240 -0

240 lines not on this page · raw message

Signature · 1 line
1.9.1