From 55fa73f407535120fe7dd1d447df2c09bb3d0352 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 13 Dec 2019 15:42:31 -0800 Subject: [PATCH] scoutfs: add packed extent and bitmap tracing Signed-off-by: Zach Brown --- kmod/src/data.c | 8 ++++- kmod/src/scoutfs_trace.h | 65 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/kmod/src/data.c b/kmod/src/data.c index 1d3c29e0..802e7d47 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -1085,6 +1085,10 @@ static int alloc_blocks(struct super_block *sb, u64 count, u64 *blkno_ret, *blkno_ret = blkno; *count_ret = count; + + trace_scoutfs_data_alloc_blocks(sb, broot, bb->base, bb->type, bit, + blkno, count); + out: kfree(bb); return ret; @@ -1113,8 +1117,10 @@ static int free_blocks(struct super_block *sb, &broot->root, SCOUTFS_BLOCK_BITMAP_LITTLE, blkno, count); - if (ret == 0) + if (ret == 0) { le64_add_cpu(&broot->total_free, count); + trace_scoutfs_data_free_blocks(sb, broot, blkno, count); + } return ret; } diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index 712ab69b..33dbd9e4 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -118,6 +118,71 @@ TRACE_EVENT(scoutfs_complete_truncate, __entry->flags) ); +TRACE_EVENT(scoutfs_data_alloc_blocks, + TP_PROTO(struct super_block *sb, struct scoutfs_balloc_root *broot, + u64 base, u8 type, int bit, u64 blkno, u64 count), + + TP_ARGS(sb, broot, base, type, bit, blkno, count), + + TP_STRUCT__entry( + SCSB_TRACE_FIELDS + __field(__u64, root_blkno) + __field(__u64, root_seq) + __field(__u64, root_total_free) + __field(__u64, base) + __field(u8, type) + __field(int, bit) + __field(__u64, blkno) + __field(__u64, count) + ), + + TP_fast_assign( + SCSB_TRACE_ASSIGN(sb); + __entry->root_blkno = le64_to_cpu(broot->root.ref.blkno); + __entry->root_seq = le64_to_cpu(broot->root.ref.seq); + __entry->root_total_free = le64_to_cpu(broot->total_free); + __entry->base = base; + __entry->type = type; + __entry->bit = bit; + __entry->blkno = blkno; + __entry->count = count; + ), + + TP_printk(SCSBF" root_blkno %llu root_seq %llu root_total_free %llu base %llu type %u bit %d blkno %llu count %llu\n", + SCSB_TRACE_ARGS, __entry->root_blkno, __entry->root_seq, + __entry->root_total_free, __entry->base, __entry->type, + __entry->bit, __entry->blkno, __entry->count) +); + +TRACE_EVENT(scoutfs_data_free_blocks, + TP_PROTO(struct super_block *sb, struct scoutfs_balloc_root *broot, + u64 blkno, u64 count), + + TP_ARGS(sb, broot, blkno, count), + + TP_STRUCT__entry( + SCSB_TRACE_FIELDS + __field(__u64, root_blkno) + __field(__u64, root_seq) + __field(__u64, root_total_free) + __field(__u64, blkno) + __field(__u64, count) + ), + + TP_fast_assign( + SCSB_TRACE_ASSIGN(sb); + __entry->root_blkno = le64_to_cpu(broot->root.ref.blkno); + __entry->root_seq = le64_to_cpu(broot->root.ref.seq); + __entry->root_total_free = le64_to_cpu(broot->total_free); + __entry->blkno = blkno; + __entry->count = count; + ), + + TP_printk(SCSBF" root_blkno %llu root_seq %llu root_total_free %llu blkno %llu count %llu\n", + SCSB_TRACE_ARGS, __entry->root_blkno, __entry->root_seq, + __entry->root_total_free, __entry->blkno, __entry->count) +); + TRACE_EVENT(scoutfs_data_fallocate, TP_PROTO(struct super_block *sb, u64 ino, int mode, loff_t offset, loff_t len, int ret),