diff options
author | Weston Andros Adamson <dros@primarydata.com> | 2014-05-15 11:56:57 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-29 11:11:50 -0400 |
commit | 68072992c8f6ace57fe80b6fb5d57b3ae887a09d (patch) | |
tree | 2d6ee1de5a0a7cb61a1d9b171c8b05e83b8653e3 | |
parent | c6194271f94b81042bbc45034d31f9b0920f3905 (diff) |
nfs: support page groups in nfs_read_completion
nfs_read_completion relied on the fact that there was a 1:1 mapping
of page to nfs_request, but this has now changed.
Regions not covered by a request have already been zeroed elsewhere.
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/read.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 53d5b83611ce..e818a475ca64 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -130,7 +130,6 @@ static void nfs_page_group_set_uptodate(struct nfs_page *req) | |||
130 | SetPageUptodate(req->wb_page); | 130 | SetPageUptodate(req->wb_page); |
131 | } | 131 | } |
132 | 132 | ||
133 | /* Note io was page aligned */ | ||
134 | static void nfs_read_completion(struct nfs_pgio_header *hdr) | 133 | static void nfs_read_completion(struct nfs_pgio_header *hdr) |
135 | { | 134 | { |
136 | unsigned long bytes = 0; | 135 | unsigned long bytes = 0; |
@@ -140,14 +139,25 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr) | |||
140 | while (!list_empty(&hdr->pages)) { | 139 | while (!list_empty(&hdr->pages)) { |
141 | struct nfs_page *req = nfs_list_entry(hdr->pages.next); | 140 | struct nfs_page *req = nfs_list_entry(hdr->pages.next); |
142 | struct page *page = req->wb_page; | 141 | struct page *page = req->wb_page; |
142 | unsigned long start = req->wb_pgbase; | ||
143 | unsigned long end = req->wb_pgbase + req->wb_bytes; | ||
143 | 144 | ||
144 | if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) { | 145 | if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) { |
145 | if (bytes > hdr->good_bytes) | 146 | /* note: regions of the page not covered by a |
146 | zero_user(page, 0, PAGE_SIZE); | 147 | * request are zeroed in nfs_readpage_async / |
147 | else if (hdr->good_bytes - bytes < PAGE_SIZE) | 148 | * readpage_async_filler */ |
148 | zero_user_segment(page, | 149 | if (bytes > hdr->good_bytes) { |
149 | hdr->good_bytes & ~PAGE_MASK, | 150 | /* nothing in this request was good, so zero |
150 | PAGE_SIZE); | 151 | * the full extent of the request */ |
152 | zero_user_segment(page, start, end); | ||
153 | |||
154 | } else if (hdr->good_bytes - bytes < req->wb_bytes) { | ||
155 | /* part of this request has good bytes, but | ||
156 | * not all. zero the bad bytes */ | ||
157 | start += hdr->good_bytes - bytes; | ||
158 | WARN_ON(start < req->wb_pgbase); | ||
159 | zero_user_segment(page, start, end); | ||
160 | } | ||
151 | } | 161 | } |
152 | bytes += req->wb_bytes; | 162 | bytes += req->wb_bytes; |
153 | if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) { | 163 | if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) { |