Commit 284db12c authored by Chen Gong's avatar Chen Gong Committed by Greg Kroah-Hartman

staging: erofs: add trace points for reading zipped data

This patch adds trace points for reading zipped data.
Signed-off-by: default avatarChen Gong <gongchen4@huawei.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Reviewed-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bec5204
...@@ -162,7 +162,8 @@ DECLARE_EVENT_CLASS(erofs__map_blocks_enter, ...@@ -162,7 +162,8 @@ DECLARE_EVENT_CLASS(erofs__map_blocks_enter,
TP_printk("dev = (%d,%d), nid = %llu, la %llu llen %llu flags %s", TP_printk("dev = (%d,%d), nid = %llu, la %llu llen %llu flags %s",
show_dev_nid(__entry), show_dev_nid(__entry),
__entry->la, __entry->llen, show_map_flags(__entry->flags)) __entry->la, __entry->llen,
__entry->flags ? show_map_flags(__entry->flags) : "NULL")
); );
DEFINE_EVENT(erofs__map_blocks_enter, erofs_map_blocks_flatmode_enter, DEFINE_EVENT(erofs__map_blocks_enter, erofs_map_blocks_flatmode_enter,
...@@ -172,6 +173,13 @@ DEFINE_EVENT(erofs__map_blocks_enter, erofs_map_blocks_flatmode_enter, ...@@ -172,6 +173,13 @@ DEFINE_EVENT(erofs__map_blocks_enter, erofs_map_blocks_flatmode_enter,
TP_ARGS(inode, map, flags) TP_ARGS(inode, map, flags)
); );
DEFINE_EVENT(erofs__map_blocks_enter, z_erofs_map_blocks_iter_enter,
TP_PROTO(struct inode *inode, struct erofs_map_blocks *map,
unsigned int flags),
TP_ARGS(inode, map, flags)
);
DECLARE_EVENT_CLASS(erofs__map_blocks_exit, DECLARE_EVENT_CLASS(erofs__map_blocks_exit,
TP_PROTO(struct inode *inode, struct erofs_map_blocks *map, TP_PROTO(struct inode *inode, struct erofs_map_blocks *map,
unsigned int flags, int ret), unsigned int flags, int ret),
...@@ -204,7 +212,8 @@ DECLARE_EVENT_CLASS(erofs__map_blocks_exit, ...@@ -204,7 +212,8 @@ DECLARE_EVENT_CLASS(erofs__map_blocks_exit,
TP_printk("dev = (%d,%d), nid = %llu, flags %s " TP_printk("dev = (%d,%d), nid = %llu, flags %s "
"la %llu pa %llu llen %llu plen %llu mflags %s ret %d", "la %llu pa %llu llen %llu plen %llu mflags %s ret %d",
show_dev_nid(__entry), show_map_flags(__entry->flags), show_dev_nid(__entry),
__entry->flags ? show_map_flags(__entry->flags) : "NULL",
__entry->la, __entry->pa, __entry->llen, __entry->plen, __entry->la, __entry->pa, __entry->llen, __entry->plen,
show_mflags(__entry->mflags), __entry->ret) show_mflags(__entry->mflags), __entry->ret)
); );
...@@ -216,6 +225,13 @@ DEFINE_EVENT(erofs__map_blocks_exit, erofs_map_blocks_flatmode_exit, ...@@ -216,6 +225,13 @@ DEFINE_EVENT(erofs__map_blocks_exit, erofs_map_blocks_flatmode_exit,
TP_ARGS(inode, map, flags, ret) TP_ARGS(inode, map, flags, ret)
); );
DEFINE_EVENT(erofs__map_blocks_exit, z_erofs_map_blocks_iter_exit,
TP_PROTO(struct inode *inode, struct erofs_map_blocks *map,
unsigned int flags, int ret),
TP_ARGS(inode, map, flags, ret)
);
TRACE_EVENT(erofs_destroy_inode, TRACE_EVENT(erofs_destroy_inode,
TP_PROTO(struct inode *inode), TP_PROTO(struct inode *inode),
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "unzip_vle.h" #include "unzip_vle.h"
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <trace/events/erofs.h>
static struct workqueue_struct *z_erofs_workqueue __read_mostly; static struct workqueue_struct *z_erofs_workqueue __read_mostly;
static struct kmem_cache *z_erofs_workgroup_cachep __read_mostly; static struct kmem_cache *z_erofs_workgroup_cachep __read_mostly;
...@@ -613,6 +615,8 @@ static int z_erofs_do_read_page(struct z_erofs_vle_frontend *fe, ...@@ -613,6 +615,8 @@ static int z_erofs_do_read_page(struct z_erofs_vle_frontend *fe,
unsigned int cur, end, spiltted, index; unsigned int cur, end, spiltted, index;
int err = 0; int err = 0;
trace_erofs_readpage(page, false);
/* register locked file pages as online pages in pack */ /* register locked file pages as online pages in pack */
z_erofs_onlinepage_init(page); z_erofs_onlinepage_init(page);
...@@ -1348,6 +1352,9 @@ static inline int __z_erofs_vle_normalaccess_readpages( ...@@ -1348,6 +1352,9 @@ static inline int __z_erofs_vle_normalaccess_readpages(
struct page *head = NULL; struct page *head = NULL;
LIST_HEAD(pagepool); LIST_HEAD(pagepool);
trace_erofs_readpages(mapping->host, lru_to_page(pages),
nr_pages, false);
#if (EROFS_FS_ZIP_CACHE_LVL >= 2) #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
f.cachedzone_la = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT; f.cachedzone_la = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT;
#endif #endif
...@@ -1571,6 +1578,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, ...@@ -1571,6 +1578,8 @@ int z_erofs_map_blocks_iter(struct inode *inode,
unsigned int cluster_type, logical_cluster_ofs; unsigned int cluster_type, logical_cluster_ofs;
int err = 0; int err = 0;
trace_z_erofs_map_blocks_iter_enter(inode, map, flags);
/* when trying to read beyond EOF, leave it unmapped */ /* when trying to read beyond EOF, leave it unmapped */
if (unlikely(map->m_la >= inode->i_size)) { if (unlikely(map->m_la >= inode->i_size)) {
DBG_BUGON(!initial); DBG_BUGON(!initial);
...@@ -1689,6 +1698,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, ...@@ -1689,6 +1698,8 @@ int z_erofs_map_blocks_iter(struct inode *inode,
__func__, map->m_la, map->m_pa, __func__, map->m_la, map->m_pa,
map->m_llen, map->m_plen, map->m_flags); map->m_llen, map->m_plen, map->m_flags);
trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);
/* aggressively BUG_ON iff CONFIG_EROFS_FS_DEBUG is on */ /* aggressively BUG_ON iff CONFIG_EROFS_FS_DEBUG is on */
DBG_BUGON(err < 0 && err != -ENOMEM); DBG_BUGON(err < 0 && err != -ENOMEM);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment