mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
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>
This commit is contained in:
parent
c6194271f9
commit
68072992c8
@ -130,7 +130,6 @@ static void nfs_page_group_set_uptodate(struct nfs_page *req)
|
|||||||
SetPageUptodate(req->wb_page);
|
SetPageUptodate(req->wb_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note io was page aligned */
|
|
||||||
static void nfs_read_completion(struct nfs_pgio_header *hdr)
|
static void nfs_read_completion(struct nfs_pgio_header *hdr)
|
||||||
{
|
{
|
||||||
unsigned long bytes = 0;
|
unsigned long bytes = 0;
|
||||||
@ -140,14 +139,25 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr)
|
|||||||
while (!list_empty(&hdr->pages)) {
|
while (!list_empty(&hdr->pages)) {
|
||||||
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
|
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
|
||||||
struct page *page = req->wb_page;
|
struct page *page = req->wb_page;
|
||||||
|
unsigned long start = req->wb_pgbase;
|
||||||
|
unsigned long end = req->wb_pgbase + req->wb_bytes;
|
||||||
|
|
||||||
if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) {
|
if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) {
|
||||||
if (bytes > hdr->good_bytes)
|
/* note: regions of the page not covered by a
|
||||||
zero_user(page, 0, PAGE_SIZE);
|
* request are zeroed in nfs_readpage_async /
|
||||||
else if (hdr->good_bytes - bytes < PAGE_SIZE)
|
* readpage_async_filler */
|
||||||
zero_user_segment(page,
|
if (bytes > hdr->good_bytes) {
|
||||||
hdr->good_bytes & ~PAGE_MASK,
|
/* nothing in this request was good, so zero
|
||||||
PAGE_SIZE);
|
* the full extent of the request */
|
||||||
|
zero_user_segment(page, start, end);
|
||||||
|
|
||||||
|
} else if (hdr->good_bytes - bytes < req->wb_bytes) {
|
||||||
|
/* part of this request has good bytes, but
|
||||||
|
* not all. zero the bad bytes */
|
||||||
|
start += hdr->good_bytes - bytes;
|
||||||
|
WARN_ON(start < req->wb_pgbase);
|
||||||
|
zero_user_segment(page, start, end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bytes += req->wb_bytes;
|
bytes += req->wb_bytes;
|
||||||
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user