[PATCH 3/3] SQUASHME: pnfs-submit: use nfs_page_array_len in pnfs_try_to_read_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No sense in open coding the logic here.

Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
---
 fs/nfs/pnfs.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 6ab1938..0f255f5 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1296,7 +1296,6 @@ pnfs_try_to_read_data(struct nfs_read_data *rdata,
 	struct inode *inode = rdata->inode;
 	struct nfs_server *nfss = NFS_SERVER(inode);
 	struct pnfs_layout_segment *lseg = rdata->req->wb_lseg;
-	int numpages, pgcount, temp;
 	enum pnfs_try_status trypnfs;
 
 	rdata->pdata.call_ops = call_ops;
@@ -1306,17 +1305,9 @@ pnfs_try_to_read_data(struct nfs_read_data *rdata,
 
 	get_lseg(lseg);
 
-	/* Determine number of pages. */
-	pgcount = rdata->args.pgbase + rdata->args.count;
-	temp = pgcount % PAGE_CACHE_SIZE;
-	numpages = pgcount / PAGE_CACHE_SIZE;
-	if (temp != 0)
-		numpages++;
-
-	dprintk("%s: Calling layout driver read with %d pages\n",
-		__func__, numpages);
 	rdata->pdata.lseg = lseg;
-	trypnfs = nfss->pnfs_curr_ld->ld_io_ops->read_pagelist(rdata, numpages);
+	trypnfs = nfss->pnfs_curr_ld->ld_io_ops->read_pagelist(rdata,
+		nfs_page_array_len(rdata->args.pgbase, rdata->args.count));
 	if (trypnfs == PNFS_NOT_ATTEMPTED) {
 		rdata->pdata.lseg = NULL;
 		put_lseg(lseg);
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux