nfs client: kill compile warning on NOMMU machine
Subsystems (2)
PATCH 1/1 nfs client: kill compile warning on NOMMU machine
On nommu machine such as Blackfin, when compling NFS we got an warning about nfs_file_mmap() function defined but not used.
This patch kills this warning.
--- fs/nfs/file.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
fs/nfs/file.c +12 -4
@@ -64,11 +64,7 @@ const struct file_operations nfs_file_operations = { .write = do_sync_write, .aio_read = nfs_file_read, .aio_write = nfs_file_write, -#ifdef CONFIG_MMU .mmap = nfs_file_mmap, -#else - .mmap = generic_file_mmap, -#endif .open = nfs_file_open, .flush = nfs_file_flush, .release = nfs_file_release,
@@ -294,6 +290,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,return res; } +#ifdef CONFIG_MMU static int nfs_file_mmap (struct file * file,struct vm_area_struct * vma) {
@@ -312,6 +309,17 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma) }return status; } +#else +static int +nfs_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +/* Kill warning: 'nfs_file_vm_ops' defined but not used */ +struct vm_operations_struct *vm_ops; + vm_ops = &nfs_file_vm_ops; + +return generic_file_mmap (file, vma); +} +#endif /* * Flush any dirty pages for this process, and check for write errors.
Signature · 1 line
1.5.6.3
Hi guys,
Is it possible to merge this patch?
Thanks
-Bryan
Quoted 55 lines · Bryan Wu
On nommu machine such as Blackfin, when compling NFS we got an warning about
nfs_file_mmap()function defined but not used.This patch kills this warning.
Signed-off-by Bryan Wu <[email protected]>--- fs/nfs/file.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)fs/nfs/file.c +12
-5@@ -64,11 +64,7 @@ const struct file_operations nfs_file_operations = { .write = do_sync_write, .aio_read = nfs_file_read, .aio_write = nfs_file_write, -#ifdef CONFIG_MMU .mmap = nfs_file_mmap, -#else - .mmap = generic_file_mmap, -#endif .open = nfs_file_open, .flush = nfs_file_flush, .release = nfs_file_release,@@ -294,6 +290,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,return res; } +#ifdef CONFIG_MMU static int nfs_file_mmap (struct file * file,struct vm_area_struct * vma) {@@ -312,6 +309,17 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma) }return status; } +#else +static int +nfs_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +/* Kill warning: 'nfs_file_vm_ops' defined but not used */ +struct vm_operations_struct *vm_ops; + vm_ops = &nfs_file_vm_ops; + +return generic_file_mmap (file, vma); +} +#endif /* * Flush any dirty pages for this process, and check for write errors. -- 1.5.6.3
Quoted 3 lines · Bryan Wu
Hi guys,
Is it possible to merge this patch?
NACK. Although it would be nice to get rid of the warning, this patch does so at the price of even further obfuscating the fact that we're just returning -ENOSYS in the no MMU case, and by causing nfs_file_vm_ops (which is currently optimised away) to be compiled in for no good reason at all.
Trond
Quoted 59 lines
Thanks
-BryanQuoted 55 lines · Bryan Wu
On nommu machine such as Blackfin, when compling NFS we got an warning about
nfs_file_mmap()function defined but not used.This patch kills this warning.
Signed-off-by Bryan Wu <[email protected]>--- fs/nfs/file.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)fs/nfs/file.c +12
-5@@ -64,11 +64,7 @@ const struct file_operations nfs_file_operations = { .write = do_sync_write, .aio_read = nfs_file_read, .aio_write = nfs_file_write, -#ifdef CONFIG_MMU .mmap = nfs_file_mmap, -#else - .mmap = generic_file_mmap, -#endif .open = nfs_file_open, .flush = nfs_file_flush, .release = nfs_file_release,@@ -294,6 +290,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,return res; } +#ifdef CONFIG_MMU static int nfs_file_mmap (struct file * file,struct vm_area_struct * vma) {@@ -312,6 +309,17 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma) }return status; } +#else +static int +nfs_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +/* Kill warning: 'nfs_file_vm_ops' defined but not used */ +struct vm_operations_struct *vm_ops; + vm_ops = &nfs_file_vm_ops; + +return generic_file_mmap (file, vma); +} +#endif /* * Flush any dirty pages for this process, and check for write errors. -- 1.5.6.3
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Quoted 5 lines · Trond Myklebust
Quoted 3 lines · Bryan Wu
Hi guys,
Is it possible to merge this patch?
Quoted 7 lines
NACK. Although it would be nice to get rid of the warning, this patch does so at the price of even further obfuscating the fact that we're just returning
-ENOSYSin the no MMU case, and by causingnfs_file_vm_ops(which is currently optimised away) to be compiled in for no good reason at all.Trond
How about the following compromise: we get rid of the special casing altogether and just always call generic_file_mmap. If the noMMU folks want further optimisations, then they can inline generic_file_mmap(), so that the compiler always takes the 'generic_file_mmap() failed' path.
Cheers
Trond
------------------------------------------------------------
From: Trond Myklebust <[email protected]>
Date: Thu, 5 Feb 2009 10:23:36 -0500
NFS: Kill the "defined but not used" compile error on nommu machines
Bryan Wu reports that when compiling NFS on nommu machines he gets a "defined but not used" error on nfs_file_mmap().
The easiest fix is simply to get rid of the special casing in NFS, and just always call generic_file_mmap() to set up the file.
---
fs/nfs/file.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
fs/nfs/file.c +5 -7
@@ -64,11 +64,7 @@ const struct file_operations nfs_file_operations = { .write = do_sync_write, .aio_read = nfs_file_read, .aio_write = nfs_file_write, -#ifdef CONFIG_MMU .mmap = nfs_file_mmap, -#else - .mmap = generic_file_mmap, -#endif .open = nfs_file_open, .flush = nfs_file_flush, .release = nfs_file_release,
@@ -304,11 +300,13 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma)dprintk ("NFS: mmap(%s/%s)\n" , dentry->d_parent->d_name.name, dentry->d_name.name); - status =nfs_revalidate_mapping (inode, file->f_mapping); +/* Note: generic_file_mmap() returns ENOSYS on nommu systems +* so we call that before revalidating the mapping +*/ + status =generic_file_mmap (file, vma);if (!status) { vma->vm_ops = &nfs_file_vm_ops; - vma->vm_flags |=VM_CAN_NONLINEAR ; -file_accessed (file); + status =nfs_revalidate_mapping (inode, file->f_mapping); }return status; }
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Quoted 12 lines · Trond Myklebust
Quoted 11 lines · Trond Myklebust
Quoted 3 lines · Bryan Wu
Hi guys,
Is it possible to merge this patch?
NACK. Although it would be nice to get rid of the warning, this patch does so at the price of even further obfuscating the fact that we're just returning
-ENOSYSin the no MMU case, and by causingnfs_file_vm_ops(which is currently optimised away) to be compiled in for no good reason at all.
Quoted 7 lines
Quoted 1 line
Trond
How about the following compromise: we get rid of the special casing altogether and just always call
generic_file_mmap. If the noMMU folks want further optimisations, then they can inlinegeneric_file_mmap(), so that the compiler always takes the 'generic_file_mmap()failed' path.
Beautiful, I do love this one and would like to test it on our platform.
Thanks
-Bryan
Quoted 62 lines
Cheers
Trond
------------------------------------------------------------
From: Trond Myklebust <[email protected]>
Date: Thu, 5 Feb 2009 10:23:36 -0500
NFS: Kill the "defined but not used" compile error on nommu machinesBryan Wu reports that when compiling NFS on nommu machines he gets a "defined but not used" error on
nfs_file_mmap().The easiest fix is simply to get rid of the special casing in NFS, and just always call
generic_file_mmap()to set up the file.Signed-off-by Trond Myklebust <[email protected]>---
fs/nfs/file.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)fs/nfs/file.c +5
-8@@ -64,11 +64,7 @@ const struct file_operations nfs_file_operations = { .write = do_sync_write, .aio_read = nfs_file_read, .aio_write = nfs_file_write, -#ifdef CONFIG_MMU .mmap = nfs_file_mmap, -#else - .mmap = generic_file_mmap, -#endif .open = nfs_file_open, .flush = nfs_file_flush, .release = nfs_file_release,@@ -304,11 +300,13 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma)dprintk ("NFS: mmap(%s/%s)\n" , dentry->d_parent->d_name.name, dentry->d_name.name); - status =nfs_revalidate_mapping (inode, file->f_mapping); +/* Note: generic_file_mmap() returns ENOSYS on nommu systems +* so we call that before revalidating the mapping +*/ + status =generic_file_mmap (file, vma);if (!status) { vma->vm_ops = &nfs_file_vm_ops; - vma->vm_flags |=VM_CAN_NONLINEAR ; -file_accessed (file); + status =nfs_revalidate_mapping (inode, file->f_mapping); }return status; } --Trond Myklebust
Linux NFS client maintainerNetApp
[email protected]
www.netapp.com