aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2018-04-18 15:05:01 -0400
committerAndreas Gruenbacher <agruenba@redhat.com>2018-12-12 06:33:23 -0500
commit27a2660f1ef944724956d92e8a312b6da0936fae (patch)
tree6882e4665a18c8ca750ac64c36e6eddc2393d251 /fs/gfs2
parent2d29f6b96d8f80322ed2dd895bca590491c38d34 (diff)
gfs2: Dump nrpages for inodes and their glocks
This patch is based on an idea from Steve Whitehouse. The idea is to dump the number of pages for inodes in the glock dumps. The additional locking required me to drop const from quite a few places. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c2
-rw-r--r--fs/gfs2/glock.h2
-rw-r--r--fs/gfs2/glops.c16
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/rgrp.c2
-rw-r--r--fs/gfs2/rgrp.h2
6 files changed, 17 insertions, 9 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 05431324b262..b92740edc416 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1777,7 +1777,7 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
1777 * 1777 *
1778 */ 1778 */
1779 1779
1780void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl) 1780void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl)
1781{ 1781{
1782 const struct gfs2_glock_operations *glops = gl->gl_ops; 1782 const struct gfs2_glock_operations *glops = gl->gl_ops;
1783 unsigned long long dtime; 1783 unsigned long long dtime;
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 5e12220cc0c2..8949bf28b249 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -202,7 +202,7 @@ extern int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number,
202 struct gfs2_holder *gh); 202 struct gfs2_holder *gh);
203extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs); 203extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
204extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs); 204extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
205extern void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl); 205extern void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl);
206#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0) 206#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0)
207extern __printf(2, 3) 207extern __printf(2, 3)
208void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...); 208void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...);
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index f79ef9525e33..f15b4c57c4bd 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -467,17 +467,25 @@ static int inode_go_lock(struct gfs2_holder *gh)
467 * 467 *
468 */ 468 */
469 469
470static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) 470static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl)
471{ 471{
472 const struct gfs2_inode *ip = gl->gl_object; 472 struct gfs2_inode *ip = gl->gl_object;
473 struct inode *inode = &ip->i_inode;
474 unsigned long nrpages;
475
473 if (ip == NULL) 476 if (ip == NULL)
474 return; 477 return;
475 gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu\n", 478
479 xa_lock_irq(&inode->i_data.i_pages);
480 nrpages = inode->i_data.nrpages;
481 xa_unlock_irq(&inode->i_data.i_pages);
482
483 gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu p:%lu\n",
476 (unsigned long long)ip->i_no_formal_ino, 484 (unsigned long long)ip->i_no_formal_ino,
477 (unsigned long long)ip->i_no_addr, 485 (unsigned long long)ip->i_no_addr,
478 IF2DT(ip->i_inode.i_mode), ip->i_flags, 486 IF2DT(ip->i_inode.i_mode), ip->i_flags,
479 (unsigned int)ip->i_diskflags, 487 (unsigned int)ip->i_diskflags,
480 (unsigned long long)i_size_read(&ip->i_inode)); 488 (unsigned long long)i_size_read(inode), nrpages);
481} 489}
482 490
483/** 491/**
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 663759abe60d..e10e0b0a7cd5 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -243,7 +243,7 @@ struct gfs2_glock_operations {
243 int (*go_demote_ok) (const struct gfs2_glock *gl); 243 int (*go_demote_ok) (const struct gfs2_glock *gl);
244 int (*go_lock) (struct gfs2_holder *gh); 244 int (*go_lock) (struct gfs2_holder *gh);
245 void (*go_unlock) (struct gfs2_holder *gh); 245 void (*go_unlock) (struct gfs2_holder *gh);
246 void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl); 246 void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl);
247 void (*go_callback)(struct gfs2_glock *gl, bool remote); 247 void (*go_callback)(struct gfs2_glock *gl, bool remote);
248 const int go_type; 248 const int go_type;
249 const unsigned long go_flags; 249 const unsigned long go_flags;
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 8d7916570362..831d7cb5a49c 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2256,7 +2256,7 @@ static void rgblk_free(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd,
2256 * 2256 *
2257 */ 2257 */
2258 2258
2259void gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl) 2259void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl)
2260{ 2260{
2261 struct gfs2_rgrpd *rgd = gl->gl_object; 2261 struct gfs2_rgrpd *rgd = gl->gl_object;
2262 struct gfs2_blkreserv *trs; 2262 struct gfs2_blkreserv *trs;
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h
index b596c3d17988..499079a9dbbe 100644
--- a/fs/gfs2/rgrp.h
+++ b/fs/gfs2/rgrp.h
@@ -72,7 +72,7 @@ extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
72extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist); 72extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist);
73extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); 73extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
74extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); 74extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
75extern void gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl); 75extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_glock *gl);
76extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, 76extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
77 struct buffer_head *bh, 77 struct buffer_head *bh,
78 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed); 78 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed);