aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@primarydata.com>2014-05-15 11:56:45 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-29 11:11:44 -0400
commit2bfc6e566daa8386c9cffef2f7de17fc330d3835 (patch)
treea615bb7091787ad574c5b31bcd6a30a5bfb8c2f9 /fs/nfs/direct.c
parentab75e417192a486ffe63a314b6d2e7361f0e157f (diff)
nfs: add support for multiple nfs reqs per page
Add "page groups" - a circular list of nfs requests (struct nfs_page) that all reference the same page. This gives nfs read and write paths the ability to account for sub-page regions independently. This somewhat follows the design of struct buffer_head's sub-page accounting. Only "head" requests are ever added/removed from the inode list in the buffered write path. "head" and "sub" requests are treated the same through the read path and the rest of the write/commit path. Requests are given an extra reference across the life of the list. Page groups are never rejoined after being split. If the read/write request fails and the client falls back to another path (ie revert to MDS in PNFS case), the already split requests are pushed through the recoalescing code again, which may split them further and then coalesce them into properly sized requests on the wire. Fragmentation shouldn't be a problem with the current design, because we flush all requests in page group when a non-contiguous request is added, so the only time resplitting should occur is on a resend of a read or write. This patch lays the groundwork for sub-page splitting, but does not actually do any splitting. For now all page groups have one request as pg_test functions don't yet split pages. There are several related patches that are needed support multiple requests per page group. Signed-off-by: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 1dd8c622d719..2c0e08f4cf71 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -380,7 +380,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_pageio_descriptor *de
380 struct nfs_page *req; 380 struct nfs_page *req;
381 unsigned int req_len = min_t(size_t, bytes, PAGE_SIZE - pgbase); 381 unsigned int req_len = min_t(size_t, bytes, PAGE_SIZE - pgbase);
382 /* XXX do we need to do the eof zeroing found in async_filler? */ 382 /* XXX do we need to do the eof zeroing found in async_filler? */
383 req = nfs_create_request(dreq->ctx, pagevec[i], 383 req = nfs_create_request(dreq->ctx, pagevec[i], NULL,
384 pgbase, req_len); 384 pgbase, req_len);
385 if (IS_ERR(req)) { 385 if (IS_ERR(req)) {
386 result = PTR_ERR(req); 386 result = PTR_ERR(req);
@@ -749,7 +749,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d
749 struct nfs_page *req; 749 struct nfs_page *req;
750 unsigned int req_len = min_t(size_t, bytes, PAGE_SIZE - pgbase); 750 unsigned int req_len = min_t(size_t, bytes, PAGE_SIZE - pgbase);
751 751
752 req = nfs_create_request(dreq->ctx, pagevec[i], 752 req = nfs_create_request(dreq->ctx, pagevec[i], NULL,
753 pgbase, req_len); 753 pgbase, req_len);
754 if (IS_ERR(req)) { 754 if (IS_ERR(req)) {
755 result = PTR_ERR(req); 755 result = PTR_ERR(req);
@@ -827,6 +827,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
827 spin_unlock(&dreq->lock); 827 spin_unlock(&dreq->lock);
828 828
829 while (!list_empty(&hdr->pages)) { 829 while (!list_empty(&hdr->pages)) {
830 bool do_destroy = true;
831
830 req = nfs_list_entry(hdr->pages.next); 832 req = nfs_list_entry(hdr->pages.next);
831 nfs_list_remove_request(req); 833 nfs_list_remove_request(req);
832 switch (bit) { 834 switch (bit) {
@@ -834,6 +836,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
834 case NFS_IOHDR_NEED_COMMIT: 836 case NFS_IOHDR_NEED_COMMIT:
835 kref_get(&req->wb_kref); 837 kref_get(&req->wb_kref);
836 nfs_mark_request_commit(req, hdr->lseg, &cinfo); 838 nfs_mark_request_commit(req, hdr->lseg, &cinfo);
839 do_destroy = false;
837 } 840 }
838 nfs_unlock_and_release_request(req); 841 nfs_unlock_and_release_request(req);
839 } 842 }