aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@primarydata.com>2014-05-15 11:56:43 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-29 11:11:43 -0400
commitb4fdac1a5150174df0847a45dc6612ce5ce3daeb (patch)
tree477f3dc72760a8ff622934723c4a984cd4c9ce5d /fs/nfs/pagelist.c
parent8c8f1ac109726e4ed44a920f5c962c84610d4a17 (diff)
nfs: modify pg_test interface to return size_t
This is a step toward allowing pg_test to inform the the coalescing code to reduce the size of requests so they may fit in whatever scheme the pg_test callback wants to define. For now, just return the size of the request if there is space, or 0 if there is not. This shouldn't change any behavior as it acts the same as when the pg_test functions returned bool. Signed-off-by: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 4b4b212ec6b2..82233431880d 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -280,7 +280,17 @@ nfs_wait_on_request(struct nfs_page *req)
280 TASK_UNINTERRUPTIBLE); 280 TASK_UNINTERRUPTIBLE);
281} 281}
282 282
283bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req) 283/*
284 * nfs_generic_pg_test - determine if requests can be coalesced
285 * @desc: pointer to descriptor
286 * @prev: previous request in desc, or NULL
287 * @req: this request
288 *
289 * Returns zero if @req can be coalesced into @desc, otherwise it returns
290 * the size of the request.
291 */
292size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
293 struct nfs_page *prev, struct nfs_page *req)
284{ 294{
285 /* 295 /*
286 * FIXME: ideally we should be able to coalesce all requests 296 * FIXME: ideally we should be able to coalesce all requests
@@ -292,7 +302,9 @@ bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *pr
292 if (desc->pg_bsize < PAGE_SIZE) 302 if (desc->pg_bsize < PAGE_SIZE)
293 return 0; 303 return 0;
294 304
295 return desc->pg_count + req->wb_bytes <= desc->pg_bsize; 305 if (desc->pg_count + req->wb_bytes <= desc->pg_bsize)
306 return req->wb_bytes;
307 return 0;
296} 308}
297EXPORT_SYMBOL_GPL(nfs_generic_pg_test); 309EXPORT_SYMBOL_GPL(nfs_generic_pg_test);
298 310
@@ -747,6 +759,8 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
747 struct nfs_page *req, 759 struct nfs_page *req,
748 struct nfs_pageio_descriptor *pgio) 760 struct nfs_pageio_descriptor *pgio)
749{ 761{
762 size_t size;
763
750 if (!nfs_match_open_context(req->wb_context, prev->wb_context)) 764 if (!nfs_match_open_context(req->wb_context, prev->wb_context))
751 return false; 765 return false;
752 if (req->wb_context->dentry->d_inode->i_flock != NULL && 766 if (req->wb_context->dentry->d_inode->i_flock != NULL &&
@@ -758,7 +772,9 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
758 return false; 772 return false;
759 if (req_offset(req) != req_offset(prev) + prev->wb_bytes) 773 if (req_offset(req) != req_offset(prev) + prev->wb_bytes)
760 return false; 774 return false;
761 return pgio->pg_ops->pg_test(pgio, prev, req); 775 size = pgio->pg_ops->pg_test(pgio, prev, req);
776 WARN_ON_ONCE(size && size != req->wb_bytes);
777 return size > 0;
762} 778}
763 779
764/** 780/**