linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: Fix unused variable warning.
@ 2011-10-28 10:36 Rakib Mullick
  2011-10-31 15:18 ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Rakib Mullick @ 2011-10-28 10:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-nfs, Trond Myklebust, akpm

 When CONFIG_NFS=y, but CONFIG_NFS_V3_{,V4}=n we get the following warning:

	fs/nfs/write.c: In function ‘nfs_writeback_done’:
	fs/nfs/write.c:1246:21: warning: unused variable ‘server’

 This patch fixes it.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2219c88..e528e5c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1243,7 +1243,6 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
 {
 	struct nfs_writeargs	*argp = &data->args;
 	struct nfs_writeres	*resp = &data->res;
-	struct nfs_server	*server = NFS_SERVER(data->inode);
 	int status;
 
 	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
@@ -1272,6 +1271,8 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
 		 *	 as a dprintk() in order to avoid filling syslog.
 		 */
 		static unsigned long    complain;
+		struct nfs_server	*server;
+		server = NFS_SERVER(data->inode);
 
 		/* Note this will print the MDS for a DS write */
 		if (time_before(complain, jiffies)) {



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs: Fix unused variable warning.
  2011-10-28 10:36 [PATCH] nfs: Fix unused variable warning Rakib Mullick
@ 2011-10-31 15:18 ` Trond Myklebust
  2011-10-31 17:12   ` Rakib Mullick
  0 siblings, 1 reply; 6+ messages in thread
From: Trond Myklebust @ 2011-10-31 15:18 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: linux-kernel, linux-nfs, akpm

On Fri, 2011-10-28 at 16:36 +0600, Rakib Mullick wrote: 
> When CONFIG_NFS=y, but CONFIG_NFS_V3_{,V4}=n we get the following warning:
> 
> 	fs/nfs/write.c: In function ‘nfs_writeback_done’:
> 	fs/nfs/write.c:1246:21: warning: unused variable ‘server’
> 
>  This patch fixes it.
> 
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> ---
> 
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index 2219c88..e528e5c 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -1243,7 +1243,6 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
>  {
>  	struct nfs_writeargs	*argp = &data->args;
>  	struct nfs_writeres	*resp = &data->res;
> -	struct nfs_server	*server = NFS_SERVER(data->inode);
>  	int status;
>  
>  	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
> @@ -1272,6 +1271,8 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
>  		 *	 as a dprintk() in order to avoid filling syslog.
>  		 */
>  		static unsigned long    complain;
> +		struct nfs_server	*server;
> +		server = NFS_SERVER(data->inode);
>  
>  		/* Note this will print the MDS for a DS write */
>  		if (time_before(complain, jiffies)) {

This will still cause a warning if you compile without RPC_DEBUG (e.g.
if CONFIG_SYSCTL isn't defined).

Since there is only one user, it seems better to just open-code the
NFS_SERVER(data->inode) in the dprintk()...

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs: Fix unused variable warning.
  2011-10-31 15:18 ` Trond Myklebust
@ 2011-10-31 17:12   ` Rakib Mullick
  2011-10-31 17:43     ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Rakib Mullick @ 2011-10-31 17:12 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel, linux-nfs, akpm

[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]

On Mon, Oct 31, 2011 at 9:18 PM, Trond Myklebust
<Trond.Myklebust@netapp.com> wrote:
> On Fri, 2011-10-28 at 16:36 +0600, Rakib Mullick wrote:
>
> This will still cause a warning if you compile without RPC_DEBUG (e.g.
> if CONFIG_SYSCTL isn't defined).
>
I didn't get any warning with CONFIG_SYSCTL=n.

> Since there is only one user, it seems better to just open-code the
> NFS_SERVER(data->inode) in the dprintk()...

Okay, it seems reasonable. We can simply remove 'server'. Please
consider the following patch (also attached, might have some white
space issue).

---

 When CONFIG_NFS=y and CONFIG_NFS_V3_{,V4}=n we get the following warning.
	
	fs/nfs/write.c: In function ‘nfs_writeback_done’:
	fs/nfs/write.c:1246:21: warning: unused variable ‘server’

 Remove the variable 'server' to fix the above warning.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2219c88..a2e4b27 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1243,7 +1243,6 @@ void nfs_writeback_done(struct rpc_task *task,
struct nfs_write_data *data)
 {
 	struct nfs_writeargs	*argp = &data->args;
 	struct nfs_writeres	*resp = &data->res;
-	struct nfs_server	*server = NFS_SERVER(data->inode);
 	int status;

 	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
@@ -1277,7 +1276,7 @@ void nfs_writeback_done(struct rpc_task *task,
struct nfs_write_data *data)
 		if (time_before(complain, jiffies)) {
 			dprintk("NFS:       faulty NFS server %s:"
 				" (committed = %d) != (stable = %d)\n",
-				server->nfs_client->cl_hostname,
+				data->inode->nfs_client->cl_hostname,
 				resp->verf->committed, argp->stable);
 			complain = jiffies + 300 * HZ;
 		}

[-- Attachment #2: nfs_unused_var_fix.patch --]
[-- Type: application/octet-stream, Size: 1139 bytes --]

 When CONFIG_NFS=y and CONFIG_NFS_V3_{,V4}=n we get the following warning.
	
	fs/nfs/write.c: In function ‘nfs_writeback_done’:
	fs/nfs/write.c:1246:21: warning: unused variable ‘server’

 Remove the variable 'server' to fix the above warning.


Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2219c88..a2e4b27 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1243,7 +1243,6 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
 {
 	struct nfs_writeargs	*argp = &data->args;
 	struct nfs_writeres	*resp = &data->res;
-	struct nfs_server	*server = NFS_SERVER(data->inode);
 	int status;
 
 	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
@@ -1277,7 +1276,7 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
 		if (time_before(complain, jiffies)) {
 			dprintk("NFS:       faulty NFS server %s:"
 				" (committed = %d) != (stable = %d)\n",
-				server->nfs_client->cl_hostname,
+				data->inode->nfs_client->cl_hostname,
 				resp->verf->committed, argp->stable);
 			complain = jiffies + 300 * HZ;
 		}

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs: Fix unused variable warning.
  2011-10-31 17:12   ` Rakib Mullick
@ 2011-10-31 17:43     ` Trond Myklebust
  2011-10-31 18:16       ` Rakib Mullick
  0 siblings, 1 reply; 6+ messages in thread
From: Trond Myklebust @ 2011-10-31 17:43 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: linux-kernel, linux-nfs, akpm

On Mon, 2011-10-31 at 23:12 +0600, Rakib Mullick wrote: 
> On Mon, Oct 31, 2011 at 9:18 PM, Trond Myklebust
> <Trond.Myklebust@netapp.com> wrote:
> > On Fri, 2011-10-28 at 16:36 +0600, Rakib Mullick wrote:
> >
> > This will still cause a warning if you compile without RPC_DEBUG (e.g.
> > if CONFIG_SYSCTL isn't defined).
> >
> I didn't get any warning with CONFIG_SYSCTL=n.
> 
> > Since there is only one user, it seems better to just open-code the
> > NFS_SERVER(data->inode) in the dprintk()...
> 
> Okay, it seems reasonable. We can simply remove 'server'. Please
> consider the following patch (also attached, might have some white
> space issue).
> 
> ---
> 
>  When CONFIG_NFS=y and CONFIG_NFS_V3_{,V4}=n we get the following warning.
> 	
> 	fs/nfs/write.c: In function ‘nfs_writeback_done’:
> 	fs/nfs/write.c:1246:21: warning: unused variable ‘server’
> 
>  Remove the variable 'server' to fix the above warning.
> 
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> ---
> 
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index 2219c88..a2e4b27 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -1243,7 +1243,6 @@ void nfs_writeback_done(struct rpc_task *task,
> struct nfs_write_data *data)
>  {
>  	struct nfs_writeargs	*argp = &data->args;
>  	struct nfs_writeres	*resp = &data->res;
> -	struct nfs_server	*server = NFS_SERVER(data->inode);
>  	int status;
> 
>  	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
> @@ -1277,7 +1276,7 @@ void nfs_writeback_done(struct rpc_task *task,
> struct nfs_write_data *data)
>  		if (time_before(complain, jiffies)) {
>  			dprintk("NFS:       faulty NFS server %s:"
>  				" (committed = %d) != (stable = %d)\n",
> -				server->nfs_client->cl_hostname,
> +				data->inode->nfs_client->cl_hostname,
				 ^^^^^^^^^^^^
NFS_SERVER(data->inode)->nfs_client....

> 				resp->verf->committed, argp->stable);
>  			complain = jiffies + 300 * HZ;
>  		}

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs: Fix unused variable warning.
  2011-10-31 17:43     ` Trond Myklebust
@ 2011-10-31 18:16       ` Rakib Mullick
  2011-10-31 18:28         ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Rakib Mullick @ 2011-10-31 18:16 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel, linux-nfs, akpm

On Mon, Oct 31, 2011 at 11:43 PM, Trond Myklebust
<Trond.Myklebust@netapp.com> wrote:
> On Mon, 2011-10-31 at 23:12 +0600, Rakib Mullick wrote:
>> On Mon, Oct 31, 2011 at 9:18 PM, Trond Myklebust
>> <Trond.Myklebust@netapp.com> wrote:
>> > On Fri, 2011-10-28 at 16:36 +0600, Rakib Mullick wrote:
>> +                             data->inode->nfs_client->cl_hostname,
>                                 ^^^^^^^^^^^^
> NFS_SERVER(data->inode)->nfs_client....

Opss. Sorry, should've more careful, rather doing it quickly :(.
data->inode has nothing inside named nfs_client, but didn't even
complain. I'll resend it.

Anyway, I found the two following warning in nfs/file.c

fs/nfs/file.c: In function ‘nfs_file_release’:
fs/nfs/file.c:140:17: warning: unused variable ‘dentry’
fs/nfs/file.c: In function ‘nfs_file_read’:
fs/nfs/file.c:237:9: warning: unused variable ‘count’

I'm wanting to send one patch to cleanup all these unused variable
issues. Shall I? Or, should I send separate patches?

Thanks,
Rakib

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs: Fix unused variable warning.
  2011-10-31 18:16       ` Rakib Mullick
@ 2011-10-31 18:28         ` Trond Myklebust
  0 siblings, 0 replies; 6+ messages in thread
From: Trond Myklebust @ 2011-10-31 18:28 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: linux-kernel, linux-nfs, akpm

On Tue, 2011-11-01 at 00:16 +0600, Rakib Mullick wrote: 
> On Mon, Oct 31, 2011 at 11:43 PM, Trond Myklebust
> <Trond.Myklebust@netapp.com> wrote:
> > On Mon, 2011-10-31 at 23:12 +0600, Rakib Mullick wrote:
> >> On Mon, Oct 31, 2011 at 9:18 PM, Trond Myklebust
> >> <Trond.Myklebust@netapp.com> wrote:
> >> > On Fri, 2011-10-28 at 16:36 +0600, Rakib Mullick wrote:
> >> +                             data->inode->nfs_client->cl_hostname,
> >                                 ^^^^^^^^^^^^
> > NFS_SERVER(data->inode)->nfs_client....
> 
> Opss. Sorry, should've more careful, rather doing it quickly :(.
> data->inode has nothing inside named nfs_client, but didn't even
> complain. I'll resend it.
> 
> Anyway, I found the two following warning in nfs/file.c
> 
> fs/nfs/file.c: In function ‘nfs_file_release’:
> fs/nfs/file.c:140:17: warning: unused variable ‘dentry’
> fs/nfs/file.c: In function ‘nfs_file_read’:
> fs/nfs/file.c:237:9: warning: unused variable ‘count’
> 
> I'm wanting to send one patch to cleanup all these unused variable
> issues. Shall I? Or, should I send separate patches?

Please send 2 patches: the stuff in fs/nfs/file.c looks as if it
predates the linux-3.1 release, and so we might want to keep those fixes
in a separate patch.

Cheers
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-31 18:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 10:36 [PATCH] nfs: Fix unused variable warning Rakib Mullick
2011-10-31 15:18 ` Trond Myklebust
2011-10-31 17:12   ` Rakib Mullick
2011-10-31 17:43     ` Trond Myklebust
2011-10-31 18:16       ` Rakib Mullick
2011-10-31 18:28         ` Trond Myklebust

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).