[Cluster-devel] [GFS2 PATCH 09/11] gfs2: enhance log_blocks trace point to show log blocks free
Bob Peterson
rpeterso at redhat.com
Fri Jul 24 18:33:02 UTC 2020
This patch adds some code to enhance the log_blocks trace point. It
reports the number of free log blocks, and also adds new trace points
for revoke writes that were previously missing.
Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
fs/gfs2/log.c | 12 ++++++++++--
fs/gfs2/trace_gfs2.h | 9 ++++++---
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 665e287bf4f1..489b6f5c605d 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -716,16 +716,24 @@ void gfs2_write_revokes(struct gfs2_sbd *sdp)
atomic_dec(&sdp->sd_log_blks_free);
/* If no blocks have been reserved, we need to also
* reserve a block for the header */
- if (!sdp->sd_log_blks_reserved)
+ if (!sdp->sd_log_blks_reserved) {
atomic_dec(&sdp->sd_log_blks_free);
+ trace_gfs2_log_blocks(sdp, -2, 7);
+ } else {
+ trace_gfs2_log_blocks(sdp, -1, 7);
+ }
}
gfs2_ail1_empty(sdp, max_revokes);
gfs2_log_unlock(sdp);
if (!sdp->sd_log_num_revoke) {
atomic_inc(&sdp->sd_log_blks_free);
- if (!sdp->sd_log_blks_reserved)
+ if (!sdp->sd_log_blks_reserved) {
atomic_inc(&sdp->sd_log_blks_free);
+ trace_gfs2_log_blocks(sdp, 2, 7);
+ } else {
+ trace_gfs2_log_blocks(sdp, 1, 7);
+ }
}
}
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index 1c4aa666e7e0..9d28be2a8b69 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -52,7 +52,8 @@
{ 3, "gfs2_log_flush" }, \
{ 4, "gfs2_log_flush2" }, \
{ 5, "log_refund" }, \
- { 6, "init_journal" })
+ { 6, "init_journal" }, \
+ { 7, "gfs2_write_revokes" })
#define show_glock_flags(flags) __print_flags(flags, "", \
{(1UL << GLF_LOCK), "l" }, \
@@ -398,17 +399,19 @@ TRACE_EVENT(gfs2_log_blocks,
__field( dev_t, dev )
__field( int, blocks )
__field( int, caller )
+ __field( int, blks_free )
),
TP_fast_assign(
__entry->dev = sdp->sd_vfs->s_dev;
__entry->blocks = blocks;
__entry->caller = caller;
+ __entry->blks_free = atomic_read(&sdp->sd_log_blks_free);
),
- TP_printk("%u,%u log reserve %d %s", MAJOR(__entry->dev),
+ TP_printk("%u,%u log reserve %d %s %d", MAJOR(__entry->dev),
MINOR(__entry->dev), __entry->blocks,
- lbcaller(__entry->caller))
+ lbcaller(__entry->caller), __entry->blks_free)
);
/* Writing back the AIL */
--
2.26.2
More information about the Cluster-devel
mailing list