summaryrefslogtreecommitdiff
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-01 20:49:58 +0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-01 23:42:22 +0400
commit4bd8b010136afa0df9122a08bad361686bda0a1d (patch)
treea23c23299e4468baa0927d44992d2bd9da59579c /fs/nfs/direct.c
parent25b11dcdbfcad69a5ec03265e2dce19e5eca936b (diff)
downloadlinux-4bd8b010136afa0df9122a08bad361686bda0a1d.tar.xz
NFS: Simplify the nfs_read_completion functions
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index f17e4695c842..aab3016c437c 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -243,36 +243,28 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
dreq->count += hdr->good_bytes;
spin_unlock(&dreq->lock);
- if (!test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
- while (!list_empty(&hdr->pages)) {
- struct nfs_page *req = nfs_list_entry(hdr->pages.next);
- struct page *page = req->wb_page;
-
- if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) {
- if (bytes > hdr->good_bytes)
- zero_user(page, 0, PAGE_SIZE);
- else if (hdr->good_bytes - bytes < PAGE_SIZE)
- zero_user_segment(page,
- hdr->good_bytes & ~PAGE_MASK,
- PAGE_SIZE);
- }
- bytes += req->wb_bytes;
- nfs_list_remove_request(req);
- if (!PageCompound(page))
- set_page_dirty(page);
- nfs_direct_readpage_release(req);
+ while (!list_empty(&hdr->pages)) {
+ struct nfs_page *req = nfs_list_entry(hdr->pages.next);
+ struct page *page = req->wb_page;
+
+ if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) {
+ if (bytes > hdr->good_bytes)
+ zero_user(page, 0, PAGE_SIZE);
+ else if (hdr->good_bytes - bytes < PAGE_SIZE)
+ zero_user_segment(page,
+ hdr->good_bytes & ~PAGE_MASK,
+ PAGE_SIZE);
}
- } else {
- while (!list_empty(&hdr->pages)) {
- struct nfs_page *req = nfs_list_entry(hdr->pages.next);
-
- if (bytes < hdr->good_bytes)
- if (!PageCompound(req->wb_page))
- set_page_dirty(req->wb_page);
- bytes += req->wb_bytes;
- nfs_list_remove_request(req);
- nfs_direct_readpage_release(req);
+ if (!PageCompound(page)) {
+ if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
+ if (bytes < hdr->good_bytes)
+ set_page_dirty(page);
+ } else
+ set_page_dirty(page);
}
+ bytes += req->wb_bytes;
+ nfs_list_remove_request(req);
+ nfs_direct_readpage_release(req);
}
out_put:
if (put_dreq(dreq))