2013-04-19 16:31:48

by Namjae Jeon

[permalink] [raw]
Subject: [PATCH v4 6/7] f2fs: add tracepoints for write page operations

From: Namjae Jeon <[email protected]>

Add tracepoints to debug the various page write operation
like data pages, meta pages.

Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
---
fs/f2fs/checkpoint.c | 2 +
fs/f2fs/data.c | 2 +
fs/f2fs/segment.c | 4 ++
include/trace/events/f2fs.h | 120 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 128 insertions(+)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index be6aa2e..197796a 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -20,6 +20,7 @@
#include "f2fs.h"
#include "node.h"
#include "segment.h"
+#include <trace/events/f2fs.h>

static struct kmem_cache *orphan_entry_slab;
static struct kmem_cache *inode_entry_slab;
@@ -75,6 +76,7 @@ static int f2fs_write_meta_page(struct page *page,
struct inode *inode = page->mapping->host;
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);

+ trace_f2fs_write_page(page, META);
/* Should not write any meta pages, if any IO error was occurred */
if (wbc->for_reclaim ||
is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)) {
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 503b5bf..40c0577 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -499,6 +499,7 @@ static int f2fs_write_data_page(struct page *page,
bool need_balance_fs = false;
int err = 0;

+ trace_f2fs_write_page(page, DATA);
if (page->index < end_index)
goto write;

@@ -608,6 +609,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
int err = 0;
int ilock;

+ trace_f2fs_write_begin(inode, pos, len, flags);
/* for nobh_write_end */
*fsdata = NULL;

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index c83a59a..1193a26 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -18,6 +18,7 @@
#include "f2fs.h"
#include "segment.h"
#include "node.h"
+#include <trace/events/f2fs.h>

/*
* This function balances dirty node and dentry pages.
@@ -690,6 +691,8 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,

if (sbi->bio[btype]) {
struct bio_private *p = sbi->bio[btype]->bi_private;
+ trace_f2fs_do_submit_bio(sbi->sb, btype, sync,
+ sbi->bio[btype]->bi_sector, sbi->bio[btype]->bi_size);
p->sbi = sbi;
sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
if (type == META_FLUSH) {
@@ -746,6 +749,7 @@ alloc_new:
sbi->last_block_in_bio[type] = blk_addr;

up_write(&sbi->bio_sem);
+ trace_f2fs_submit_write_page(page, blk_addr, type);
}

static bool __has_curseg_space(struct f2fs_sb_info *sbi, int type)
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index cf1bcdf8..32372a6 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -568,6 +568,126 @@ TRACE_EVENT(f2fs_reserve_new_block,
__entry->nid, __entry->ofs_node)
);

+TRACE_EVENT(f2fs_do_submit_bio,
+ TP_PROTO(struct super_block *sb, int btype, int sync, sector_t sector,
+ unsigned int size),
+ TP_ARGS(sb, btype, sync, sector, size),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(int, btype)
+ __field(int, sync)
+ __field(sector_t, sector)
+ __field(unsigned int, size)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = sb->s_dev;
+ __entry->btype = btype;
+ __entry->sync = sync;
+ __entry->sector = sector;
+ __entry->size = size;
+ ),
+
+ TP_printk("dev %d,%d: Bio type %d sync %d Sector %llu size %u",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->btype, __entry->sync,
+ (unsigned long long) __entry->sector, __entry->size)
+);
+
+
+TRACE_EVENT(f2fs_write_begin,
+
+ TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
+ unsigned int flags),
+
+ TP_ARGS(inode, pos, len, flags),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ __field(loff_t, pos)
+ __field(unsigned int, len)
+ __field(unsigned int, flags)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->pos = pos;
+ __entry->len = len;
+ __entry->flags = flags;
+ ),
+
+ TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino,
+ __entry->pos, __entry->len, __entry->flags)
+);
+
+TRACE_EVENT(f2fs_submit_write_page,
+
+ TP_PROTO(struct page *page, block_t blk_addr, int type),
+
+ TP_ARGS(page, blk_addr, type),
+
+ TP_STRUCT__entry(
+ __field(pgoff_t, index)
+ __field(int, type)
+ __field(ino_t, ino)
+ __field(dev_t, dev)
+ __field(block_t, block)
+
+ ),
+
+ TP_fast_assign(
+ __entry->index = page->index;
+ __entry->type = type;
+ __entry->ino = page->mapping->host->i_ino;
+ __entry->dev = page->mapping->host->i_sb->s_dev;
+ __entry->block = blk_addr;
+ ),
+
+ TP_printk("dev %d,%d ino %lu page_index %lu type %d block %llu",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino,
+ (unsigned long) __entry->index, __entry->type,
+ __entry->block)
+);
+
+DECLARE_EVENT_CLASS(f2fs_page_type_op,
+ TP_PROTO(struct page *page, int type),
+
+ TP_ARGS(page, type),
+
+ TP_STRUCT__entry(
+ __field(pgoff_t, index)
+ __field(int, type)
+ __field(ino_t, ino)
+ __field(dev_t, dev)
+
+ ),
+
+ TP_fast_assign(
+ __entry->index = page->index;
+ __entry->type = type;
+ __entry->ino = page->mapping->host->i_ino;
+ __entry->dev = page->mapping->host->i_sb->s_dev;
+ ),
+
+ TP_printk("dev %d,%d ino %lu page_index %lu type %d",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino,
+ (unsigned long) __entry->index, __entry->type)
+);
+
+DEFINE_EVENT(f2fs_page_type_op, f2fs_write_page,
+
+ TP_PROTO(struct page *page, int type),
+
+ TP_ARGS(page, type)
+);
+
#endif /* _TRACE_F2FS_H */

/* This part must be outside protection */
--
1.7.9.5


2013-04-23 10:41:32

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH v4 6/7] f2fs: add tracepoints for write page operations

From 6ec178dac6768204a6edf70f4a53d40b691c12b4 Mon Sep 17 00:00:00 2001
From: Namjae Jeon <[email protected]>
Date: Tue, 23 Apr 2013 17:51:43 +0900
Subject: [PATCH 6/7] f2fs: add tracepoints for write page operations
Cc: [email protected], [email protected],
[email protected]

Add tracepoints to debug the various page write operation
like data pages, meta pages.

Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
[Jaegeuk: remove unnecessary tracepoints]
Signed-off-by: Jaegeuk Kim <[email protected]>
---
fs/f2fs/segment.c | 5 ++++
include/trace/events/f2fs.h | 67
+++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 7c67ec2..0a65284 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -18,6 +18,7 @@
#include "f2fs.h"
#include "segment.h"
#include "node.h"
+#include <trace/events/f2fs.h>

/*
* This function balances dirty node and dentry pages.
@@ -691,6 +692,9 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
struct bio_private *p = sbi->bio[btype]->bi_private;
p->sbi = sbi;
sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
+
+ trace_f2fs_do_submit_bio(sbi->sb, btype, sync, sbi->bio[btype]);
+
if (type == META_FLUSH) {
DECLARE_COMPLETION_ONSTACK(wait);
p->is_sync = true;
@@ -745,6 +749,7 @@ alloc_new:
sbi->last_block_in_bio[type] = blk_addr;

up_write(&sbi->bio_sem);
+ trace_f2fs_submit_write_page(page, blk_addr, type);
}

static bool __has_curseg_space(struct f2fs_sb_info *sbi, int type)
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 56b6240..ae2da92 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -8,6 +8,14 @@

#define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev)
#define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino
+
+#define show_block_type(type) \
+ __print_symbolic(type, \
+ { NODE, "NODE" }, \
+ { DATA, "DATA" }, \
+ { META, "META" }, \
+ { META_FLUSH, "META_FLUSH" })
+
#define show_bio_type(type) \
__print_symbolic(type, \
{ READ, "READ" }, \
@@ -578,6 +586,65 @@ TRACE_EVENT(f2fs_reserve_new_block,
__entry->ofs_in_node)
);

+TRACE_EVENT(f2fs_do_submit_bio,
+
+ TP_PROTO(struct super_block *sb, int btype, bool sync, struct bio
*bio),
+
+ TP_ARGS(sb, btype, sync, bio),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(int, btype)
+ __field(bool, sync)
+ __field(sector_t, sector)
+ __field(unsigned int, size)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = sb->s_dev;
+ __entry->btype = btype;
+ __entry->sync = sync;
+ __entry->sector = bio->bi_sector;
+ __entry->size = bio->bi_size;
+ ),
+
+ TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %
u",
+ show_dev(__entry),
+ show_block_type(__entry->btype),
+ __entry->sync ? "sync" : "no sync",
+ (unsigned long long)__entry->sector,
+ __entry->size)
+);
+
+TRACE_EVENT(f2fs_submit_write_page,
+
+ TP_PROTO(struct page *page, block_t blk_addr, int type),
+
+ TP_ARGS(page, blk_addr, type),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ __field(int, type)
+ __field(pgoff_t, index)
+ __field(block_t, block)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = page->mapping->host->i_sb->s_dev;
+ __entry->ino = page->mapping->host->i_ino;
+ __entry->type = type;
+ __entry->index = page->index;
+ __entry->block = blk_addr;
+ ),
+
+ TP_printk("dev = (%d,%d), ino = %lu, %s, index = %lu, blkaddr = 0x%
llx",
+ show_dev_ino(__entry),
+ show_block_type(__entry->type),
+ (unsigned long)__entry->index,
+ (unsigned long long)__entry->block)
+);
+
#endif /* _TRACE_F2FS_H */

/* This part must be outside protection */
--
1.8.1.3.566.gaa39828



--
Jaegeuk Kim
Samsung


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part