aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-04-14 09:09:52 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-04-20 04:00:59 -0400
commit627c10b7e471b5dcfb7101d6cc74d219619c9bc4 (patch)
tree28b485c2ce46035da616c1a20f4ac92bae96427a /fs/gfs2
parentdba898b02defa66e5fe493d58ec0293a940f9c93 (diff)
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: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c13
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/meta_io.c2
-rw-r--r--fs/gfs2/trace_gfs2.h10
4 files changed, 21 insertions, 6 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 1019183232fe..0c6c69090140 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -170,6 +170,7 @@ void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
170 atomic_inc(&lru_count); 170 atomic_inc(&lru_count);
171 171
172 list_add_tail(&gl->gl_lru, &lru_list); 172 list_add_tail(&gl->gl_lru, &lru_list);
173 set_bit(GLF_LRU, &gl->gl_flags);
173 spin_unlock(&lru_lock); 174 spin_unlock(&lru_lock);
174} 175}
175 176
@@ -1364,6 +1365,7 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_m
1364 while(nr && !list_empty(&lru_list)) { 1365 while(nr && !list_empty(&lru_list)) {
1365 gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru); 1366 gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru);
1366 list_del_init(&gl->gl_lru); 1367 list_del_init(&gl->gl_lru);
1368 clear_bit(GLF_LRU, &gl->gl_flags);
1367 atomic_dec(&lru_count); 1369 atomic_dec(&lru_count);
1368 1370
1369 /* Test for being demotable */ 1371 /* Test for being demotable */
@@ -1386,6 +1388,7 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_m
1386 } 1388 }
1387 nr_skipped++; 1389 nr_skipped++;
1388 list_add(&gl->gl_lru, &skipped); 1390 list_add(&gl->gl_lru, &skipped);
1391 set_bit(GLF_LRU, &gl->gl_flags);
1389 } 1392 }
1390 list_splice(&skipped, &lru_list); 1393 list_splice(&skipped, &lru_list);
1391 atomic_add(nr_skipped, &lru_count); 1394 atomic_add(nr_skipped, &lru_count);
@@ -1598,9 +1601,11 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
1598 return 0; 1601 return 0;
1599} 1602}
1600 1603
1601static const char *gflags2str(char *buf, const unsigned long *gflags) 1604static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
1602{ 1605{
1606 const unsigned long *gflags = &gl->gl_flags;
1603 char *p = buf; 1607 char *p = buf;
1608
1604 if (test_bit(GLF_LOCK, gflags)) 1609 if (test_bit(GLF_LOCK, gflags))
1605 *p++ = 'l'; 1610 *p++ = 'l';
1606 if (test_bit(GLF_DEMOTE, gflags)) 1611 if (test_bit(GLF_DEMOTE, gflags))
@@ -1623,6 +1628,10 @@ static const char *gflags2str(char *buf, const unsigned long *gflags)
1623 *p++ = 'F'; 1628 *p++ = 'F';
1624 if (test_bit(GLF_QUEUED, gflags)) 1629 if (test_bit(GLF_QUEUED, gflags))
1625 *p++ = 'q'; 1630 *p++ = 'q';
1631 if (test_bit(GLF_LRU, gflags))
1632 *p++ = 'L';
1633 if (gl->gl_object)
1634 *p++ = 'o';
1626 *p = 0; 1635 *p = 0;
1627 return buf; 1636 return buf;
1628} 1637}
@@ -1661,7 +1670,7 @@ static int __dump_glock(struct seq_file *seq, const struct gfs2_glock *gl)
1661 state2str(gl->gl_state), 1670 state2str(gl->gl_state),
1662 gl->gl_name.ln_type, 1671 gl->gl_name.ln_type,
1663 (unsigned long long)gl->gl_name.ln_number, 1672 (unsigned long long)gl->gl_name.ln_number,
1664 gflags2str(gflags_buf, &gl->gl_flags), 1673 gflags2str(gflags_buf, gl),
1665 state2str(gl->gl_target), 1674 state2str(gl->gl_target),
1666 state2str(gl->gl_demote_state), dtime, 1675 state2str(gl->gl_demote_state), dtime,
1667 atomic_read(&gl->gl_ail_count), 1676 atomic_read(&gl->gl_ail_count),
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 870a89d6d4dc..48eb1eed51b5 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -200,6 +200,8 @@ enum {
200 GLF_INITIAL = 10, 200 GLF_INITIAL = 10,
201 GLF_FROZEN = 11, 201 GLF_FROZEN = 11,
202 GLF_QUEUED = 12, 202 GLF_QUEUED = 12,
203 GLF_LRU = 13,
204 GLF_OBJECT = 14, /* Used only for tracing */
203}; 205};
204 206
205struct gfs2_glock { 207struct gfs2_glock {
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 675349b5a133..747238cd9f96 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -31,6 +31,7 @@
31#include "rgrp.h" 31#include "rgrp.h"
32#include "trans.h" 32#include "trans.h"
33#include "util.h" 33#include "util.h"
34#include "trace_gfs2.h"
34 35
35static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc) 36static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
36{ 37{
@@ -310,6 +311,7 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int
310 struct gfs2_bufdata *bd = bh->b_private; 311 struct gfs2_bufdata *bd = bh->b_private;
311 312
312 if (test_clear_buffer_pinned(bh)) { 313 if (test_clear_buffer_pinned(bh)) {
314 trace_gfs2_pin(bd, 0);
313 atomic_dec(&sdp->sd_log_pinned); 315 atomic_dec(&sdp->sd_log_pinned);
314 list_del_init(&bd->bd_le.le_list); 316 list_del_init(&bd->bd_le.le_list);
315 if (meta) { 317 if (meta) {
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index cedb0bb96d96..9133d0aaac26 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -40,7 +40,9 @@
40 {(1UL << GLF_REPLY_PENDING), "r" }, \ 40 {(1UL << GLF_REPLY_PENDING), "r" }, \
41 {(1UL << GLF_INITIAL), "I" }, \ 41 {(1UL << GLF_INITIAL), "I" }, \
42 {(1UL << GLF_FROZEN), "F" }, \ 42 {(1UL << GLF_FROZEN), "F" }, \
43 {(1UL << GLF_QUEUED), "q" }) 43 {(1UL << GLF_QUEUED), "q" }, \
44 {(1UL << GLF_LRU), "L" }, \
45 {(1UL << GLF_OBJECT), "o" })
44 46
45#ifndef NUMPTY 47#ifndef NUMPTY
46#define NUMPTY 48#define NUMPTY
@@ -94,7 +96,7 @@ TRACE_EVENT(gfs2_glock_state_change,
94 __entry->new_state = glock_trace_state(new_state); 96 __entry->new_state = glock_trace_state(new_state);
95 __entry->tgt_state = glock_trace_state(gl->gl_target); 97 __entry->tgt_state = glock_trace_state(gl->gl_target);
96 __entry->dmt_state = glock_trace_state(gl->gl_demote_state); 98 __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
97 __entry->flags = gl->gl_flags; 99 __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
98 ), 100 ),
99 101
100 TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s", 102 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 __entry->gltype = gl->gl_name.ln_type; 129 __entry->gltype = gl->gl_name.ln_type;
128 __entry->glnum = gl->gl_name.ln_number; 130 __entry->glnum = gl->gl_name.ln_number;
129 __entry->cur_state = glock_trace_state(gl->gl_state); 131 __entry->cur_state = glock_trace_state(gl->gl_state);
130 __entry->flags = gl->gl_flags; 132 __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
131 ), 133 ),
132 134
133 TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s", 135 TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s",
@@ -161,7 +163,7 @@ TRACE_EVENT(gfs2_demote_rq,
161 __entry->glnum = gl->gl_name.ln_number; 163 __entry->glnum = gl->gl_name.ln_number;
162 __entry->cur_state = glock_trace_state(gl->gl_state); 164 __entry->cur_state = glock_trace_state(gl->gl_state);
163 __entry->dmt_state = glock_trace_state(gl->gl_demote_state); 165 __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
164 __entry->flags = gl->gl_flags; 166 __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
165 ), 167 ),
166 168
167 TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s", 169 TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s",