Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d4a8f3677fe2c2fc86443254fe42825e244c194d
Commit:     d4a8f3677fe2c2fc86443254fe42825e244c194d
Parent:     749e146e01cf87ce3c1d6f6077b877471b04df5b
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Tue May 22 10:22:27 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Thu May 24 11:18:18 2007 -0400

    NFS: Fix nfs_direct_dirty_pages()
    
    We only need to dirty the pages that were actually read in.
    
    Also convert nfs_direct_dirty_pages() to call set_page_dirty() instead of
    set_page_dirty_lock(). A call to lock_page() is unacceptable in an rpciod
    callback function.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/direct.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 6c588ec..0c542ec 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -122,13 +122,19 @@ 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, unsigned int npages)
+static void nfs_direct_dirty_pages(struct page **pages, unsigned int pgbase, 
size_t count)
 {
+       unsigned int npages;
        unsigned int i;
+
+       if (count == 0)
+               return;
+       pages += (pgbase >> PAGE_SHIFT);
+       npages = (count + (pgbase & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
        for (i = 0; i < npages; i++) {
                struct page *page = pages[i];
                if (!PageCompound(page))
-                       set_page_dirty_lock(page);
+                       set_page_dirty(page);
        }
 }
 
@@ -224,17 +230,18 @@ static void nfs_direct_read_result(struct rpc_task *task, 
void *calldata)
        if (nfs_readpage_result(task, data) != 0)
                return;
 
-       nfs_direct_dirty_pages(data->pagevec, data->npages);
-       nfs_direct_release_pages(data->pagevec, data->npages);
-
        spin_lock(&dreq->lock);
-
-       if (likely(task->tk_status >= 0))
-               dreq->count += data->res.count;
-       else
+       if (unlikely(task->tk_status < 0)) {
                dreq->error = task->tk_status;
-
-       spin_unlock(&dreq->lock);
+               spin_unlock(&dreq->lock);
+       } else {
+               dreq->count += data->res.count;
+               spin_unlock(&dreq->lock);
+               nfs_direct_dirty_pages(data->pagevec,
+                               data->args.pgbase,
+                               data->res.count);
+       }
+       nfs_direct_release_pages(data->pagevec, data->npages);
 
        if (put_dreq(dreq))
                nfs_direct_complete(dreq);
-
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