Commit 627c10b7 authored by Steven Whitehouse's avatar Steven Whitehouse

GFS2: Improve tracing support (adds two flags)

This adds support for two new flags. One keeps track of whether
the glock is on the LRU list or not. The other isn't really a
flag as such, but an indication of whether the glock has an
attached object or not. This indication is reported without
any locking, which is ok since we do not dereference the object
pointer but merely report whether it is NULL or not.

Also, this fixes one place where a tracepoint was missing, which
was at the point we remove deallocated blocks from the journal.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent dba898b0
...@@ -170,6 +170,7 @@ void gfs2_glock_add_to_lru(struct gfs2_glock *gl) ...@@ -170,6 +170,7 @@ void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
atomic_inc(&lru_count); atomic_inc(&lru_count);
list_add_tail(&gl->gl_lru, &lru_list); list_add_tail(&gl->gl_lru, &lru_list);
set_bit(GLF_LRU, &gl->gl_flags);
spin_unlock(&lru_lock); spin_unlock(&lru_lock);
} }
...@@ -1364,6 +1365,7 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_m ...@@ -1364,6 +1365,7 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_m
while(nr && !list_empty(&lru_list)) { while(nr && !list_empty(&lru_list)) {
gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru); gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru);
list_del_init(&gl->gl_lru); list_del_init(&gl->gl_lru);
clear_bit(GLF_LRU, &gl->gl_flags);
atomic_dec(&lru_count); atomic_dec(&lru_count);
/* Test for being demotable */ /* Test for being demotable */
...@@ -1386,6 +1388,7 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_m ...@@ -1386,6 +1388,7 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_m
} }
nr_skipped++; nr_skipped++;
list_add(&gl->gl_lru, &skipped); list_add(&gl->gl_lru, &skipped);
set_bit(GLF_LRU, &gl->gl_flags);
} }
list_splice(&skipped, &lru_list); list_splice(&skipped, &lru_list);
atomic_add(nr_skipped, &lru_count); atomic_add(nr_skipped, &lru_count);
...@@ -1598,9 +1601,11 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) ...@@ -1598,9 +1601,11 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
return 0; return 0;
} }
static const char *gflags2str(char *buf, const unsigned long *gflags) static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
{ {
const unsigned long *gflags = &gl->gl_flags;
char *p = buf; char *p = buf;
if (test_bit(GLF_LOCK, gflags)) if (test_bit(GLF_LOCK, gflags))
*p++ = 'l'; *p++ = 'l';
if (test_bit(GLF_DEMOTE, gflags)) if (test_bit(GLF_DEMOTE, gflags))
...@@ -1623,6 +1628,10 @@ static const char *gflags2str(char *buf, const unsigned long *gflags) ...@@ -1623,6 +1628,10 @@ static const char *gflags2str(char *buf, const unsigned long *gflags)
*p++ = 'F'; *p++ = 'F';
if (test_bit(GLF_QUEUED, gflags)) if (test_bit(GLF_QUEUED, gflags))
*p++ = 'q'; *p++ = 'q';
if (test_bit(GLF_LRU, gflags))
*p++ = 'L';
if (gl->gl_object)
*p++ = 'o';
*p = 0; *p = 0;
return buf; return buf;
} }
...@@ -1661,7 +1670,7 @@ static int __dump_glock(struct seq_file *seq, const struct gfs2_glock *gl) ...@@ -1661,7 +1670,7 @@ static int __dump_glock(struct seq_file *seq, const struct gfs2_glock *gl)
state2str(gl->gl_state), state2str(gl->gl_state),
gl->gl_name.ln_type, gl->gl_name.ln_type,
(unsigned long long)gl->gl_name.ln_number, (unsigned long long)gl->gl_name.ln_number,
gflags2str(gflags_buf, &gl->gl_flags), gflags2str(gflags_buf, gl),
state2str(gl->gl_target), state2str(gl->gl_target),
state2str(gl->gl_demote_state), dtime, state2str(gl->gl_demote_state), dtime,
atomic_read(&gl->gl_ail_count), atomic_read(&gl->gl_ail_count),
......
...@@ -200,6 +200,8 @@ enum { ...@@ -200,6 +200,8 @@ enum {
GLF_INITIAL = 10, GLF_INITIAL = 10,
GLF_FROZEN = 11, GLF_FROZEN = 11,
GLF_QUEUED = 12, GLF_QUEUED = 12,
GLF_LRU = 13,
GLF_OBJECT = 14, /* Used only for tracing */
}; };
struct gfs2_glock { struct gfs2_glock {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "rgrp.h" #include "rgrp.h"
#include "trans.h" #include "trans.h"
#include "util.h" #include "util.h"
#include "trace_gfs2.h"
static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc) static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
{ {
...@@ -310,6 +311,7 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int ...@@ -310,6 +311,7 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int
struct gfs2_bufdata *bd = bh->b_private; struct gfs2_bufdata *bd = bh->b_private;
if (test_clear_buffer_pinned(bh)) { if (test_clear_buffer_pinned(bh)) {
trace_gfs2_pin(bd, 0);
atomic_dec(&sdp->sd_log_pinned); atomic_dec(&sdp->sd_log_pinned);
list_del_init(&bd->bd_le.le_list); list_del_init(&bd->bd_le.le_list);
if (meta) { if (meta) {
......
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
{(1UL << GLF_REPLY_PENDING), "r" }, \ {(1UL << GLF_REPLY_PENDING), "r" }, \
{(1UL << GLF_INITIAL), "I" }, \ {(1UL << GLF_INITIAL), "I" }, \
{(1UL << GLF_FROZEN), "F" }, \ {(1UL << GLF_FROZEN), "F" }, \
{(1UL << GLF_QUEUED), "q" }) {(1UL << GLF_QUEUED), "q" }, \
{(1UL << GLF_LRU), "L" }, \
{(1UL << GLF_OBJECT), "o" })
#ifndef NUMPTY #ifndef NUMPTY
#define NUMPTY #define NUMPTY
...@@ -94,7 +96,7 @@ TRACE_EVENT(gfs2_glock_state_change, ...@@ -94,7 +96,7 @@ TRACE_EVENT(gfs2_glock_state_change,
__entry->new_state = glock_trace_state(new_state); __entry->new_state = glock_trace_state(new_state);
__entry->tgt_state = glock_trace_state(gl->gl_target); __entry->tgt_state = glock_trace_state(gl->gl_target);
__entry->dmt_state = glock_trace_state(gl->gl_demote_state); __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
__entry->flags = gl->gl_flags; __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
), ),
TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s", TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s",
...@@ -127,7 +129,7 @@ TRACE_EVENT(gfs2_glock_put, ...@@ -127,7 +129,7 @@ TRACE_EVENT(gfs2_glock_put,
__entry->gltype = gl->gl_name.ln_type; __entry->gltype = gl->gl_name.ln_type;
__entry->glnum = gl->gl_name.ln_number; __entry->glnum = gl->gl_name.ln_number;
__entry->cur_state = glock_trace_state(gl->gl_state); __entry->cur_state = glock_trace_state(gl->gl_state);
__entry->flags = gl->gl_flags; __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
), ),
TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s", TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s",
...@@ -161,7 +163,7 @@ TRACE_EVENT(gfs2_demote_rq, ...@@ -161,7 +163,7 @@ TRACE_EVENT(gfs2_demote_rq,
__entry->glnum = gl->gl_name.ln_number; __entry->glnum = gl->gl_name.ln_number;
__entry->cur_state = glock_trace_state(gl->gl_state); __entry->cur_state = glock_trace_state(gl->gl_state);
__entry->dmt_state = glock_trace_state(gl->gl_demote_state); __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
__entry->flags = gl->gl_flags; __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
), ),
TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s", TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment