From abd7ffc247aee8cf08c8a18938eb8a21a4fac671 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 30 May 2019 14:03:39 -0700 Subject: [PATCH] scoutfs: only trace read qourum blocks after io We have trace points as blocks are read, but the reads are cached as buffer heads. The iteration helpers are used to referenced cached blocks a few times in each voting cycle and we end up tracing cached read blocks multiple times. This uses a bit on the buffer_head to only trace a cached block the first time it's read. Signed-off-by: Zach Brown --- kmod/src/quorum.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kmod/src/quorum.c b/kmod/src/quorum.c index f24f4e03..5804a3a9 100644 --- a/kmod/src/quorum.c +++ b/kmod/src/quorum.c @@ -256,6 +256,13 @@ out: return ret; } +enum { + BH_ScoutfsTraced = BH_PrivateStart, +}; + +BUFFER_FNS(ScoutfsTraced, scoutfs_traced) /* has been traced */ +TAS_BUFFER_FNS(ScoutfsTraced, scoutfs_traced) + /* * The caller is about to read the current version of a set of quorum * blocks. We invalidate all the quorum blocks in the cache and @@ -279,6 +286,7 @@ static void readahead_quorum_blocks(struct super_block *sb) lock_buffer(bh); clear_buffer_uptodate(bh); + clear_buffer_scoutfs_traced(bh); unlock_buffer(bh); ll_rw_block(READA | REQ_META | REQ_PRIO, 1, &bh); @@ -346,7 +354,8 @@ static int read_quorum_block(struct super_block *sb, if (blk->write_nr == 0) goto out; - trace_scoutfs_quorum_read_block(sb, bh->b_blocknr, blk); + if (!test_set_buffer_scoutfs_traced(bh)) + trace_scoutfs_quorum_read_block(sb, bh->b_blocknr, blk); if (invalid_quorum_block(super, bh, blk)) { scoutfs_inc_counter(sb, quorum_read_invalid_block);