erofs: support tracepoint
Subsystems (2)
Chao Yu
maintainerPATCH 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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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