aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/objlayout/objio_osd.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/objlayout/objio_osd.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/objlayout/objio_osd.c')
-rw-r--r--fs/nfs/objlayout/objio_osd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 426b366b0b33..71b9c69dbe9c 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -564,14 +564,19 @@ int objio_write_pagelist(struct nfs_pgio_data *wdata, int how)
564 return 0; 564 return 0;
565} 565}
566 566
567static bool objio_pg_test(struct nfs_pageio_descriptor *pgio, 567/*
568 * Return 0 if @req cannot be coalesced into @pgio, otherwise return the number
569 * of bytes (maximum @req->wb_bytes) that can be coalesced.
570 */
571static size_t objio_pg_test(struct nfs_pageio_descriptor *pgio,
568 struct nfs_page *prev, struct nfs_page *req) 572 struct nfs_page *prev, struct nfs_page *req)
569{ 573{
570 if (!pnfs_generic_pg_test(pgio, prev, req)) 574 if (!pnfs_generic_pg_test(pgio, prev, req) ||
571 return false; 575 pgio->pg_count + req->wb_bytes >
576 (unsigned long)pgio->pg_layout_private)
577 return 0;
572 578
573 return pgio->pg_count + req->wb_bytes <= 579 return req->wb_bytes;
574 (unsigned long)pgio->pg_layout_private;
575} 580}
576 581
577static void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) 582static void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)