diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2011-04-14 09:09:52 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-04-20 04:00:59 -0400 |
commit | 627c10b7e471b5dcfb7101d6cc74d219619c9bc4 (patch) | |
tree | 28b485c2ce46035da616c1a20f4ac92bae96427a /fs/gfs2/glock.c | |
parent | dba898b02defa66e5fe493d58ec0293a940f9c93 (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/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 13 |
1 files changed, 11 insertions, 2 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 | ||
1601 | static const char *gflags2str(char *buf, const unsigned long *gflags) | 1604 | static 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), |