--- ./fs/nfs/proc.c.orig	2005-05-05 18:03:48.000000000 +0200
+++ ./fs/nfs/proc.c	2005-05-05 20:03:33.000000000 +0200
@@ -6,7 +6,7 @@
  *  OS-independent nfs remote procedure call functions
  *
  *  Tuned by Alan Cox <A.Cox@swansea.ac.uk> for >3K buffers
- *  so at last we can have decent(ish) throughput off a 
+ *  so at last we can have decent(ish) throughput off a
  *  Sun server.
  *
  *  Coding optimized and cleaned up by Florian La Roche.
@@ -49,6 +49,25 @@
 
 extern struct rpc_procinfo nfs_procedures[];
 
+static __inline__ int
+nfs2_rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp,
+	      struct rpc_cred *cred, int flags)
+{
+	struct rpc_message msg = {
+		.rpc_proc	= &nfs_procedures[proc],
+		.rpc_argp	= argp,
+		.rpc_resp	= resp,
+		.rpc_cred	= cred,
+	};
+	return rpc_call_sync(clnt, &msg, flags);
+}
+
+static __inline__ int
+nfs2_rpc(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp)
+{
+	return nfs2_rpc_call(clnt, proc, argp, resp, NULL, 0);
+}
+
 /*
  * Bare-bones access to getattr: this is for nfs_read_super.
  */
@@ -62,12 +81,12 @@
 
 	dprintk("%s: call getattr\n", __FUNCTION__);
 	fattr->valid = 0;
-	status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0);
+	status = nfs2_rpc(server->client_sys, NFSPROC_GETATTR, fhandle, fattr);
 	dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
 	if (status)
 		return status;
 	dprintk("%s: call statfs\n", __FUNCTION__);
-	status = rpc_call(server->client_sys, NFSPROC_STATFS, fhandle, &fsinfo, 0);
+	status = nfs2_rpc(server->client_sys, NFSPROC_STATFS, fhandle, &fsinfo);
 	dprintk("%s: reply statfs: %d\n", __FUNCTION__, status);
 	if (status)
 		return status;
@@ -94,8 +113,7 @@
 
 	dprintk("NFS call  getattr\n");
 	fattr->valid = 0;
-	status = rpc_call(server->client, NFSPROC_GETATTR,
-				fhandle, fattr, 0);
+	status = nfs2_rpc(server->client, NFSPROC_GETATTR, fhandle, fattr);
 	dprintk("NFS reply getattr: %d\n", status);
 	return status;
 }
@@ -105,7 +123,7 @@
 		 struct iattr *sattr)
 {
 	struct inode *inode = dentry->d_inode;
-	struct nfs_sattrargs	arg = { 
+	struct nfs_sattrargs	arg = {
 		.fh	= NFS_FH(inode),
 		.sattr	= sattr
 	};
@@ -113,7 +131,7 @@
 
 	dprintk("NFS call  setattr\n");
 	fattr->valid = 0;
-	status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
+	status = nfs2_rpc(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr);
 	dprintk("NFS reply setattr: %d\n", status);
 	return status;
 }
@@ -135,7 +153,7 @@
 
 	dprintk("NFS call  lookup %s\n", name->name);
 	fattr->valid = 0;
-	status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res);
 	dprintk("NFS reply lookup: %d\n", status);
 	return status;
 }
@@ -152,7 +170,7 @@
 	int			status;
 
 	dprintk("NFS call  readlink\n");
-	status = rpc_call(NFS_CLIENT(inode), NFSPROC_READLINK, &args, NULL, 0);
+	status = nfs2_rpc(NFS_CLIENT(inode), NFSPROC_READLINK, &args, NULL);
 	dprintk("NFS reply readlink: %d\n", status);
 	return status;
 }
@@ -162,18 +180,13 @@
 	int			flags = rdata->flags;
 	struct inode *		inode = rdata->inode;
 	struct nfs_fattr *	fattr = rdata->res.fattr;
-	struct rpc_message	msg = {
-		.rpc_proc	= &nfs_procedures[NFSPROC_READ],
-		.rpc_argp	= &rdata->args,
-		.rpc_resp	= &rdata->res,
-		.rpc_cred	= rdata->cred,
-	};
 	int			status;
 
 	dprintk("NFS call  read %d @ %Ld\n", rdata->args.count,
 			(long long) rdata->args.offset);
 	fattr->valid = 0;
-	status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
+	status = nfs2_rpc_call(NFS_CLIENT(inode), NFSPROC_READ, &rdata->args,
+			       &rdata->res, rdata->cred, flags);
 	if (status >= 0) {
 		nfs_refresh_inode(inode, fattr);
 		/* Emulate the eof flag, which isn't normally needed in NFSv2
@@ -191,18 +204,13 @@
 	int			flags = wdata->flags;
 	struct inode *		inode = wdata->inode;
 	struct nfs_fattr *	fattr = wdata->res.fattr;
-	struct rpc_message	msg = {
-		.rpc_proc	= &nfs_procedures[NFSPROC_WRITE],
-		.rpc_argp	= &wdata->args,
-		.rpc_resp	= &wdata->res,
-		.rpc_cred	= wdata->cred,
-	};
 	int			status;
 
 	dprintk("NFS call  write %d @ %Ld\n", wdata->args.count,
 			(long long) wdata->args.offset);
 	fattr->valid = 0;
-	status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
+	status = nfs2_rpc_call(NFS_CLIENT(inode), NFSPROC_WRITE, &wdata->args,
+			       &wdata->res, wdata->cred, flags);
 	if (status >= 0) {
 		nfs_refresh_inode(inode, fattr);
 		wdata->res.count = wdata->args.count;
@@ -232,7 +240,7 @@
 
 	fattr.valid = 0;
 	dprintk("NFS call  create %s\n", dentry->d_name.name);
-	status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res);
 	if (status == 0)
 		status = nfs_instantiate(dentry, &fhandle, &fattr);
 	dprintk("NFS reply create: %d\n", status);
@@ -272,19 +280,19 @@
 	}
 
 	fattr.valid = 0;
-	status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res);
 
 	if (status == -EINVAL && S_ISFIFO(mode)) {
 		sattr->ia_mode = mode;
 		fattr.valid = 0;
-		status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
+		status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res);
 	}
 	if (status == 0)
 		status = nfs_instantiate(dentry, &fhandle, &fattr);
 	dprintk("NFS reply mknod: %d\n", status);
 	return status;
 }
-  
+
 static int
 nfs_proc_remove(struct inode *dir, struct qstr *name)
 {
@@ -293,16 +301,10 @@
 		.name		= name->name,
 		.len		= name->len
 	};
-	struct rpc_message	msg = { 
-		.rpc_proc	= &nfs_procedures[NFSPROC_REMOVE],
-		.rpc_argp	= &arg,
-		.rpc_resp	= NULL,
-		.rpc_cred	= NULL
-	};
 	int			status;
 
 	dprintk("NFS call  remove %s\n", name->name);
-	status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_REMOVE, &arg, NULL);
 
 	dprintk("NFS reply remove: %d\n", status);
 	return status;
@@ -349,7 +351,7 @@
 	int			status;
 
 	dprintk("NFS call  rename %s -> %s\n", old_name->name, new_name->name);
-	status = rpc_call(NFS_CLIENT(old_dir), NFSPROC_RENAME, &arg, NULL, 0);
+	status = nfs2_rpc(NFS_CLIENT(old_dir), NFSPROC_RENAME, &arg, NULL);
 	dprintk("NFS reply rename: %d\n", status);
 	return status;
 }
@@ -366,7 +368,7 @@
 	int			status;
 
 	dprintk("NFS call  link %s\n", name->name);
-	status = rpc_call(NFS_CLIENT(inode), NFSPROC_LINK, &arg, NULL, 0);
+	status = nfs2_rpc(NFS_CLIENT(inode), NFSPROC_LINK, &arg, NULL);
 	dprintk("NFS reply link: %d\n", status);
 	return status;
 }
@@ -391,7 +393,7 @@
 	dprintk("NFS call  symlink %s -> %s\n", name->name, path->name);
 	fattr->valid = 0;
 	fhandle->size = 0;
-	status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL);
 	dprintk("NFS reply symlink: %d\n", status);
 	return status;
 }
@@ -415,7 +417,7 @@
 
 	dprintk("NFS call  mkdir %s\n", dentry->d_name.name);
 	fattr.valid = 0;
-	status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res);
 	if (status == 0)
 		status = nfs_instantiate(dentry, &fhandle, &fattr);
 	dprintk("NFS reply mkdir: %d\n", status);
@@ -433,7 +435,7 @@
 	int			status;
 
 	dprintk("NFS call  rmdir %s\n", name->name);
-	status = rpc_call(NFS_CLIENT(dir), NFSPROC_RMDIR, &arg, NULL, 0);
+	status = nfs2_rpc(NFS_CLIENT(dir), NFSPROC_RMDIR, &arg, NULL);
 	dprintk("NFS reply rmdir: %d\n", status);
 	return status;
 }
@@ -456,18 +458,12 @@
 		.count		= count,
 		.pages		= &page
 	};
-	struct rpc_message	msg = {
-		.rpc_proc	= &nfs_procedures[NFSPROC_READDIR],
-		.rpc_argp	= &arg,
-		.rpc_resp	= NULL,
-		.rpc_cred	= cred
-	};
 	int			status;
 
 	lock_kernel();
 
 	dprintk("NFS call  readdir %d\n", (unsigned int)cookie);
-	status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
+	status = nfs2_rpc_call(NFS_CLIENT(dir), NFSPROC_READDIR, &arg, NULL, cred, 0);
 
 	dprintk("NFS reply readdir: %d\n", status);
 	unlock_kernel();
@@ -483,7 +479,7 @@
 
 	dprintk("NFS call  statfs\n");
 	stat->fattr->valid = 0;
-	status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
+	status = nfs2_rpc(server->client, NFSPROC_STATFS, fhandle, &fsinfo);
 	dprintk("NFS reply statfs: %d\n", status);
 	if (status)
 		goto out;
@@ -506,7 +502,7 @@
 
 	dprintk("NFS call  fsinfo\n");
 	info->fattr->valid = 0;
-	status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
+	status = nfs2_rpc(server->client, NFSPROC_STATFS, fhandle, &fsinfo);
 	dprintk("NFS reply fsinfo: %d\n", status);
 	if (status)
 		goto out;