2012-05-04 18:09:37

by Myklebust, Trond

[permalink] [raw]
Subject: [PATCH 1/2] NFS: Fix O_DIRECT compile warnings

Fix the following compile warnings:
fs/nfs/direct.c: In function 'nfs_direct_read_schedule_segment':
fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c:352:27: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c: In function 'nfs_direct_write_schedule_segment':
fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types
lacks a cast [enabled by default]
fs/nfs/direct.c:650:27: warning: comparison of distinct pointer types
lacks a cast [enabled by default]

Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Cc: Fred Isaman <[email protected]>
Cc: Stephen Rothwell <[email protected]>
---
fs/nfs/direct.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index aab3016..dca9c81 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -322,7 +322,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_pageio_descriptor *de
int i;

pgbase = user_addr & ~PAGE_MASK;
- bytes = min(max(rsize, PAGE_SIZE), count);
+ bytes = min(max_t(size_t, rsize, PAGE_SIZE), count);

result = -ENOMEM;
npages = nfs_page_array_len(pgbase, bytes);
@@ -349,7 +349,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_pageio_descriptor *de

for (i = 0; i < npages; i++) {
struct nfs_page *req;
- unsigned int req_len = min(bytes, PAGE_SIZE - pgbase);
+ unsigned int req_len = min_t(size_t, bytes, PAGE_SIZE - pgbase);
/* XXX do we need to do the eof zeroing found in async_filler? */
req = nfs_create_request(dreq->ctx, dreq->inode,
pagevec[i],
@@ -619,7 +619,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d
int i;

pgbase = user_addr & ~PAGE_MASK;
- bytes = min(max(wsize, PAGE_SIZE), count);
+ bytes = min(max_t(size_t, wsize, PAGE_SIZE), count);

result = -ENOMEM;
npages = nfs_page_array_len(pgbase, bytes);
@@ -647,7 +647,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d

for (i = 0; i < npages; i++) {
struct nfs_page *req;
- unsigned int req_len = min(bytes, PAGE_SIZE - pgbase);
+ unsigned int req_len = min_t(size_t, bytes, PAGE_SIZE - pgbase);

req = nfs_create_request(dreq->ctx, dreq->inode,
pagevec[i],
--
1.7.7.6



2012-05-07 00:13:15

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH 1/2] NFS: Fix O_DIRECT compile warnings

Hi Trond,

On Fri, 4 May 2012 14:09:18 -0400 Trond Myklebust <[email protected]> wrote:
>
> Fix the following compile warnings:
> fs/nfs/direct.c: In function 'nfs_direct_read_schedule_segment':
> fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c:352:27: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c: In function 'nfs_direct_write_schedule_segment':
> fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
> fs/nfs/direct.c:650:27: warning: comparison of distinct pointer types
> lacks a cast [enabled by default]
>
> Reported-by: Stephen Rothwell <[email protected]>
> Signed-off-by: Trond Myklebust <[email protected]>
> Cc: Fred Isaman <[email protected]>
> Cc: Stephen Rothwell <[email protected]>

That works for me.

Acked-by: Stephen Rothwell <[email protected]>

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (1.48 kB)
(No filename) (836.00 B)
Download all attachments

2012-05-04 18:56:57

by Boaz Harrosh

[permalink] [raw]
Subject: Re: [PATCH 2/2] NFS: Fix sparse warnings

On 05/04/2012 09:09 PM, Trond Myklebust wrote:

> Fix the following sparse warnings:
>
> fs/nfs/direct.c:221:6: warning: symbol 'nfs_direct_readpage_release' was
> not declared. Should it be static?
> fs/nfs/read.c:38:43: warning: non-ANSI function declaration of function
> 'nfs_readhdr_alloc'
> fs/nfs/objlayout/objio_osd.c:214:5: warning: symbol '__alloc_objio_seg'
> was not declared. Should it be static?
>
> Signed-off-by: Trond Myklebust <[email protected]>
> Cc: Fred Isaman <[email protected]>
> Cc: Boaz Harrosh <[email protected]>
> ---
> fs/nfs/direct.c | 2 +-
> fs/nfs/objlayout/objio_osd.c | 2 +-
> fs/nfs/read.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
> index dca9c81..257d009 100644
> --- a/fs/nfs/direct.c
> +++ b/fs/nfs/direct.c
> @@ -218,7 +218,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
> nfs_direct_req_release(dreq);
> }
>
> -void nfs_direct_readpage_release(struct nfs_page *req)
> +static void nfs_direct_readpage_release(struct nfs_page *req)
> {
> dprintk("NFS: direct read done (%s/%lld %d@%lld)\n",
> req->wb_context->dentry->d_inode->i_sb->s_id,
> diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
> index fbf4874..b47277b 100644
> --- a/fs/nfs/objlayout/objio_osd.c
> +++ b/fs/nfs/objlayout/objio_osd.c
> @@ -211,7 +211,7 @@ static void copy_single_comp(struct ore_components *oc, unsigned c,
> memcpy(ocomp->cred, src_comp->oc_cap.cred, sizeof(ocomp->cred));
> }
>
> -int __alloc_objio_seg(unsigned numdevs, gfp_t gfp_flags,
> +static int __alloc_objio_seg(unsigned numdevs, gfp_t gfp_flags,
> struct objio_segment **pseg)
> {


Thanks!

Stupid compiler "can't you see the '__' of course it's static" ;-)

I hope that's the last one of that.

Boaz

> /* This is the in memory structure of the objio_segment
> diff --git a/fs/nfs/read.c b/fs/nfs/read.c
> index 37c9eb2..f23cf25 100644
> --- a/fs/nfs/read.c
> +++ b/fs/nfs/read.c
> @@ -35,7 +35,7 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
>
> static struct kmem_cache *nfs_rdata_cachep;
>
> -struct nfs_read_header *nfs_readhdr_alloc()
> +struct nfs_read_header *nfs_readhdr_alloc(void)
> {
> struct nfs_read_header *rhdr;
>



2012-05-04 18:09:38

by Myklebust, Trond

[permalink] [raw]
Subject: [PATCH 2/2] NFS: Fix sparse warnings

Fix the following sparse warnings:

fs/nfs/direct.c:221:6: warning: symbol 'nfs_direct_readpage_release' was
not declared. Should it be static?
fs/nfs/read.c:38:43: warning: non-ANSI function declaration of function
'nfs_readhdr_alloc'
fs/nfs/objlayout/objio_osd.c:214:5: warning: symbol '__alloc_objio_seg'
was not declared. Should it be static?

Signed-off-by: Trond Myklebust <[email protected]>
Cc: Fred Isaman <[email protected]>
Cc: Boaz Harrosh <[email protected]>
---
fs/nfs/direct.c | 2 +-
fs/nfs/objlayout/objio_osd.c | 2 +-
fs/nfs/read.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index dca9c81..257d009 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -218,7 +218,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
nfs_direct_req_release(dreq);
}

-void nfs_direct_readpage_release(struct nfs_page *req)
+static void nfs_direct_readpage_release(struct nfs_page *req)
{
dprintk("NFS: direct read done (%s/%lld %d@%lld)\n",
req->wb_context->dentry->d_inode->i_sb->s_id,
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index fbf4874..b47277b 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -211,7 +211,7 @@ static void copy_single_comp(struct ore_components *oc, unsigned c,
memcpy(ocomp->cred, src_comp->oc_cap.cred, sizeof(ocomp->cred));
}

-int __alloc_objio_seg(unsigned numdevs, gfp_t gfp_flags,
+static int __alloc_objio_seg(unsigned numdevs, gfp_t gfp_flags,
struct objio_segment **pseg)
{
/* This is the in memory structure of the objio_segment
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 37c9eb2..f23cf25 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -35,7 +35,7 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;

static struct kmem_cache *nfs_rdata_cachep;

-struct nfs_read_header *nfs_readhdr_alloc()
+struct nfs_read_header *nfs_readhdr_alloc(void)
{
struct nfs_read_header *rhdr;

--
1.7.7.6