Re: [PATCH 3/3] NFSv4: parse and display server implementation ids

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-03-06 at 17:08 +0000, Adamson, Dros wrote:
> On Mar 4, 2012, at 6:33 PM, Myklebust, Trond wrote:
> 
> > On Sat, 2012-03-03 at 09:09 -0500, Bryan Schumaker wrote:
> >> Hi Dros,
> >> 
> >> On 02/17/2012 03:20 PM, Weston Andros Adamson wrote:
> >> 
> >>> Shows the implementation ids in /proc/self/mountstats.  This doesn't break
> >>> the nfs-utils mountstats tool.
> >>> 
> >>> Signed-off-by: Weston Andros Adamson <dros@xxxxxxxxxx>
> >>> ---
> >>> fs/nfs/client.c           |    1 +
> >>> fs/nfs/nfs4proc.c         |   21 +++++++++++++++++++++
> >>> fs/nfs/nfs4xdr.c          |   42 +++++++++++++++++++++++++++++++++++++-----
> >>> fs/nfs/super.c            |    8 ++++++++
> >>> include/linux/nfs_fs_sb.h |    2 ++
> >>> include/linux/nfs_xdr.h   |   15 +++++++--------
> >>> 6 files changed, 76 insertions(+), 13 deletions(-)
> >>> 
> >> 
> >> <snip>
> >> 
> >>> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> >>> index d05024a..5462225 100644
> >>> --- a/fs/nfs/super.c
> >>> +++ b/fs/nfs/super.c
> >>> @@ -809,6 +809,14 @@ static int nfs_show_stats(struct seq_file *m, struct dentry *root)
> >>> 
> >>> 	seq_printf(m, "\n\tage:\t%lu", (jiffies - nfss->mount_time) / HZ);
> >>> 
> >>> +	if (nfss->nfs_client && nfss->nfs_client->impl_id) {
> >>> +		struct nfs41_impl_id *impl_id = nfss->nfs_client->impl_id;
> >> 
> >> 
> >> "struct nfs41_impl_id" is only defined when CONFIG_NFS_V4_1 is enabled, so if I compile without NFS 4.1 enabled I get this error:
> >> 
> >>  CC [M]  fs/nfs/super.o
> >> /home/bjschuma/linux/modules/fs/nfs/super.c: In function 'nfs_show_stats':
> >> /home/bjschuma/linux/modules/fs/nfs/super.c:843:14: error: dereferencing pointer to incomplete type
> >> /home/bjschuma/linux/modules/fs/nfs/super.c:843:29: error: dereferencing pointer to incomplete type
> >> /home/bjschuma/linux/modules/fs/nfs/super.c:844:14: error: dereferencing pointer to incomplete type
> >> /home/bjschuma/linux/modules/fs/nfs/super.c:844:37: error: dereferencing pointer to incomplete type
> >> make[3]: *** [fs/nfs/super.o] Error 1
> 
> Oops!  Good catch Bryan!
> 
> > 
> > Hi Bryan & Dros
> > 
> > I've applied the following patch to fix this issue. Please advise if
> > you're still seeing compile problems when it is applied.
> > 
> Works for me.  I need to test with different CONFIG opts more often!

Actually, the above patch was failing if !CONFIG_NFS_V4, so it has been
amended a just little more to do the right thing.
8<-----------------------------------------------------------------
>From 7e03b7cc0736eefe7471782c344112ad6eba951e Mon Sep 17 00:00:00 2001
From: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
Date: Sun, 4 Mar 2012 18:12:57 -0500
Subject: [PATCH v2] NFS: Fix a compile issue when !CONFIG_NFS_V4_1

The attempt to display the implementation ID needs to be conditional on
whether or not CONFIG_NFS_V4_1 is defined

Reported-by: Bryan Schumaker <Bryan.Schumaker@xxxxxxxxxx>
Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
---
 fs/nfs/super.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 3935a37..aac4030 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -775,7 +775,6 @@ static void show_sessions(struct seq_file *m, struct nfs_server *server) {}
 #endif
 #endif
 
-#ifdef CONFIG_NFS_V4
 #ifdef CONFIG_NFS_V4_1
 static void show_pnfs(struct seq_file *m, struct nfs_server *server)
 {
@@ -785,9 +784,26 @@ static void show_pnfs(struct seq_file *m, struct nfs_server *server)
 	else
 		seq_printf(m, "not configured");
 }
+
+static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
+{
+	if (nfss->nfs_client && nfss->nfs_client->impl_id) {
+		struct nfs41_impl_id *impl_id = nfss->nfs_client->impl_id;
+		seq_printf(m, "\n\timpl_id:\tname='%s',domain='%s',"
+			   "date='%llu,%u'",
+			   impl_id->name, impl_id->domain,
+			   impl_id->date.seconds, impl_id->date.nseconds);
+	}
+}
 #else
-static void show_pnfs(struct seq_file *m, struct nfs_server *server) {}
+#ifdef CONFIG_NFS_V4
+static void show_pnfs(struct seq_file *m, struct nfs_server *server)
+{
+}
 #endif
+static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
+{
+}
 #endif
 
 static int nfs_show_devname(struct seq_file *m, struct dentry *root)
@@ -836,13 +852,7 @@ static int nfs_show_stats(struct seq_file *m, struct dentry *root)
 
 	seq_printf(m, "\n\tage:\t%lu", (jiffies - nfss->mount_time) / HZ);
 
-	if (nfss->nfs_client && nfss->nfs_client->impl_id) {
-		struct nfs41_impl_id *impl_id = nfss->nfs_client->impl_id;
-		seq_printf(m, "\n\timpl_id:\tname='%s',domain='%s',"
-			   "date='%llu,%u'",
-			   impl_id->name, impl_id->domain,
-			   impl_id->date.seconds, impl_id->date.nseconds);
-	}
+	show_implementation_id(m, nfss);
 
 	seq_printf(m, "\n\tcaps:\t");
 	seq_printf(m, "caps=0x%x", nfss->caps);
-- 
1.7.7.6


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux