From 8ad6ff9d410a3812363c52167c51432b02e14617 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 21 Sep 2017 15:27:32 -0500 Subject: [PATCH] scoutfs: replace trace_printk in inode.c Signed-off-by: Mark Fasheh --- kmod/src/inode.c | 28 +++---- kmod/src/scoutfs_trace.h | 174 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 187 insertions(+), 15 deletions(-) diff --git a/kmod/src/inode.c b/kmod/src/inode.c index af14a3b0..11dc929a 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -94,7 +94,7 @@ static void scoutfs_i_callback(struct rcu_head *head) { struct inode *inode = container_of(head, struct inode, i_rcu); - trace_printk("freeing inode %p\n", inode); + trace_scoutfs_i_callback(inode); kmem_cache_free(scoutfs_inode_cachep, SCOUTFS_I(inode)); } @@ -554,9 +554,8 @@ static int update_index(struct super_block *sb, struct scoutfs_inode_info *si, int ret; int err; - trace_printk("ino %llu have %u now %llu.%u then %llu.%u \n", - ino, si->have_item, now_major, now_minor, then_major, - then_minor); + trace_scoutfs_inode_update_index(sb, ino, si->have_item, now_major, + now_minor, then_major, then_minor); if (si->have_item && now_major == then_major && now_minor == then_minor) return 0; @@ -715,7 +714,7 @@ void scoutfs_inode_fill_pool(struct super_block *sb, u64 ino, u64 nr) { struct free_ino_pool *pool = &SCOUTFS_SB(sb)->inode_sb_info->pool; - trace_printk("filling ino %llu nr %llu\n", ino, nr); + trace_scoutfs_inode_fill_pool(sb, ino, nr); spin_lock(&pool->lock); @@ -797,8 +796,9 @@ int scoutfs_alloc_ino(struct super_block *sb, u64 *ino) spin_unlock(&pool->lock); out: - trace_printk("ret %d ino %llu pool ino %llu nr %llu req %u (racey)\n", - ret, *ino, pool->ino, pool->nr, pool->in_flight); + + trace_scoutfs_alloc_ino(sb, ret, *ino, pool->ino, pool->nr, + pool->in_flight); return ret; } @@ -913,7 +913,7 @@ static int delete_inode_items(struct super_block *sb, u64 ino) } mode = le32_to_cpu(sinode.mode); - trace_delete_inode(sb, ino, mode); + trace_scoutfs_delete_inode(sb, ino, mode); /* XXX this is obviously not done yet :) */ ret = scoutfs_hold_trans(sb, SIC_DIRTY_INODE()); @@ -958,8 +958,8 @@ out: */ void scoutfs_evict_inode(struct inode *inode) { - trace_printk("ino %llu nlink %d bad %d\n", - scoutfs_ino(inode), inode->i_nlink, is_bad_inode(inode)); + trace_scoutfs_evict_inode(inode->i_sb, scoutfs_ino(inode), + inode->i_nlink, is_bad_inode(inode)); if (is_bad_inode(inode)) goto clear; @@ -976,8 +976,8 @@ int scoutfs_drop_inode(struct inode *inode) { int ret = generic_drop_inode(inode); - trace_printk("ret %d nlink %d unhashed %d\n", - ret, inode->i_nlink, inode_unhashed(inode)); + trace_scoutfs_drop_inode(inode->i_sb, scoutfs_ino(inode), + inode->i_nlink, inode_unhashed(inode)); return ret; } @@ -1102,8 +1102,8 @@ int scoutfs_inode_walk_writeback(struct super_block *sb, bool write) ret = filemap_fdatawrite(inode->i_mapping); else ret = filemap_fdatawait(inode->i_mapping); - trace_printk("ino %llu write %d ret %d\n", - scoutfs_ino(inode), write, ret); + trace_scoutfs_inode_walk_writeback(sb, scoutfs_ino(inode), + write, ret); if (ret) { iput(inode); goto out; diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index ed2b30fd..68ab2c3a 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -38,6 +38,178 @@ struct lock_info; #define FSID_ARG(sb) le64_to_cpu(SCOUTFS_SB(sb)->super.hdr.fsid) #define FSID_FMT "%llx" +TRACE_EVENT(scoutfs_i_callback, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode), + + TP_STRUCT__entry( + __field(struct inode *, inode) + ), + + TP_fast_assign( + __entry->inode = inode; + ), + + /* don't print fsid as we may not have our sb private available */ + TP_printk("freeing inode %p", __entry->inode) +); + +TRACE_EVENT(scoutfs_inode_update_index, + TP_PROTO(struct super_block *sb, __u64 ino, unsigned int have_item, + __u64 now_major, unsigned int now_minor, __u64 then_major, + unsigned int then_minor), + + TP_ARGS(sb, ino, have_item, now_major, now_minor, then_major, + then_minor), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, ino) + __field(unsigned int, have_item) + __field(__u64, now_major) + __field(unsigned int, now_minor) + __field(__u64, then_major) + __field(unsigned int, then_minor) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->ino = ino; + __entry->have_item = have_item; + __entry->now_major = now_major; + __entry->now_minor = now_minor; + __entry->then_major = then_major; + __entry->then_minor = then_minor; + ), + + TP_printk(FSID_FMT" ino %llu have %u now %llu.%u then %llu.%u", + __entry->fsid, __entry->ino, __entry->have_item, + __entry->now_major, __entry->now_minor, __entry->then_major, + __entry->then_minor) +); + +TRACE_EVENT(scoutfs_inode_fill_pool, + TP_PROTO(struct super_block *sb, __u64 ino, __u64 nr), + + TP_ARGS(sb, ino, nr), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, ino) + __field(__u64, nr) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->ino = ino; + __entry->nr = nr; + ), + + TP_printk(FSID_FMT" filling ino %llu nr %llu", __entry->fsid, + __entry->ino, __entry->nr) +); + +TRACE_EVENT(scoutfs_alloc_ino, + TP_PROTO(struct super_block *sb, int ret, __u64 ino, __u64 pool_ino, + __u64 nr, unsigned int in_flight), + + TP_ARGS(sb, ret, ino, pool_ino, nr, in_flight), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(int, ret) + __field(__u64, ino) + __field(__u64, pool_ino) + __field(__u64, nr) + __field(unsigned int, in_flight) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->ret = ret; + __entry->ino = ino; + __entry->pool_ino = pool_ino; + __entry->nr = nr; + __entry->in_flight = in_flight; + ), + + TP_printk(FSID_FMT" ret %d ino %llu pool ino %llu nr %llu req %u " + "(racey)", __entry->fsid, __entry->ret, __entry->ino, + __entry->pool_ino, __entry->nr, __entry->in_flight) +); + +TRACE_EVENT(scoutfs_evict_inode, + TP_PROTO(struct super_block *sb, __u64 ino, unsigned int nlink, + unsigned int is_bad_ino), + + TP_ARGS(sb, ino, nlink, is_bad_ino), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, ino) + __field(unsigned int, nlink) + __field(unsigned int, is_bad_ino) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->ino = ino; + __entry->nlink = nlink; + __entry->is_bad_ino = is_bad_ino; + ), + + TP_printk(FSID_FMT" ino %llu nlink %u bad %d", __entry->fsid, + __entry->ino, __entry->nlink, __entry->is_bad_ino) +); + +TRACE_EVENT(scoutfs_drop_inode, + TP_PROTO(struct super_block *sb, __u64 ino, unsigned int nlink, + unsigned int unhashed), + + TP_ARGS(sb, ino, nlink, unhashed), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, ino) + __field(unsigned int, nlink) + __field(unsigned int, unhashed) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->ino = ino; + __entry->nlink = nlink; + __entry->unhashed = unhashed; + ), + + TP_printk(FSID_FMT" ino %llu nlink %u unhashed %d", __entry->fsid, + __entry->ino, __entry->nlink, __entry->unhashed) +); + +TRACE_EVENT(scoutfs_inode_walk_writeback, + TP_PROTO(struct super_block *sb, __u64 ino, int write, int ret), + + TP_ARGS(sb, ino, write, ret), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, ino) + __field(int, write) + __field(int, ret) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->ino = ino; + __entry->write = write; + __entry->ret = ret; + ), + + TP_printk(FSID_FMT" ino %llu write %d ret %d", __entry->fsid, + __entry->ino, __entry->write, __entry->ret) +); + DECLARE_EVENT_CLASS(scoutfs_segment_class, TP_PROTO(struct super_block *sb, __u64 segno), @@ -351,7 +523,7 @@ TRACE_EVENT(scoutfs_orphan_inode, MINOR(__entry->dev), __entry->ino) ); -TRACE_EVENT(delete_inode, +TRACE_EVENT(scoutfs_delete_inode, TP_PROTO(struct super_block *sb, u64 ino, umode_t mode), TP_ARGS(sb, ino, mode),