cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [gfs2 patch] gfs2: Dump nrpages for inodes and their glocks
Date: Tue, 27 Nov 2018 14:26:22 -0500 (EST)	[thread overview]
Message-ID: <2016203513.36585705.1543346782765.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1859993006.36585610.1543346736694.JavaMail.zimbra@redhat.com>

Hi,

This patch is based on an idea from Steve Whitehouse. The idea is
to dump the number of pages (both inode and its glock's address
space) in the glock dumps. To avoid adding any new locks, I
switch from calling i_size_read to using its constituant pieces,
namely, calling preempt_disable before gathering the values of
i_size and the new nrpages values, then I preempt_enable.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 fs/gfs2/glops.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index f79ef9525e33..f60411707e88 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -470,14 +470,28 @@ static int inode_go_lock(struct gfs2_holder *gh)
 static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
 {
 	const struct gfs2_inode *ip = gl->gl_object;
+	const struct inode *inode;
+	const struct address_space *mapping = (const struct address_space *)
+		(gl + 1); /* Can't use gfs2_glock2aspace due to const */
+	unsigned long nrpages1, nrpages2;
+	loff_t i_size;
+
 	if (ip == NULL)
 		return;
-	gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu\n",
+
+	inode = &ip->i_inode;
+	preempt_disable();
+	i_size = inode->i_size;
+	nrpages1 = inode->i_data.nrpages;
+	nrpages2 = mapping->nrpages;
+	preempt_enable();
+
+	gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu p:%lu/%lu\n",
 		  (unsigned long long)ip->i_no_formal_ino,
 		  (unsigned long long)ip->i_no_addr,
 		  IF2DT(ip->i_inode.i_mode), ip->i_flags,
 		  (unsigned int)ip->i_diskflags,
-		  (unsigned long long)i_size_read(&ip->i_inode));
+		  (unsigned long long)i_size, nrpages1, nrpages2);
 }
 
 /**



       reply	other threads:[~2018-11-27 19:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1859993006.36585610.1543346736694.JavaMail.zimbra@redhat.com>
2018-11-27 19:26 ` Bob Peterson [this message]
2018-11-29 19:36   ` [Cluster-devel] [gfs2 patch] gfs2: Dump nrpages for inodes and their glocks Andreas Gruenbacher
2018-12-07 19:51     ` [Cluster-devel] [gfs2 patch v2] " Bob Peterson
2018-12-10 21:51       ` Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2016203513.36585705.1543346782765.JavaMail.zimbra@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).