Skip to contentSkip to conversation

f2fs: add tracepoint for tracing the page i/o operations

PATCH Superseded Namjae Jeon 2 participants 2 messages Feb 19, 2013

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 4/8 f2fs: add tracepoint for tracing the page i/o operations

From: Namjae Jeon <[email protected]>

Add tracepoints for page i/o operations and block allocation tracing during page read operation.

---
 fs/f2fs/data.c              |   10 ++++++-
 include/trace/events/f2fs.h |   68 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 1 deletion(-)
fs/f2fs/data.c +9 -1
index 7bd22a2..61beb82 100644
@@ -21,6 +21,7 @@
 #include "f2fs.h"
 #include "node.h"
 #include "segment.h"
+#include <trace/events/f2fs.h>
 
 /*
  * Lock ordering for the change of data block address:
@@ -334,6 +335,9 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
 	bool sync = (type == READ_SYNC);
 	struct bio *bio;
 
+	if (page->mapping)
+		trace_f2fs_readpage(page);
+
 	/* This page can be already read by other threads */
 	if (PageUptodate(page)) {
 		if (!sync)
@@ -384,6 +388,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock,
 	pgoff_t pgofs;
 	int err;
 
+	trace_f2fs_get_data_block_enter(inode, iblock);
 	/* Get the page offset from the block offset(iblock) */
 	pgofs =	(pgoff_t)(iblock >> (PAGE_CACHE_SHIFT - blkbits));
 
@@ -393,8 +398,10 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock,
 	/* When reading holes, we need its node page */
 	set_new_dnode(&dn, inode, NULL, NULL, 0);
 	err = get_dnode_of_data(&dn, pgofs, RDONLY_NODE);
-	if (err)
+	if (err) {
+		trace_f2fs_get_data_block_exit(inode, err);
 		return (err == -ENOENT) ? 0 : err;
+	}
 
 	/* It does not support data allocation */
 	BUG_ON(create);
@@ -419,6 +426,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock,
 		bh_result->b_size = (i << blkbits);
 	}
 	f2fs_put_dnode(&dn);
+	trace_f2fs_get_data_block_exit(inode, 0);
 	return 0;
 }
 
include/trace/events/f2fs.h +68 -0

74 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 2 lines · Namjae Jeon

From: Namjae Jeon <[email protected]>

I see you already took my advice in patch 3, but here's another one that could be fixed.

-- Steve

Quoted 25 lines
include/trace/events/f2fs.h +22 -0
+TRACE_EVENT(f2fs_get_data_block_exit,
+	TP_PROTO(struct inode *inode, int ret),
+
+	TP_ARGS(inode, ret),
+
+	TP_STRUCT__entry(
+		__field(dev_t,	dev)
+		__field(ino_t,	ino)
+		__field(int,	ret)
+	),
+
+	TP_fast_assign(
+		__entry->dev	= inode->i_sb->s_dev;
+		__entry->ino	= inode->i_ino;
+		__entry->ret	= ret;
+	),
+
+	TP_printk("dev %d,%d ino %lu return value %d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  (unsigned long) __entry->ino, __entry->ret)
+);
+
 #endif /* _TRACE_F2FS_H */
 
  /* This part must be outside protection */