Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=749e146e01cf87ce3c1d6f6077b877471b04df5b
Commit:     749e146e01cf87ce3c1d6f6077b877471b04df5b
Parent:     7fe7f8487ae742239dd8c66596e2311c30d057d1
Author:     Chuck Lever <[EMAIL PROTECTED]>
AuthorDate: Sat May 19 17:22:46 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Thu May 24 10:44:20 2007 -0400

    NFS: Fix handful of compiler warnings in direct.c
    
    This patch fixes a couple of signage issues that were causing an Oops
    when running the LTP diotest4 test. get_user_pages() returns a signed
    error, hence we need to be careful when comparing with the unsigned
    number of pages from data->npages.
    
    Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/direct.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 345aa5c..6c588ec 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -122,9 +122,9 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const 
struct iovec *iov, loff_
        return -EINVAL;
 }
 
-static void nfs_direct_dirty_pages(struct page **pages, int npages)
+static void nfs_direct_dirty_pages(struct page **pages, unsigned int npages)
 {
-       int i;
+       unsigned int i;
        for (i = 0; i < npages; i++) {
                struct page *page = pages[i];
                if (!PageCompound(page))
@@ -132,9 +132,9 @@ static void nfs_direct_dirty_pages(struct page **pages, int 
npages)
        }
 }
 
-static void nfs_direct_release_pages(struct page **pages, int npages)
+static void nfs_direct_release_pages(struct page **pages, unsigned int npages)
 {
-       int i;
+       unsigned int i;
        for (i = 0; i < npages; i++)
                page_cache_release(pages[i]);
 }
@@ -279,9 +279,12 @@ static ssize_t nfs_direct_read_schedule(struct 
nfs_direct_req *dreq, unsigned lo
                result = get_user_pages(current, current->mm, user_addr,
                                        data->npages, 1, 0, data->pagevec, 
NULL);
                up_read(&current->mm->mmap_sem);
-               if (unlikely(result < data->npages)) {
-                       if (result > 0)
-                               nfs_direct_release_pages(data->pagevec, result);
+               if (result < 0) {
+                       nfs_readdata_release(data);
+                       break;
+               }
+               if ((unsigned)result < data->npages) {
+                       nfs_direct_release_pages(data->pagevec, result);
                        nfs_readdata_release(data);
                        break;
                }
@@ -610,9 +613,12 @@ static ssize_t nfs_direct_write_schedule(struct 
nfs_direct_req *dreq, unsigned l
                result = get_user_pages(current, current->mm, user_addr,
                                        data->npages, 0, 0, data->pagevec, 
NULL);
                up_read(&current->mm->mmap_sem);
-               if (unlikely(result < data->npages)) {
-                       if (result > 0)
-                               nfs_direct_release_pages(data->pagevec, result);
+               if (result < 0) {
+                       nfs_writedata_release(data);
+                       break;
+               }
+               if ((unsigned)result < data->npages) {
+                       nfs_direct_release_pages(data->pagevec, result);
                        nfs_writedata_release(data);
                        break;
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to