From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH 08/11] gfs2: Add caller info to log_blocks trace point
Date: Fri, 24 Jul 2020 13:33:01 -0500 [thread overview]
Message-ID: <20200724183304.366913-9-rpeterso@redhat.com> (raw)
In-Reply-To: <20200724183304.366913-1-rpeterso@redhat.com>
The log_blocks kernel trace point becomes much more useful if we know
from whence the call was made. This patch adds caller info to the trace
point.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/log.c | 12 ++++++------
fs/gfs2/ops_fstype.c | 2 +-
fs/gfs2/trace_gfs2.h | 20 ++++++++++++++++----
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index a58333e3980d..665e287bf4f1 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -396,7 +396,7 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
{
atomic_add(blks, &sdp->sd_log_blks_free);
- trace_gfs2_log_blocks(sdp, blks);
+ trace_gfs2_log_blocks(sdp, blks, 0);
gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <=
sdp->sd_jdesc->jd_blocks);
up_read(&sdp->sd_log_flush_lock);
@@ -457,7 +457,7 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks)
goto retry;
}
atomic_sub(blks, &sdp->sd_log_blks_needed);
- trace_gfs2_log_blocks(sdp, -blks);
+ trace_gfs2_log_blocks(sdp, -blks, 1);
/*
* If we waited, then so might others, wake them up _after_ we get
@@ -576,7 +576,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail)
ail2_empty(sdp, new_tail);
atomic_add(dist, &sdp->sd_log_blks_free);
- trace_gfs2_log_blocks(sdp, dist);
+ trace_gfs2_log_blocks(sdp, dist, 2);
gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <=
sdp->sd_jdesc->jd_blocks);
@@ -966,7 +966,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
log_write_header(sdp, flags);
} else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle){
atomic_dec(&sdp->sd_log_blks_free); /* Adjust for unreserved buffer */
- trace_gfs2_log_blocks(sdp, -1);
+ trace_gfs2_log_blocks(sdp, -1, 3);
log_write_header(sdp, flags);
}
if (gfs2_withdrawn(sdp))
@@ -992,7 +992,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
if (gfs2_withdrawn(sdp))
goto out;
atomic_dec(&sdp->sd_log_blks_free); /* Adjust for unreserved buffer */
- trace_gfs2_log_blocks(sdp, -1);
+ trace_gfs2_log_blocks(sdp, -1, 4);
log_write_header(sdp, flags);
sdp->sd_log_head = sdp->sd_log_flush_head;
}
@@ -1075,7 +1075,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
gfs2_assert_withdraw(sdp, maxres >= reserved);
unused = maxres - reserved;
atomic_add(unused, &sdp->sd_log_blks_free);
- trace_gfs2_log_blocks(sdp, unused);
+ trace_gfs2_log_blocks(sdp, unused, 5);
gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <=
sdp->sd_jdesc->jd_blocks);
sdp->sd_log_blks_reserved = reserved;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 6d18d2c91add..b2538eea3e5e 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -688,7 +688,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
/* Map the extents for this journal's blocks */
gfs2_map_journal_extents(sdp, sdp->sd_jdesc);
}
- trace_gfs2_log_blocks(sdp, atomic_read(&sdp->sd_log_blks_free));
+ trace_gfs2_log_blocks(sdp, atomic_read(&sdp->sd_log_blks_free), 6);
if (sdp->sd_lockstruct.ls_first) {
unsigned int x;
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index e0025258107a..1c4aa666e7e0 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -45,6 +45,15 @@
{ 2, "ins " }, \
{ 3, "clm " })
+#define lbcaller(x) __print_symbolic(x, \
+ { 0, "gfs2_log_release" }, \
+ { 1, "gfs2_log_reserve" }, \
+ { 2, "log_pull_tail" }, \
+ { 3, "gfs2_log_flush" }, \
+ { 4, "gfs2_log_flush2" }, \
+ { 5, "log_refund" }, \
+ { 6, "init_journal" })
+
#define show_glock_flags(flags) __print_flags(flags, "", \
{(1UL << GLF_LOCK), "l" }, \
{(1UL << GLF_DEMOTE), "D" }, \
@@ -381,22 +390,25 @@ TRACE_EVENT(gfs2_log_flush,
/* Reserving/releasing blocks in the log */
TRACE_EVENT(gfs2_log_blocks,
- TP_PROTO(const struct gfs2_sbd *sdp, int blocks),
+ TP_PROTO(const struct gfs2_sbd *sdp, int blocks, int caller),
- TP_ARGS(sdp, blocks),
+ TP_ARGS(sdp, blocks, caller),
TP_STRUCT__entry(
__field( dev_t, dev )
__field( int, blocks )
+ __field( int, caller )
),
TP_fast_assign(
__entry->dev = sdp->sd_vfs->s_dev;
__entry->blocks = blocks;
+ __entry->caller = caller;
),
- TP_printk("%u,%u log reserve %d", MAJOR(__entry->dev),
- MINOR(__entry->dev), __entry->blocks)
+ TP_printk("%u,%u log reserve %d %s", MAJOR(__entry->dev),
+ MINOR(__entry->dev), __entry->blocks,
+ lbcaller(__entry->caller))
);
/* Writing back the AIL */
--
2.26.2
next prev parent reply other threads:[~2020-07-24 18:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 18:32 [Cluster-devel] [GFS2 PATCH 00/11] gfs2: jdata patch collection Bob Peterson
2020-07-24 18:32 ` [Cluster-devel] [GFS2 PATCH 01/11] gfs2: inline gfs2_write_jdata_pagevec into gfs2_write_cache_jdata Bob Peterson
2020-07-24 18:32 ` [Cluster-devel] [GFS2 PATCH 02/11] gfs2: don't break integrity writeback on __gfs2_jdata_writepage error Bob Peterson
2020-08-03 17:54 ` Andreas Gruenbacher
2020-07-24 18:32 ` [Cluster-devel] [GFS2 PATCH 03/11] gfs2: Fix inaccurate comment Bob Peterson
2020-07-24 18:32 ` [Cluster-devel] [GFS2 PATCH 04/11] gfs2: don't try to add buffers to transactions a second time for jdata Bob Peterson
2020-08-03 17:52 ` Andreas Gruenbacher
2020-07-24 18:32 ` [Cluster-devel] [GFS2 PATCH 05/11] gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe Bob Peterson
2020-07-24 18:32 ` [Cluster-devel] [GFS2 PATCH 06/11] gfs2: rename gfs2_write_full_page to gfs2_write_jdata_page, remove parm Bob Peterson
2020-07-24 18:33 ` [Cluster-devel] [GFS2 PATCH 07/11] gfs2: Add a new jdata-specific version of gfs2_get_block_noalloc Bob Peterson
2020-07-24 18:33 ` Bob Peterson [this message]
2020-07-24 18:33 ` [Cluster-devel] [GFS2 PATCH 09/11] gfs2: enhance log_blocks trace point to show log blocks free Bob Peterson
2020-07-24 18:33 ` [Cluster-devel] [GFS2 PATCH 10/11] gfs2: print details on transactions that aren't properly ended Bob Peterson
2020-07-24 18:33 ` [Cluster-devel] [GFS2 PATCH 11/11] gfs2: Never call gfs2_block_zero_range with an open transaction Bob Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200724183304.366913-9-rpeterso@redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).