Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=de05a0cc2a2ae16eb8d8dbf88fe728ace45beb9a
Commit:     de05a0cc2a2ae16eb8d8dbf88fe728ace45beb9a
Parent:     44dd151d5c21234cc534c47d7382f5c28c3143cd
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Sun May 20 13:05:05 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 23:40:23 2007 -0400

    NFS: Minor read optimisation...
    
    Since PG_uptodate may now end up getting set during the call to
    nfs_wb_page(), we can avoid putting a read request on the wire in those
    situations.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/read.c |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 7bd7cb9..c07d0d1 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -483,17 +483,19 @@ int nfs_readpage(struct file *file, struct page *page)
         */
        error = nfs_wb_page(inode, page);
        if (error)
-               goto out_error;
+               goto out_unlock;
+       if (PageUptodate(page))
+               goto out_unlock;
 
        error = -ESTALE;
        if (NFS_STALE(inode))
-               goto out_error;
+               goto out_unlock;
 
        if (file == NULL) {
                error = -EBADF;
                ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
                if (ctx == NULL)
-                       goto out_error;
+                       goto out_unlock;
        } else
                ctx = get_nfs_open_context((struct nfs_open_context *)
                                file->private_data);
@@ -502,8 +504,7 @@ int nfs_readpage(struct file *file, struct page *page)
 
        put_nfs_open_context(ctx);
        return error;
-
-out_error:
+out_unlock:
        unlock_page(page);
        return error;
 }
@@ -520,21 +521,32 @@ readpage_async_filler(void *data, struct page *page)
        struct inode *inode = page->mapping->host;
        struct nfs_page *new;
        unsigned int len;
+       int error;
+
+       error = nfs_wb_page(inode, page);
+       if (error)
+               goto out_unlock;
+       if (PageUptodate(page))
+               goto out_unlock;
 
-       nfs_wb_page(inode, page);
        len = nfs_page_length(page);
        if (len == 0)
                return nfs_return_empty_page(page);
+
        new = nfs_create_request(desc->ctx, inode, page, 0, len);
-       if (IS_ERR(new)) {
-                       SetPageError(page);
-                       unlock_page(page);
-                       return PTR_ERR(new);
-       }
+       if (IS_ERR(new))
+               goto out_error;
+
        if (len < PAGE_CACHE_SIZE)
                zero_user_page(page, len, PAGE_CACHE_SIZE - len, KM_USER0);
        nfs_pageio_add_request(desc->pgio, new);
        return 0;
+out_error:
+       error = PTR_ERR(new);
+       SetPageError(page);
+out_unlock:
+       unlock_page(page);
+       return error;
 }
 
 int nfs_readpages(struct file *filp, struct address_space *mapping,
-
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