aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/blocklayout
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/blocklayout
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/blocklayout')
-rw-r--r--fs/nfs/blocklayout/blocklayout.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 206cc68c9694..9b431f44fad9 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -1189,13 +1189,17 @@ bl_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
1189 pnfs_generic_pg_init_read(pgio, req); 1189 pnfs_generic_pg_init_read(pgio, req);
1190} 1190}
1191 1191
1192static bool 1192/*
1193 * Return 0 if @req cannot be coalesced into @pgio, otherwise return the number
1194 * of bytes (maximum @req->wb_bytes) that can be coalesced.
1195 */
1196static size_t
1193bl_pg_test_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, 1197bl_pg_test_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
1194 struct nfs_page *req) 1198 struct nfs_page *req)
1195{ 1199{
1196 if (pgio->pg_dreq != NULL && 1200 if (pgio->pg_dreq != NULL &&
1197 !is_aligned_req(req, SECTOR_SIZE)) 1201 !is_aligned_req(req, SECTOR_SIZE))
1198 return false; 1202 return 0;
1199 1203
1200 return pnfs_generic_pg_test(pgio, prev, req); 1204 return pnfs_generic_pg_test(pgio, prev, req);
1201} 1205}
@@ -1241,13 +1245,17 @@ bl_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
1241 } 1245 }
1242} 1246}
1243 1247
1244static bool 1248/*
1249 * Return 0 if @req cannot be coalesced into @pgio, otherwise return the number
1250 * of bytes (maximum @req->wb_bytes) that can be coalesced.
1251 */
1252static size_t
1245bl_pg_test_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, 1253bl_pg_test_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
1246 struct nfs_page *req) 1254 struct nfs_page *req)
1247{ 1255{
1248 if (pgio->pg_dreq != NULL && 1256 if (pgio->pg_dreq != NULL &&
1249 !is_aligned_req(req, PAGE_CACHE_SIZE)) 1257 !is_aligned_req(req, PAGE_CACHE_SIZE))
1250 return false; 1258 return 0;
1251 1259
1252 return pnfs_generic_pg_test(pgio, prev, req); 1260 return pnfs_generic_pg_test(pgio, prev, req);
1253} 1261}