diff mbox

NFS: Don't use debug-printk-only local variables

Message ID 1380175008-13090-1-git-send-email-olof@lixom.net (mailing list archive)
State New, archived
Headers show

Commit Message

Olof Johansson Sept. 26, 2013, 5:56 a.m. UTC
Due to commit 996a2493ed5d3a8d5db03b560fcbbf1ca3f10897 (NFS:
Use i_writecount to control whether to get an fscache cookie in
nfs_open(), in two instances a local variable is only used in debug
print statements. Said statements might be compiled out, which results
in unused variable warnings:

fs/nfs/fscache.c: In function 'nfs_fscache_release_page':
fs/nfs/fscache.c:263:21: warning: unused variable 'nfsi' [-Wunused-variable]

fs/nfs/fscache.c: In function '__nfs_fscache_invalidate_page':
fs/nfs/fscache.c:286:20: warning: unused variable 'nfsi' [-Wunused-variable]

Just skip the local variable in these cases.

Signed-off-by: Olof Johansson <olof@lixom.net>
---

David,

This showed up in today's linux-next, seems to have come in through the fscache tree.

Either amend and roll in the fix (after review -- I'm guessing this is the right thing to do), or apply on top please. :)


Thanks!


-Olof

 fs/nfs/fscache.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

David Howells Sept. 26, 2013, 11:24 a.m. UTC | #1
Olof Johansson <olof@lixom.net> wrote:

> Due to commit 996a2493ed5d3a8d5db03b560fcbbf1ca3f10897 (NFS:
> Use i_writecount to control whether to get an fscache cookie in
> nfs_open(), in two instances a local variable is only used in debug
> print statements. Said statements might be compiled out, which results
> in unused variable warnings:

Yeah, Fengguang's magic compile farm has also complained about that.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Howells Sept. 26, 2013, 12:39 p.m. UTC | #2
Olof Johansson <olof@lixom.net> wrote:

> -		struct nfs_inode *nfsi = NFS_I(page->mapping->host);
>  		struct fscache_cookie *cookie = nfs_i_fscache(page->mapping->host);
>  
>  		BUG_ON(!cookie);
>  		dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n",
> -			 cookie, page, nfsi);
> +			 cookie, page, NFS_I(page->mapping->host));

This is really the wrong fix.  The null dfprintk() should use no_printk().

David
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index a01af20..3ef01f0 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -260,12 +260,11 @@  EXPORT_SYMBOL_GPL(nfs_fscache_open_file);
 int nfs_fscache_release_page(struct page *page, gfp_t gfp)
 {
 	if (PageFsCache(page)) {
-		struct nfs_inode *nfsi = NFS_I(page->mapping->host);
 		struct fscache_cookie *cookie = nfs_i_fscache(page->mapping->host);
 
 		BUG_ON(!cookie);
 		dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n",
-			 cookie, page, nfsi);
+			 cookie, page, NFS_I(page->mapping->host));
 
 		if (!fscache_maybe_release_page(cookie, page, gfp))
 			return 0;
@@ -283,13 +282,12 @@  int nfs_fscache_release_page(struct page *page, gfp_t gfp)
  */
 void __nfs_fscache_invalidate_page(struct page *page, struct inode *inode)
 {
-	struct nfs_inode *nfsi = NFS_I(inode);
 	struct fscache_cookie *cookie = nfs_i_fscache(inode);
 
 	BUG_ON(!cookie);
 
 	dfprintk(FSCACHE, "NFS: fscache invalidatepage (0x%p/0x%p/0x%p)\n",
-		 cookie, page, nfsi);
+		 cookie, page, NFS_I(inode));
 
 	fscache_wait_on_page_write(cookie, page);