--- ./fs/nfs/proc.c.orig 2005-02-06 18:05:04.000000000 +0100 +++ ./fs/nfs/proc.c 2005-02-07 21:58:54.000000000 +0100 @@ -6,7 +6,7 @@ * OS-independent nfs remote procedure call functions * * Tuned by Alan Cox 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); dprintk("NFS reply create: %d\n", status); if (status == 0) { struct inode *inode; @@ -275,17 +283,17 @@ } 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); } dprintk("NFS reply mknod: %d\n", status); return status; } - + static int nfs_proc_remove(struct inode *dir, struct qstr *name) { @@ -294,16 +302,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; @@ -350,7 +352,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; } @@ -367,7 +369,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; } @@ -392,7 +394,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", 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); dprintk("NFS reply mkdir: %d\n", status); return status; } @@ -431,7 +433,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; } @@ -454,18 +456,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(); @@ -481,7 +477,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; @@ -504,7 +500,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;