From 3a5093c6ae2e9a5a4ba307fa6b4de5ac4fe338b6 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Wed, 20 Sep 2017 11:13:28 -0500 Subject: [PATCH] scoutfs: replace trace_printk in alloc.c Signed-off-by: Mark Fasheh --- kmod/src/alloc.c | 6 ++--- kmod/src/scoutfs_trace.h | 52 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/kmod/src/alloc.c b/kmod/src/alloc.c index 0a938174..b501483c 100644 --- a/kmod/src/alloc.c +++ b/kmod/src/alloc.c @@ -21,6 +21,7 @@ #include "cmp.h" #include "alloc.h" #include "counters.h" +#include "scoutfs_trace.h" /* * scoutfs allocates segments using regions of an allocation bitmap @@ -190,7 +191,7 @@ out: } up_write(&sal->rwsem); - trace_printk("segno %llu ret %d\n", *segno, ret); + trace_scoutfs_alloc_segno(sb, *segno, ret); return ret; } @@ -231,8 +232,7 @@ int scoutfs_alloc_free(struct super_block *sb, u64 segno) out: up_write(&sal->rwsem); - trace_printk("freeing segno %llu ind %llu nr %d ret %d\n", - segno, ind, nr, ret); + trace_scoutfs_alloc_free(sb, segno, ind, nr, ret); return ret; } diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index b30504c9..de2f3b37 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -31,8 +31,58 @@ #include "kvec.h" #include "lock.h" #include "seg.h" +#include "super.h" -struct scoutfs_sb_info; +#define FSID_ARG(sb) le64_to_cpu(SCOUTFS_SB(sb)->super.hdr.fsid) +#define FSID_FMT "%llx" + +TRACE_EVENT(scoutfs_alloc_free, + TP_PROTO(struct super_block *sb, __u64 segno, __u64 index, int nr, + int ret), + + TP_ARGS(sb, segno, index, nr, ret), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, segno) + __field(__u64, index) + __field(int, nr) + __field(int, ret) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->segno = segno; + __entry->index = index; + __entry->nr = nr; + __entry->ret = ret; + ), + + TP_printk(FSID_FMT" freeing segno %llu ind %llu nr %d ret %d", + __entry->fsid, __entry->segno, __entry->index, __entry->nr, + __entry->ret) +); + +TRACE_EVENT(scoutfs_alloc_segno, + TP_PROTO(struct super_block *sb, __u64 segno, int ret), + + TP_ARGS(sb, segno, ret), + + TP_STRUCT__entry( + __field(__u64, fsid) + __field(__u64, segno) + __field(int, ret) + ), + + TP_fast_assign( + __entry->fsid = FSID_ARG(sb); + __entry->segno = segno; + __entry->ret = ret; + ), + + TP_printk(FSID_FMT" segno %llu ret %d", __entry->fsid, __entry->segno, + __entry->ret) +); TRACE_EVENT(scoutfs_write_begin, TP_PROTO(u64 ino, loff_t pos, unsigned len),