NFS: Simplify the nfs_read_completion functions
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
This commit is contained in:
parent
25b11dcdbf
commit
4bd8b01013
|
@ -243,7 +243,6 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
|
||||||
dreq->count += hdr->good_bytes;
|
dreq->count += hdr->good_bytes;
|
||||||
spin_unlock(&dreq->lock);
|
spin_unlock(&dreq->lock);
|
||||||
|
|
||||||
if (!test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
|
||||||
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;
|
||||||
|
@ -256,24 +255,17 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
|
||||||
hdr->good_bytes & ~PAGE_MASK,
|
hdr->good_bytes & ~PAGE_MASK,
|
||||||
PAGE_SIZE);
|
PAGE_SIZE);
|
||||||
}
|
}
|
||||||
bytes += req->wb_bytes;
|
if (!PageCompound(page)) {
|
||||||
nfs_list_remove_request(req);
|
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
||||||
if (!PageCompound(page))
|
|
||||||
set_page_dirty(page);
|
|
||||||
nfs_direct_readpage_release(req);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (!list_empty(&hdr->pages)) {
|
|
||||||
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
|
|
||||||
|
|
||||||
if (bytes < hdr->good_bytes)
|
if (bytes < hdr->good_bytes)
|
||||||
if (!PageCompound(req->wb_page))
|
set_page_dirty(page);
|
||||||
set_page_dirty(req->wb_page);
|
} else
|
||||||
|
set_page_dirty(page);
|
||||||
|
}
|
||||||
bytes += req->wb_bytes;
|
bytes += req->wb_bytes;
|
||||||
nfs_list_remove_request(req);
|
nfs_list_remove_request(req);
|
||||||
nfs_direct_readpage_release(req);
|
nfs_direct_readpage_release(req);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
out_put:
|
out_put:
|
||||||
if (put_dreq(dreq))
|
if (put_dreq(dreq))
|
||||||
nfs_direct_complete(dreq);
|
nfs_direct_complete(dreq);
|
||||||
|
|
|
@ -179,7 +179,6 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr)
|
||||||
|
|
||||||
if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
|
if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
|
||||||
goto out;
|
goto out;
|
||||||
if (!test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
|
||||||
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;
|
||||||
|
@ -192,21 +191,14 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr)
|
||||||
hdr->good_bytes & ~PAGE_MASK,
|
hdr->good_bytes & ~PAGE_MASK,
|
||||||
PAGE_SIZE);
|
PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
bytes += req->wb_bytes;
|
||||||
|
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
||||||
|
if (bytes <= hdr->good_bytes)
|
||||||
|
SetPageUptodate(page);
|
||||||
|
} else
|
||||||
SetPageUptodate(page);
|
SetPageUptodate(page);
|
||||||
nfs_list_remove_request(req);
|
nfs_list_remove_request(req);
|
||||||
nfs_readpage_release(req);
|
nfs_readpage_release(req);
|
||||||
bytes += PAGE_SIZE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (!list_empty(&hdr->pages)) {
|
|
||||||
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
|
|
||||||
|
|
||||||
bytes += req->wb_bytes;
|
|
||||||
if (bytes <= hdr->good_bytes)
|
|
||||||
SetPageUptodate(req->wb_page);
|
|
||||||
nfs_list_remove_request(req);
|
|
||||||
nfs_readpage_release(req);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
hdr->release(hdr);
|
hdr->release(hdr);
|
||||||
|
|
Loading…
Reference in a new issue