Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030874Ab3DSQ3k (ORCPT ); Fri, 19 Apr 2013 12:29:40 -0400 Received: from mail-da0-f52.google.com ([209.85.210.52]:43264 "EHLO mail-da0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967799Ab3DSQ3i (ORCPT ); Fri, 19 Apr 2013 12:29:38 -0400 From: Namjae Jeon To: jaegeuk.kim@samsung.com, rostedt@goodmis.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Namjae Jeon , Namjae Jeon , Pankaj Kumar Subject: [PATCH v4 5/7] f2fs: add tracepoints to debug the block allocation & fallocate Date: Sat, 20 Apr 2013 01:29:30 +0900 Message-Id: <1366388970-18949-1-git-send-email-linkinjeon@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3726 Lines: 128 From: Namjae Jeon Add tracepoints to debug the block allocation & fallocate. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar Acked-by: Steven Rostedt --- fs/f2fs/data.c | 1 + fs/f2fs/file.c | 6 ++++- include/trace/events/f2fs.h | 59 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 394ab68..503b5bf 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -56,6 +56,7 @@ int reserve_new_block(struct dnode_of_data *dn) if (!inc_valid_block_count(sbi, dn->inode, 1)) return -ENOSPC; + trace_f2fs_reserve_new_block(dn->inode, dn->nid, dn->ofs_in_node); __set_data_blkaddr(dn, NEW_ADDR); dn->data_blkaddr = NEW_ADDR; sync_inode_page(dn); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 31176d5..64eeb5a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -532,8 +532,10 @@ static long f2fs_fallocate(struct file *file, int mode, struct inode *inode = file_inode(file); long ret; - if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) + if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) { + trace_f2fs_fallocate(inode, offset, len, mode, -EOPNOTSUPP); return -EOPNOTSUPP; + } if (mode & FALLOC_FL_PUNCH_HOLE) ret = punch_hole(inode, offset, len, mode); @@ -544,6 +546,8 @@ static long f2fs_fallocate(struct file *file, int mode, inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); } + + trace_f2fs_fallocate(inode, offset, len, mode, ret); return ret; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 57b6487..cf1bcdf8 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -509,6 +509,65 @@ TRACE_EVENT(f2fs_get_victim, __entry->victim) ); +TRACE_EVENT(f2fs_fallocate, + TP_PROTO(struct inode *inode, loff_t offset, loff_t len, + int mode, int ret), + + TP_ARGS(inode, offset, len, mode, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(loff_t, len) + __field(int, mode) + __field(blkcnt_t, blocks) + __field(loff_t, size) + __field(int, ret) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->pos = offset; + __entry->len = len; + __entry->mode = mode; + __entry->blocks = inode->i_blocks; + __entry->size = inode->i_size; + __entry->ret = ret; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d block %llu" + "Size %lld ret %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->pos, + __entry->len, __entry->mode, + (unsigned long long)__entry->blocks, __entry->size, + __entry->ret) +); + +TRACE_EVENT(f2fs_reserve_new_block, + TP_PROTO(struct inode *inode, unsigned int nid, unsigned int ofs_node), + + TP_ARGS(inode, nid, ofs_node), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(unsigned int, nid) + __field(unsigned int, ofs_node) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->nid = nid; + __entry->ofs_node = ofs_node; + ), + + TP_printk("dev %d,%d: with Nid %u Node page offset %u", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->nid, __entry->ofs_node) +); + #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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/