[pnfs] [PATCH 11/37] pnfs: check for {read, write}_pagelist methods earlier in pnfs_try_to_*

Benny Halevy bhalevy at panasas.com
Tue Jan 1 05:50:07 EST 2008


no need to call pnfs_{read,write}pages if layout driver does not
implement {read,write}_pagelist.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/pnfs.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 5bfb0f5..0065d34 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -885,15 +885,6 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
 		goto out;
 	}
 
-	if (!nfss->pnfs_curr_ld->ld_io_ops ||
-	    !nfss->pnfs_curr_ld->ld_io_ops->write_pagelist) {
-		printk(KERN_ERR
-		       "%s: ERROR, no layout driver write operation\n",
-		       __FUNCTION__);
-		status = 1;
-		goto out;
-	}
-
 	/* Determine number of pages
 	 */
 	pgcount = args->pgbase + args->count;
@@ -991,13 +982,6 @@ pnfs_readpages(struct nfs_read_data *rdata)
 		status = 1;
 		goto out;
 	}
-	if (!nfss->pnfs_curr_ld->ld_io_ops ||
-	    !nfss->pnfs_curr_ld->ld_io_ops->read_pagelist) {
-		printk(KERN_ERR "%s: ERROR, no layout driver read operation\n",
-		       __FUNCTION__);
-		status = 1;
-		goto out;
-	}
 
 	/* Determine number of pages. */
 	pgcount = args->pgbase + args->count;
@@ -1030,9 +1014,13 @@ pnfs_readpages(struct nfs_read_data *rdata)
 int pnfs_try_to_read_data(struct nfs_read_data *data,
 			   const struct rpc_call_ops *call_ops)
 {
+	struct inode *ino = data->inode;
+	struct nfs_server *nfss = NFS_SERVER(ino);
+
 	dprintk("%s:Begin\n", __FUNCTION__);
 	/* Only create an rpc request if utilizing NFSv4 I/O */
-	if (!pnfs_use_read(data->inode, data->args.count)) {
+	if (!pnfs_use_read(ino, data->args.count) ||
+	    !nfss->pnfs_curr_ld->ld_io_ops->read_pagelist) {
 		dprintk("%s:End not using pnfs\n", __FUNCTION__);
 		return 1;
 	} else {
@@ -1045,9 +1033,13 @@ int pnfs_try_to_read_data(struct nfs_read_data *data,
 int pnfs_try_to_write_data(struct nfs_write_data *data,
 				const struct rpc_call_ops *call_ops, int how)
 {
+	struct inode *ino = data->inode;
+	struct nfs_server *nfss = NFS_SERVER(ino);
+
 	dprintk("%s:Begin\n", __FUNCTION__);
 	/* Only create an rpc request if utilizing NFSv4 I/O */
-	if (!pnfs_use_write(data->inode, data->args.count)) {
+	if (!pnfs_use_write(ino, data->args.count) ||
+	    !nfss->pnfs_curr_ld->ld_io_ops->write_pagelist) {
 		dprintk("%s:End. not using pnfs\n", __FUNCTION__);
 		return 1;
 	} else {
-- 
1.5.3.3



More information about the pNFS mailing list