From 7d71b610af80aef557d57b2e4f9d7f62829555e1 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 20 Oct 2021 14:06:02 -0700 Subject: [PATCH] Add server extent motion tracking Add tracking in the alloc functions that the server uses to move extents between allocator structures on behalf of client mounts. Signed-off-by: Zach Brown --- kmod/src/alloc.c | 6 ++++++ kmod/src/scoutfs_trace.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/kmod/src/alloc.c b/kmod/src/alloc.c index 7ef3ff30..1d64012d 100644 --- a/kmod/src/alloc.c +++ b/kmod/src/alloc.c @@ -970,6 +970,8 @@ int scoutfs_alloc_move(struct super_block *sb, struct scoutfs_alloc *alloc, moved += ext.len; scoutfs_inc_counter(sb, alloc_moved_extent); + + trace_scoutfs_alloc_move_extent(sb, &ext); } scoutfs_inc_counter(sb, alloc_move); @@ -1157,6 +1159,8 @@ int scoutfs_alloc_fill_list(struct super_block *sb, for (i = 0; i < ext.len; i++) list_block_add(lhead, lblk, ext.start + i); + + trace_scoutfs_alloc_fill_extent(sb, &ext); } out: @@ -1225,6 +1229,8 @@ int scoutfs_alloc_empty_list(struct super_block *sb, break; list_block_remove(lhead, lblk, ext.len); + + trace_scoutfs_alloc_empty_extent(sb, &ext); } scoutfs_block_put(sb, bl); diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index ce9e707f..635a1597 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -2609,6 +2609,36 @@ TRACE_EVENT(scoutfs_alloc_move, __entry->ret) ); +DECLARE_EVENT_CLASS(scoutfs_alloc_extent_class, + TP_PROTO(struct super_block *sb, struct scoutfs_extent *ext), + + TP_ARGS(sb, ext), + + TP_STRUCT__entry( + SCSB_TRACE_FIELDS + STE_FIELDS(ext) + ), + + TP_fast_assign( + SCSB_TRACE_ASSIGN(sb); + STE_ASSIGN(ext, ext); + ), + + TP_printk(SCSBF" ext "STE_FMT, SCSB_TRACE_ARGS, STE_ENTRY_ARGS(ext)) +); +DEFINE_EVENT(scoutfs_alloc_extent_class, scoutfs_alloc_move_extent, + TP_PROTO(struct super_block *sb, struct scoutfs_extent *ext), + TP_ARGS(sb, ext) +); +DEFINE_EVENT(scoutfs_alloc_extent_class, scoutfs_alloc_fill_extent, + TP_PROTO(struct super_block *sb, struct scoutfs_extent *ext), + TP_ARGS(sb, ext) +); +DEFINE_EVENT(scoutfs_alloc_extent_class, scoutfs_alloc_empty_extent, + TP_PROTO(struct super_block *sb, struct scoutfs_extent *ext), + TP_ARGS(sb, ext) +); + TRACE_EVENT(scoutfs_item_read_page, TP_PROTO(struct super_block *sb, struct scoutfs_key *key, struct scoutfs_key *pg_start, struct scoutfs_key *pg_end),