Skip to contentSkip to conversation

f2fs: add a tracepoint for f2fs_read_data_pages

PATCH In review Chao Yu 2 participants 3 messages May 6, 2014 – May 8, 2014

Subsystems (3)
lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 6/6 f2fs: add a tracepoint for f2fs_read_data_pages

This patch adds a tracepoint for f2fs_read_data_pages to trace when pages are readahead by VFS.

---
 fs/f2fs/data.c              |    3 +++
 include/trace/events/f2fs.h |   26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
fs/f2fs/data.c +3 -0
index 8c250a5..f2d1e8a 100644
@@ -729,6 +729,9 @@ static int f2fs_read_data_pages(struct file *file,
 			struct list_head *pages, unsigned nr_pages)
 {
 	struct inode *inode = file->f_mapping->host;
+	struct page *page = list_entry(pages->prev, struct page, lru);
+
+	trace_f2fs_readpages(inode, page, nr_pages);
 
 	/* If the file has inline data, skip readpages */
 	if (f2fs_has_inline_data(inode))
include/trace/events/f2fs.h +26 -0
index b983990..7fbaaaa 100644
@@ -847,6 +847,32 @@ TRACE_EVENT(f2fs_writepages,
 		__entry->for_sync)
 );
 
+TRACE_EVENT(f2fs_readpages,
+
+	TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
+
+	TP_ARGS(inode, page, nrpage),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(ino_t,	ino)
+		__field(pgoff_t,	start)
+		__field(unsigned int,	nrpage)
+	),
+
+	TP_fast_assign(
+		__entry->dev	= inode->i_sb->s_dev;
+		__entry->ino	= inode->i_ino;
+		__entry->start	= page->index;
+		__entry->nrpage	= nrpage;
+	),
+
+	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
+		show_dev_ino(__entry),
+		(unsigned long)__entry->start,
+		__entry->nrpage)
+);
+
 TRACE_EVENT(f2fs_submit_page_mbio,
 
 	TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Chao,

2014-05-06 (화), 16:54 +0800, Chao Yu:

Quoted 14 lines

This patch adds a tracepoint for f2fs_read_data_pages to trace when pages are readahead by VFS.

---
 fs/f2fs/data.c              |    3 +++
 include/trace/events/f2fs.h |   26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
fs/f2fs/data.c +0 -0
index 8c250a5..f2d1e8a 100644

fs/f2fs/data.c static int f2fs_read_data_pages(struct file *file, · line 732

Quoted 4 lines
fs/f2fs/data.c +1 -0
@@ -729,6 +729,9 @@ static int f2fs_read_data_pages(struct file *file,
 			struct list_head *pages, unsigned nr_pages)
 {
 	struct inode *inode = file->f_mapping->host;
+	struct page *page = list_entry(pages->prev, struct page, lru);

IMO, it needs to avoid the above line.
Thanks,

Quoted 42 lines
fs/f2fs/data.c +2 -0
+
+	trace_f2fs_readpages(inode, page, nr_pages);
 
 	/* If the file has inline data, skip readpages */
 	if (f2fs_has_inline_data(inode))
include/trace/events/f2fs.h +26 -0
index b983990..7fbaaaa 100644
@@ -847,6 +847,32 @@ TRACE_EVENT(f2fs_writepages,
 		__entry->for_sync)
 );
 
+TRACE_EVENT(f2fs_readpages,
+
+	TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
+
+	TP_ARGS(inode, page, nrpage),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(ino_t,	ino)
+		__field(pgoff_t,	start)
+		__field(unsigned int,	nrpage)
+	),
+
+	TP_fast_assign(
+		__entry->dev	= inode->i_sb->s_dev;
+		__entry->ino	= inode->i_ino;
+		__entry->start	= page->index;
+		__entry->nrpage	= nrpage;
+	),
+
+	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
+		show_dev_ino(__entry),
+		(unsigned long)__entry->start,
+		__entry->nrpage)
+);
+
 TRACE_EVENT(f2fs_submit_page_mbio,
 
 	TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
Signature · 15 lines
Jaegeuk Kim
Samsung



------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author
#2 lore raw

Hi Kim,

Quoted 20 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, May 07, 2014 8:30 AM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [f2fs-dev][PATCH 6/6] f2fs: add a tracepoint for f2fs_read_data_pages

Hi Chao,

2014-05-06 (화), 16:54 +0800, Chao Yu:

Quoted 9 lines

This patch adds a tracepoint for f2fs_read_data_pages to trace when pages are readahead by VFS.

---
 fs/f2fs/data.c              |    3 +++
 include/trace/events/f2fs.h |   26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
Quoted 11 lines

fs/f2fs/data.c static int f2fs_read_data_pages(struct file *file, · line 732

Quoted 9 lines
fs/f2fs/data.c +1 -0
index 8c250a5..f2d1e8a 100644
@@ -729,6 +729,9 @@ static int f2fs_read_data_pages(struct file *file,
 			struct list_head *pages, unsigned nr_pages)
 {
 	struct inode *inode = file->f_mapping->host;
+	struct page *page = list_entry(pages->prev, struct page, lru);

IMO, it needs to avoid the above line.

Maybe it’s not safe to access page directly in lru list here. Let's ignore this patch.
Thanks.

Quoted 43 lines

Thanks,

Quoted 41 lines
fs/f2fs/data.c +2 -0
+
+	trace_f2fs_readpages(inode, page, nr_pages);
 
 	/* If the file has inline data, skip readpages */
 	if (f2fs_has_inline_data(inode))
include/trace/events/f2fs.h +26 -0
index b983990..7fbaaaa 100644
@@ -847,6 +847,32 @@ TRACE_EVENT(f2fs_writepages,
 		__entry->for_sync)
 );
 
+TRACE_EVENT(f2fs_readpages,
+
+	TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
+
+	TP_ARGS(inode, page, nrpage),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(ino_t,	ino)
+		__field(pgoff_t,	start)
+		__field(unsigned int,	nrpage)
+	),
+
+	TP_fast_assign(
+		__entry->dev	= inode->i_sb->s_dev;
+		__entry->ino	= inode->i_ino;
+		__entry->start	= page->index;
+		__entry->nrpage	= nrpage;
+	),
+
+	TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
+		show_dev_ino(__entry),
+		(unsigned long)__entry->start,
+		__entry->nrpage)
+);
+
 TRACE_EVENT(f2fs_submit_page_mbio,
 
Quoted 5 lines

include/trace/events/f2fs.h TRACE_EVENT(f2fs_writepages, · line 878

Quoted 1 line
include/trace/events/f2fs.h +0 -0
 	TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html