aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4filelayout.c
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-02-28 20:34:14 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-11 15:38:42 -0500
commit94ad1c80e28f9700c84b4d28d1e5302ddf63a6fd (patch)
tree2c600c1f8e85648c7693b5f0018b5d0b7e960b5f /fs/nfs/nfs4filelayout.c
parentd684d2ae10a4f95d3035abf698d7d611ff2cd279 (diff)
NFSv4.1: coelesce across layout stripes
Add a pg_test layout driver hook which is used to avoid coelescing I/O across layout stripes. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Andy Adamson <andros@citi.umich.edu> Signed-off-by: Dean Hildebrand <dhildeb@us.ibm.com> Signed-off-by: Fred Isaman <iisaman@citi.umich.edu> Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Tao Guo <guotao@nrchpc.ac.cn> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r--fs/nfs/nfs4filelayout.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 23f930caf1e2..0efe8cbd9e3c 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -252,6 +252,31 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg)
252 _filelayout_free_lseg(fl); 252 _filelayout_free_lseg(fl);
253} 253}
254 254
255/*
256 * filelayout_pg_test(). Called by nfs_can_coalesce_requests()
257 *
258 * return 1 : coalesce page
259 * return 0 : don't coalesce page
260 */
261int
262filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
263 struct nfs_page *req)
264{
265 u64 p_stripe, r_stripe;
266 u32 stripe_unit;
267
268 if (!pgio->pg_lseg)
269 return 1;
270 p_stripe = (u64)prev->wb_index << PAGE_CACHE_SHIFT;
271 r_stripe = (u64)req->wb_index << PAGE_CACHE_SHIFT;
272 stripe_unit = FILELAYOUT_LSEG(pgio->pg_lseg)->stripe_unit;
273
274 do_div(p_stripe, stripe_unit);
275 do_div(r_stripe, stripe_unit);
276
277 return (p_stripe == r_stripe);
278}
279
255static struct pnfs_layoutdriver_type filelayout_type = { 280static struct pnfs_layoutdriver_type filelayout_type = {
256 .id = LAYOUT_NFSV4_1_FILES, 281 .id = LAYOUT_NFSV4_1_FILES,
257 .name = "LAYOUT_NFSV4_1_FILES", 282 .name = "LAYOUT_NFSV4_1_FILES",
@@ -260,6 +285,7 @@ static struct pnfs_layoutdriver_type filelayout_type = {
260 .clear_layoutdriver = filelayout_clear_layoutdriver, 285 .clear_layoutdriver = filelayout_clear_layoutdriver,
261 .alloc_lseg = filelayout_alloc_lseg, 286 .alloc_lseg = filelayout_alloc_lseg,
262 .free_lseg = filelayout_free_lseg, 287 .free_lseg = filelayout_free_lseg,
288 .pg_test = filelayout_pg_test,
263}; 289};
264 290
265static int __init nfs4filelayout_init(void) 291static int __init nfs4filelayout_init(void)