[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1365227157-15424-1-git-send-email-linkinjeon@gmail.com>
Date: Sat, 6 Apr 2013 14:45:57 +0900
From: Namjae Jeon <linkinjeon@...il.com>
To: jaegeuk.kim@...sung.com, rostedt@...dmis.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Namjae Jeon <linkinjeon@...il.com>,
Namjae Jeon <namjae.jeon@...sung.com>,
Pankaj Kumar <pankaj.km@...sung.com>
Subject: [PATCH v3 2/7] f2fs: add tracepoints for truncate operation
From: Namjae Jeon <namjae.jeon@...sung.com>
add tracepoints for tracing the truncate operations
like truncate node/data blocks, f2fs_truncate etc.
Tracepoints are added at entry and exit of operation
to trace the success & failure of operation.
Signed-off-by: Namjae Jeon <namjae.jeon@...sung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@...sung.com>
---
fs/f2fs/file.c | 6 ++-
fs/f2fs/node.c | 7 +++
include/trace/events/f2fs.h | 108 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 120 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index c937d7b..f082a16 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -175,6 +175,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
struct f2fs_node *raw_node;
__le32 *addr;
+ trace_f2fs_truncate_data_blocks_range_enter(dn->inode,
+ dn->data_blkaddr, dn->nid);
raw_node = page_address(dn->node_page);
addr = blkaddr_in_node(raw_node) + ofs;
@@ -193,6 +195,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
sync_inode_page(dn);
}
dn->ofs_in_node = ofs;
+
+ trace_f2fs_truncate_data_blocks_range_exit(dn->inode, nr_free);
return nr_free;
}
@@ -271,7 +275,7 @@ void f2fs_truncate(struct inode *inode)
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)))
return;
-
+ trace_f2fs_truncate(inode);
if (!truncate_blocks(inode, i_size_read(inode))) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
mark_inode_dirty(inode);
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 7555fb7..7db4813 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -19,6 +19,7 @@
#include "f2fs.h"
#include "node.h"
#include "segment.h"
+#include <trace/events/f2fs.h>
static struct kmem_cache *nat_entry_slab;
static struct kmem_cache *free_nid_slab;
@@ -547,6 +548,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
int freed = 0;
int i, ret;
+ trace_f2fs_truncate_nodes_enter(dn->inode, dn->data_blkaddr, dn->nid);
if (dn->nid == 0)
return NIDS_PER_BLOCK + 1;
@@ -594,10 +596,12 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
} else {
f2fs_put_page(page, 1);
}
+ trace_f2fs_truncate_nodes_exit(dn->inode, freed);
return freed;
out_err:
f2fs_put_page(page, 1);
+ trace_f2fs_truncate_nodes_exit(dn->inode, ret);
return ret;
}
@@ -612,6 +616,8 @@ static int truncate_partial_nodes(struct dnode_of_data *dn,
int i;
int idx = depth - 2;
+ trace_f2fs_truncate_partial_nodes_enter(dn->inode,
+ dn->data_blkaddr, dn->nid);
nid[0] = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]);
if (!nid[0])
return 0;
@@ -652,6 +658,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn,
fail:
for (i = depth - 3; i >= 0; i--)
f2fs_put_page(pages[i], 1);
+ trace_f2fs_truncate_partial_nodes_exit(dn->inode, err);
return err;
}
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index fd50db9..0d39f58 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -158,6 +158,114 @@ DEFINE_EVENT(f2fs_file_inode_ret, f2fs_unlink_exit,
TP_ARGS(inode, ret)
);
+DECLARE_EVENT_CLASS(f2fs__truncate_op,
+ TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid),
+
+ TP_ARGS(inode, blk_addr, nid),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ __field(block_t, addr)
+ __field(unsigned int, nid)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->addr = blk_addr;
+ __entry->nid = nid;
+ ),
+
+ TP_printk("dev %d,%d ino %lu block_address %llu Nid %d ",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino, __entry->addr, __entry->nid)
+);
+
+DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_data_blocks_range_enter,
+
+ TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid),
+
+ TP_ARGS(inode, blk_addr, nid)
+);
+
+DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_nodes_enter,
+
+ TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid),
+
+ TP_ARGS(inode, blk_addr, nid)
+);
+
+DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_partial_nodes_enter,
+
+ TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid),
+
+ TP_ARGS(inode, blk_addr, nid)
+);
+
+DECLARE_EVENT_CLASS(f2fs__truncate_op_exit,
+ TP_PROTO(struct inode *inode, int value),
+ TP_ARGS(inode, value),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ __field(int, val)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->val = value;
+ ),
+
+ TP_printk("dev %d,%d ino %lu with return value %d ",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino, __entry->val)
+);
+
+DEFINE_EVENT(f2fs__truncate_op_exit, f2fs_truncate_data_blocks_range_exit,
+
+ TP_PROTO(struct inode *inode, int nr_free),
+
+ TP_ARGS(inode, nr_free)
+);
+
+DEFINE_EVENT(f2fs__truncate_op_exit, f2fs_truncate_nodes_exit,
+
+ TP_PROTO(struct inode *inode, int ret),
+
+ TP_ARGS(inode, ret)
+);
+
+DEFINE_EVENT(f2fs__truncate_op_exit, f2fs_truncate_partial_nodes_exit,
+
+ TP_PROTO(struct inode *inode, int err),
+
+ TP_ARGS(inode, err)
+);
+
+TRACE_EVENT(f2fs_truncate,
+
+ TP_PROTO(struct inode *inode),
+
+ TP_ARGS(inode),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ ),
+
+ TP_printk("dev %d,%d ino %lu ",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long) __entry->ino)
+);
+
#endif /* _TRACE_F2FS_H */
/* This part must be outside protection */
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists